Upload File

post/v1/files?beta=true

Headers

anthropic-betastring

Optional header to specify the beta version(s) you want to use.

To use multiple betas, use a comma separated list like beta1,beta2 or specify the header multiple times for each beta.

Optional header to specify the beta version(s) you want to use.

To use multiple betas, use a comma separated list like beta1,beta2 or specify the header multiple times for each beta.

anthropic-versionstring

The version of the Claude API you want to use.

Read more about versioning and our version history here.

The version of the Claude API you want to use.

Read more about versioning and our version history here.

Response

Successful Response

created_atstring date-time required

RFC 3339 datetime string representing when the file was created.

downloadableboolean

Whether the file can be downloaded.

expires_atstring date-time nullable

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.

filenamestring required

Original filename of the uploaded file.

idstring required

Unique object identifier.

The format and length of IDs may change over time.

mime_typestring required

MIME type of the file.

size_bytesinteger required

Size of the file in bytes.

type'file' required

Object type.

For files, this is always "file".

Example response

{
  "created_at": "2025-04-15T18:37:24.100435Z",
  "expires_at": "2025-05-15T18:37:24.100435Z",
  "filename": "document.pdf",
  "id": "file_011CNha8iCJcU1wXNR6q4V8w",
  "mime_type": "application/pdf",
  "size_bytes": 102400
}

Changes

Changed in 4 of the 67 revisions of this API.25

    • added the new optional request property expires_in_seconds

      new-optional-request-property

    • added the optional property expires_at to the response with the 200 status

      response-optional-property-added

    This revision also has 6 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • removed the request property expires_in_seconds

      request-property-removed

    • removed the optional property expires_at from the response with the 200 status

      response-optional-property-removed

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • added the new optional request property expires_in_seconds

      new-optional-request-property

    • added the optional property expires_at to the response with the 200 status

      response-optional-property-added

    • added the optional property scope to the response with the 200 status

      response-optional-property-added