Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

files changedbuild-with-claude/files

Nearest release: v2.1.238, published an hour before 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+7added
Lines−6removed
From line 32 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 32, old and new numbered
/
lines
from line 32
3232 
3333## How to use the Files API
3434 
35<Note>
36 Requests to the Files API endpoints (`/v1/files`) don't need a beta header. Neither do Messages or Message Batches requests that reference an uploaded file as a `document` or `image` source, or in a `container_upload` block for the code execution tool. Requests that still send the `anthropic-beta: files-api-2025-04-14` header keep working. On Files API requests, that header also selects the earlier response format: the list endpoint paginates with `before_id` and `after_id`, returns `has_more`, `first_id`, and `last_id` instead of `next_page`, and rejects the `page` and `ids[]` parameters as unknown fields. File objects returned under the header omit `expires_at` instead of returning `null` when no expiration is set. To use `page` and `ids[]` as described under [List files](https://platform.claude.com/docs/en/build-with-claude/files#list-files), send the request without the header. The PHP tabs on this page still call the SDK's `beta` namespace, which sends the header, so their list output uses the earlier format.
37</Note>
38 
3935### Uploading a file
4036 
4137Upload a file to be referenced in future API calls:
from line 123
127123 ```
128124 
129125 ```php PHP
126 // The PHP SDK exposes the Files API under the beta namespace; field names can differ from other SDKs.
130127 $file = $client->beta->files->upload(
131128 FileParam::fromResource(fopen('/path/to/document.pdf', 'rb'), contentType: 'application/pdf'),
132129 );
from line 330
333330 ```
334331 
335332 ```php PHP
333 // The PHP SDK supports file_id document and image sources only through $client->beta->messages with the files beta.
336334 $response = $client->beta->messages->create(
337335 maxTokens: 1024,
338336 messages: [
from line 739
741739 ```
742740 
743741 ```php PHP
742 // The PHP SDK exposes the Files API under the beta namespace; field names can differ from other SDKs.
743 // list() paginates with afterID, beforeID, and limit; page and ids[] are not parameters here.
744744 $client = new Client();
745745 
746746 $files = $client->beta->files->list();
from line 757
757757 
758758To check a known set of files in one request instead of paging, pass up to 100 file IDs as `ids[]` query parameters. An `ids[]` request always returns a single page (`next_page` is `null`), and any ID that does not resolve to a file in your workspace is silently omitted from `data`; compare the returned IDs against the requested IDs to detect misses. `ids[]` cannot be combined with `page` or `limit`.
759759 
760The `page` parameter, the `next_page` cursor, and the `ids[]` filter apply to requests sent without the `anthropic-beta: files-api-2025-04-14` header. Requests that send the header receive the earlier list format described in the note under [How to use the Files API](https://platform.claude.com/docs/en/build-with-claude/files#how-to-use-the-files-api).
761 
762760#### Get file metadata
763761 
764762Retrieve information about a specific file:
from line 804
806804 ```
807805 
808806 ```php PHP
807 // The PHP SDK exposes the Files API under the beta namespace; field names can differ from other SDKs.
809808 $file = $client->beta->files->retrieveMetadata($fileId);
810809 echo $file;
811810 ```
from line 855
856855 ```
857856 
858857 ```php PHP
858 // The PHP SDK exposes the Files API under the beta namespace; field names can differ from other SDKs.
859859 $client->beta->files->delete($fileId);
860860 ```
861861 
from line 932
932932 ```
933933 
934934 ```php PHP
935 // The PHP SDK exposes the Files API under the beta namespace; field names can differ from other SDKs.
935936 $fileContent = $client->beta->files->download($fileId);
936937 
937938 file_put_contents("downloaded_file.txt", $fileContent);
Feedback