← Files get-fableARCHIVED FILE
assets/skills/claude-code/claude-api/csharp/claude-api/files-api.md
679 Bytes · Oct 2, 2026 · 00:30 UTC
# Files API — C#
## Files API (Beta)
Files live under `client.Beta.Files` (namespace `Anthropic.Models.Beta.Files`). `BinaryContent` implicit-converts from `Stream` and `byte[]`.
```csharp
using Anthropic.Models.Beta.Files;
using Anthropic.Models.Beta.Messages;
FileMetadata meta = await client.Beta.Files.Upload(
new FileUploadParams { File = File.OpenRead("doc.pdf") });
// Referencing the uploaded file requires Beta message types:
new BetaRequestDocumentBlock {
Source = new BetaFileDocumentSource { FileID = meta.ID },
}
```
The non-beta `DocumentBlockParamSource` union has no file-ID variant — file references need `client.Beta.Messages.Create()`.
---
SHA-256: 413d08653a31766fdc3196f25af6ce386b085c41372dcbf33e9205cd35253731