Repository Public
1---2title: Upload File3url: https://platform.claude.com/docs/en/api/beta/files/upload4---56# Upload File78**POST** `/v1/files`910Upload File1112## Headers1314- `"anthropic-beta": optional array of AnthropicBeta`1516 Optional header to specify the beta version(s) you want to use.1718 - `string`1920 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`2122 - `"message-batches-2024-09-24"`2324 - `"prompt-caching-2024-07-31"`2526 - `"computer-use-2024-10-22"`2728 - `"computer-use-2025-01-24"`2930 - `"pdfs-2024-09-25"`3132 - `"token-counting-2024-11-01"`3334 - `"token-efficient-tools-2025-02-19"`3536 - `"output-128k-2025-02-19"`3738 - `"files-api-2025-04-14"`3940 - `"mcp-client-2025-04-04"`4142 - `"mcp-client-2025-11-20"`4344 - `"dev-full-thinking-2025-05-14"`4546 - `"interleaved-thinking-2025-05-14"`4748 - `"code-execution-2025-05-22"`4950 - `"extended-cache-ttl-2025-04-11"`5152 - `"context-1m-2025-08-07"`5354 - `"context-management-2025-06-27"`5556 - `"model-context-window-exceeded-2025-08-26"`5758 - `"skills-2025-10-02"`5960 - `"fast-mode-2026-02-01"`6162 - `"output-300k-2026-03-24"`6364 - `"user-profiles-2026-03-24"`6566 - `"user-profiles-2026-08-18"`6768 - `"user-profiles-2026-09-04"`6970 - `"advisor-tool-2026-03-01"`7172 - `"managed-agents-2026-04-01"`7374 - `"cache-diagnosis-2026-04-07"`7576 - `"dreaming-2026-04-21"`7778 - `"thinking-token-count-2026-05-13"`7980 - `"server-side-fallback-2026-06-01"`8182 - `"server-side-fallback-2026-07-01"`8384 - `"fallback-credit-2026-06-01"`8586 - `"fallback-credit-2026-07-01"`8788 - `"agent-memory-2026-07-22"`8990 - `"mid-conversation-tool-changes-2026-07-01"`9192 - `"compact-2026-01-12"`9394 - `"computer-use-2025-11-24"`9596 - `"mcp-tunnels-2026-06-22"`9798 - `"structured-outputs-2025-11-13"`99100 - `"task-budgets-2026-03-13"`101102 - `"thinking-display-updates-2026-08-18"`103104 - `"ce-user-management-2026-07-13"`105106 - `"mid-conversation-output-config-2026-07-01"`107108 - `"thinking-binding-controls-2026-08-01"`109110 - `"mid-conversation-system-clear-at-2026-08-21"`111112 - `"compact-2026-09-04"`113114- `"anthropic-workspace-id": optional string`115116## Body parameters (form-data)117118- `file: string`119120 The file to upload. Only the final path component of the part's `filename` is kept; an absent or empty `filename` is replaced with `unnamed` plus the extension for the file's stored `mime_type`, when known.121122 format: binary123124- `expires_in_seconds: optional number`125126 Seconds from upload until the file expires and its bytes become permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety days).127128 minimum: 3600, maximum: 7776000129130## Returns131132- `BetaFileMetadata object`133134 - `type: "file"`135136 Object type.137138 For files, this is always `"file"`.139140 - `id: string`141142 Unique object identifier.143144 The format and length of IDs may change over time.145146 - `created_at: string`147148 RFC 3339 datetime string representing when the file was created.149150 format: date-time151152 - `filename: string`153154 Original filename of the uploaded file.155156 maxLength: 500, minLength: 1157158 - `mime_type: string`159160 MIME type of the file.161162 maxLength: 255, minLength: 1163164 - `size_bytes: number`165166 Size of the file in bytes.167168 minimum: 0169170 - `downloadable: optional boolean`171172 Whether the file can be downloaded.173174 default: false175176 - `expires_at: optional string or null`177178 RFC 3339 datetime string representing when the file will expire and become unavailable for download. Null if the file does not expire. For files uploaded with `expires_in_seconds`, this is the upload time plus that value.179180 format: date-time181182 - `scope: optional BetaFileScope or null`183184 The scope of this file, indicating the context in which it was created (e.g., a session).185186 - `type: "session"`187188 The type of scope (e.g., `"session"`).189190 - `id: string`191192 The ID of the scoping resource (e.g., the session ID).193194## Example195196```bash197curl https://api.anthropic.com/v1/files \198 -H 'Content-Type: multipart/form-data' \199 -H 'anthropic-version: 2023-06-01' \200 -H "X-Api-Key: $ANTHROPIC_API_KEY" \201 -F 'file=@/path/to/file'202```203204### Response (200)205206```json207{208 "id": "file_011CNha8iCJcU1wXNR6q4V8w",209 "created_at": "2025-04-15T18:37:24.100435Z",210 "filename": "document.pdf",211 "mime_type": "application/pdf",212 "size_bytes": 102400,213 "type": "file",214 "downloadable": false,215 "expires_at": "2025-05-15T18:37:24.100435Z",216 "scope": {217 "id": "id",218 "type": "session"219 }220}221```222