files changedbuild-with-claude/files
Nearest release: v2.1.308, published 2 hours after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+18added
Lines−18removed
From line
143
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits24to this page, all time
The whole hunk
from line 143, old and new numbered
/
from line 143
143143
144144The response from uploading a file includes:
145145
146```json Response
146```text Response wrap
147147{
148148 "id": "file_011CNha8iCJcU1wXNR6q4V8w",
149149 "type": "file",
from line 375
375375
376376The Files API supports different file types that correspond to different content block types:
377377
378| File type | MIME type | Content block type | Use case |
379| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | ------------------ | ---------------------------------- |
380| PDF | `application/pdf` | `document` | Text analysis, document processing |
381| Plain text | `text/plain` | `document` | Text analysis, processing |
382| Images | `image/jpeg`, `image/png`, `image/gif`, `image/webp` | `image` | Image analysis, visual tasks |
383| [Datasets, others](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files) | Varies | `container_upload` | Data analysis, visualization |
378| File type | MIME type | Content block type | Use case |
379| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | ------------------ | ---------------------------------- |
380| PDF | `application/pdf` | `document` | Text analysis, document processing |
381| Plain text | `text/plain` | `document` | Text analysis, processing |
382| Images | `image/jpeg`, `image/png`, `image/gif`, `image/webp` | `image` | Image analysis, visual tasks |
383| Datasets, others (see [Upload and analyze your own files](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files)) | Varies | `container_upload` | Data analysis, visualization |
384384
385385#### Document blocks
386386
from line 415
415415
416416#### Container upload blocks
417417
418To send a file to the [code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files), use the `container_upload` content block:
418To [send a file to the code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files), use the `container_upload` content block:
419419
420420```json
421421{
from line 426
426426
427427### Working with other file formats
428428
429For file types that the `document` block doesn't support (for example, .docx and .xlsx), convert the files to plain text and include the content directly in your message. Files that are already plain text, such as .csv and .md files, can either be read in this way or uploaded through the Files API with an explicit `text/plain` content type. To analyze datasets instead of reading them as text, upload them for the [code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files) using a `container_upload` block.
429For file types that the `document` block doesn't support (for example, .docx and .xlsx), convert the files to plain text and include the content directly in your message. Files that are already plain text, such as .csv and .md files, can either be read in this way or uploaded through the Files API with an explicit `text/plain` content type. To analyze datasets instead of reading them as text, upload them for the code execution tool using a `container_upload` block (see [Upload and analyze your own files](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upload-and-analyze-your-own-files)).
430430
431431The following examples read a text file and send its contents as plain text:
432432
from line 988
988988
989989Common errors when using the Files API include:
990990
991* **File not found (404):** The specified `file_id` doesn't exist or you don't have access to it
992* **Invalid file type (400):** The file type doesn't match the content block type (for example, using an image file in a document block)
993* **Not downloadable (400):** Files you upload have `"downloadable": false` and cannot be downloaded. Only files created by skills or the code execution tool can be downloaded
994* **Exceeds context window size (400):** The file is larger than the context window size (for example, using a 500 MB plain text file in a `/v1/messages` request)
995* **Invalid file name (400):** The file name doesn't meet the length requirements (1–255 characters) or contains forbidden characters (`<`, `>`, `:`, `"`, `|`, `?`, `*`, `\`, `/`, or Unicode characters 0–31)
996* **File too large (413):** File exceeds the 500 MB limit
997* **Storage limit exceeded (400):** Your organization has reached the 1 TB storage limit
991* **File not found (404):** The specified `file_id` doesn't exist or you don't have access to it.
992* **Invalid file type (400):** The file type doesn't match the content block type (for example, using an image file in a document block).
993* **Not downloadable (400):** Files you upload have `"downloadable": false` and cannot be downloaded. Only files created by skills or the code execution tool can be downloaded.
994* **Exceeds context window size (400):** The file is larger than the context window size (for example, using a 500 MB plain text file in a `/v1/messages` request).
995* **Invalid file name (400):** The file name doesn't meet the length requirements (1–255 characters) or contains forbidden characters (`<`, `>`, `:`, `"`, `|`, `?`, `*`, `\`, `/`, or Unicode characters 0–31).
996* **File too large (413):** The file exceeds the 500 MB limit.
997* **Storage limit exceeded (400):** Your organization has reached the 1 TB storage limit.
998998
999```json Output
999```text Output wrap
10001000{
10011001 "type": "error",
10021002 "error": {
No line in this hunk matches that.