Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build LLM-powered apps with the Anthropic Claude API or SDK across Python, TypeScript, Java, Go, Ruby, C#, and PHP.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
go/claude-api/files-api.md
1# Files API — Go23## Files API (Beta)45Under `client.Beta.Files`. Method is **`Upload`** (NOT `New`/`Create`), params struct is `BetaFileUploadParams`. The `File` field takes an `io.Reader`; use `anthropic.File()` to attach a filename + content-type for the multipart encoding.67```go8f, _ := os.Open("./upload_me.txt")9defer f.Close()1011meta, err := client.Beta.Files.Upload(ctx, anthropic.BetaFileUploadParams{12File: anthropic.File(f, "upload_me.txt", "text/plain"),13Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaFilesAPI2025_04_14},14})15// meta.ID is the file_id to reference in subsequent message requests16```1718Other `Beta.Files` methods: `List`, `Delete`, `Download`, `GetMetadata`.1920---2122