SPB Git

Repository Public

retrieve_metadata.md 4.0 KB 212 lines markdown

1---2title: Get File Metadata3url: https://platform.claude.com/docs/en/api/beta/files/retrieve_metadata4---56# Get File Metadata78**GET** `/v1/files/{file_id}`910Get File Metadata1112## Path parameters1314- `file_id: string`1516  ID of the File.1718## Headers1920- `"anthropic-beta": optional array of AnthropicBeta`2122  Optional header to specify the beta version(s) you want to use.2324  - `string`2526  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`2728    - `"message-batches-2024-09-24"`2930    - `"prompt-caching-2024-07-31"`3132    - `"computer-use-2024-10-22"`3334    - `"computer-use-2025-01-24"`3536    - `"pdfs-2024-09-25"`3738    - `"token-counting-2024-11-01"`3940    - `"token-efficient-tools-2025-02-19"`4142    - `"output-128k-2025-02-19"`4344    - `"files-api-2025-04-14"`4546    - `"mcp-client-2025-04-04"`4748    - `"mcp-client-2025-11-20"`4950    - `"dev-full-thinking-2025-05-14"`5152    - `"interleaved-thinking-2025-05-14"`5354    - `"code-execution-2025-05-22"`5556    - `"extended-cache-ttl-2025-04-11"`5758    - `"context-1m-2025-08-07"`5960    - `"context-management-2025-06-27"`6162    - `"model-context-window-exceeded-2025-08-26"`6364    - `"skills-2025-10-02"`6566    - `"fast-mode-2026-02-01"`6768    - `"output-300k-2026-03-24"`6970    - `"user-profiles-2026-03-24"`7172    - `"user-profiles-2026-08-18"`7374    - `"user-profiles-2026-09-04"`7576    - `"advisor-tool-2026-03-01"`7778    - `"managed-agents-2026-04-01"`7980    - `"cache-diagnosis-2026-04-07"`8182    - `"dreaming-2026-04-21"`8384    - `"thinking-token-count-2026-05-13"`8586    - `"server-side-fallback-2026-06-01"`8788    - `"server-side-fallback-2026-07-01"`8990    - `"fallback-credit-2026-06-01"`9192    - `"fallback-credit-2026-07-01"`9394    - `"agent-memory-2026-07-22"`9596    - `"mid-conversation-tool-changes-2026-07-01"`9798    - `"compact-2026-01-12"`99100    - `"computer-use-2025-11-24"`101102    - `"mcp-tunnels-2026-06-22"`103104    - `"structured-outputs-2025-11-13"`105106    - `"task-budgets-2026-03-13"`107108    - `"thinking-display-updates-2026-08-18"`109110    - `"ce-user-management-2026-07-13"`111112    - `"mid-conversation-output-config-2026-07-01"`113114    - `"thinking-binding-controls-2026-08-01"`115116    - `"mid-conversation-system-clear-at-2026-08-21"`117118    - `"compact-2026-09-04"`119120- `"anthropic-workspace-id": optional string`121122## Returns123124- `BetaFileMetadata object`125126  - `type: "file"`127128    Object type.129130    For files, this is always `"file"`.131132  - `id: string`133134    Unique object identifier.135136    The format and length of IDs may change over time.137138  - `created_at: string`139140    RFC 3339 datetime string representing when the file was created.141142    format: date-time143144  - `filename: string`145146    Original filename of the uploaded file.147148    maxLength: 500, minLength: 1149150  - `mime_type: string`151152    MIME type of the file.153154    maxLength: 255, minLength: 1155156  - `size_bytes: number`157158    Size of the file in bytes.159160    minimum: 0161162  - `downloadable: optional boolean`163164    Whether the file can be downloaded.165166    default: false167168  - `expires_at: optional string or null`169170    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.171172    format: date-time173174  - `scope: optional BetaFileScope or null`175176    The scope of this file, indicating the context in which it was created (e.g., a session).177178    - `type: "session"`179180      The type of scope (e.g., `"session"`).181182    - `id: string`183184      The ID of the scoping resource (e.g., the session ID).185186## Example187188```bash189curl https://api.anthropic.com/v1/files/$FILE_ID \190    -H 'anthropic-version: 2023-06-01' \191    -H "X-Api-Key: $ANTHROPIC_API_KEY"192```193194### Response (200)195196```json197{198  "id": "file_011CNha8iCJcU1wXNR6q4V8w",199  "created_at": "2025-04-15T18:37:24.100435Z",200  "filename": "document.pdf",201  "mime_type": "application/pdf",202  "size_bytes": 102400,203  "type": "file",204  "downloadable": false,205  "expires_at": "2025-05-15T18:37:24.100435Z",206  "scope": {207    "id": "id",208    "type": "session"209  }210}211```212
Files main
Menu

Theme