from line 1
1---
2title: Files
3url: https://platform.claude.com/docs/en/api/beta/files
4---
5
61# Files
72
83## Upload File
94
10**post** `/v1/files`
5**POST** `/v1/files`
116
127Upload File
138
14### Header Parameters
9### Headers
1510
1611- `"anthropic-beta": optional array of AnthropicBeta`
1712
from line 84
8984
9085 - `"mid-conversation-tool-changes-2026-07-01"`
9186
87### Body parameters (form-data)
88
89- `file: string`
90
91 The file to upload
92
93 format: binary
94
9295### Returns
9396
94- `BetaFileMetadata object { id, created_at, filename, 5 more }`
97- `BetaFileMetadata object`
9598
9699 - `id: string`
97100
from line 106
103106
104107 RFC 3339 datetime string representing when the file was created.
105108
109 format: date-time
110
106111 - `filename: string`
107112
108113 Original filename of the uploaded file.
109114
115 maxLength: 500, minLength: 1
116
110117 - `mime_type: string`
111118
112119 MIME type of the file.
113120
121 maxLength: 255, minLength: 1
122
114123 - `size_bytes: number`
115124
116125 Size of the file in bytes.
117126
127 minimum: 0
128
118129 - `type: "file"`
119130
120131 Object type.
from line 132
121132
122133 For files, this is always `"file"`.
123134
124 - `"file"`
125
126135 - `downloadable: optional boolean`
127136
128137 Whether the file can be downloaded.
129138
139 default: false
140
130141 - `scope: optional BetaFileScope or null`
131142
132143 The scope of this file, indicating the context in which it was created (e.g., a session).
from line 150
139150
140151 The type of scope (e.g., `"session"`).
141152
142 - `"session"`
143
144153### Example
145154
146```http
155```bash
147156curl https://api.anthropic.com/v1/files \
148157 -H 'Content-Type: multipart/form-data' \
149158 -H 'anthropic-version: 2023-06-01' \
from line 161
152161 -F 'file=@/path/to/file'
153162```
154163
155#### Response
164#### Response (200)
156165
157166```json
158167{
from line 181
172181
173182## List Files
174183
175**get** `/v1/files`
184**GET** `/v1/files`
176185
177186List Files
178187
179### Query Parameters
188### Query parameters
180189
181190- `after_id: optional string`
182191
from line 201
192201
193202 Defaults to `20`. Ranges from `1` to `1000`.
194203
204 default: 20, maximum: 1000, minimum: 1
205
195206- `scope_id: optional string`
196207
197208 Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID).
198209
199### Header Parameters
210### Headers
200211
201212- `"anthropic-beta": optional array of AnthropicBeta`
202213
from line 301
290301
291302 RFC 3339 datetime string representing when the file was created.
292303
304 format: date-time
305
293306 - `filename: string`
294307
295308 Original filename of the uploaded file.
296309
310 maxLength: 500, minLength: 1
311
297312 - `mime_type: string`
298313
299314 MIME type of the file.
300315
316 maxLength: 255, minLength: 1
317
301318 - `size_bytes: number`
302319
303320 Size of the file in bytes.
304321
322 minimum: 0
323
305324 - `type: "file"`
306325
307326 Object type.
from line 327
308327
309328 For files, this is always `"file"`.
310329
311 - `"file"`
312
313330 - `downloadable: optional boolean`
314331
315332 Whether the file can be downloaded.
316333
334 default: false
335
317336 - `scope: optional BetaFileScope or null`
318337
319338 The scope of this file, indicating the context in which it was created (e.g., a session).
from line 345
326345
327346 The type of scope (e.g., `"session"`).
328347
329 - `"session"`
330
331348- `first_id: optional string or null`
332349
333350 ID of the first file in this page of results.
from line 353
336353
337354 Whether there are more results available.
338355
356 default: false
357
339358- `last_id: optional string or null`
340359
341360 ID of the last file in this page of results.
from line 361
342361
343362### Example
344363
345```http
364```bash
346365curl https://api.anthropic.com/v1/files \
347366 -H 'anthropic-version: 2023-06-01' \
348367 -H 'anthropic-beta: files-api-2025-04-14' \
from line 368
349368 -H "X-Api-Key: $ANTHROPIC_API_KEY"
350369```
351370
352#### Response
371#### Response (200)
353372
354373```json
355374{
from line 395
376395
377396## Download File
378397
379**get** `/v1/files/{file_id}/content`
398**GET** `/v1/files/{file_id}/content`
380399
381400Download File
382401
383### Path Parameters
402### Path parameters
384403
385404- `file_id: string`
386405
387406 ID of the File.
388407
389### Header Parameters
408### Headers
390409
391410- `"anthropic-beta": optional array of AnthropicBeta`
392411
from line 485
466485
467486### Example
468487
469```http
488```bash
470489curl https://api.anthropic.com/v1/files/$FILE_ID/content \
471490 -H 'anthropic-version: 2023-06-01' \
472491 -H 'anthropic-beta: files-api-2025-04-14' \
from line 494
475494
476495## Get File Metadata
477496
478**get** `/v1/files/{file_id}`
497**GET** `/v1/files/{file_id}`
479498
480499Get File Metadata
481500
482### Path Parameters
501### Path parameters
483502
484503- `file_id: string`
485504
486505 ID of the File.
487506
488### Header Parameters
507### Headers
489508
490509- `"anthropic-beta": optional array of AnthropicBeta`
491510
from line 584
565584
566585### Returns
567586
568- `BetaFileMetadata object { id, created_at, filename, 5 more }`
587- `BetaFileMetadata object`
569588
570589 - `id: string`
571590
from line 596
577596
578597 RFC 3339 datetime string representing when the file was created.
579598
599 format: date-time
600
580601 - `filename: string`
581602
582603 Original filename of the uploaded file.
583604
605 maxLength: 500, minLength: 1
606
584607 - `mime_type: string`
585608
586609 MIME type of the file.
587610
611 maxLength: 255, minLength: 1
612
588613 - `size_bytes: number`
589614
590615 Size of the file in bytes.
591616
617 minimum: 0
618
592619 - `type: "file"`
593620
594621 Object type.
from line 622
595622
596623 For files, this is always `"file"`.
597624
598 - `"file"`
599
600625 - `downloadable: optional boolean`
601626
602627 Whether the file can be downloaded.
603628
629 default: false
630
604631 - `scope: optional BetaFileScope or null`
605632
606633 The scope of this file, indicating the context in which it was created (e.g., a session).
from line 640
613640
614641 The type of scope (e.g., `"session"`).
615642
616 - `"session"`
617
618643### Example
619644
620```http
645```bash
621646curl https://api.anthropic.com/v1/files/$FILE_ID \
622647 -H 'anthropic-version: 2023-06-01' \
623648 -H 'anthropic-beta: files-api-2025-04-14' \
from line 649
624649 -H "X-Api-Key: $ANTHROPIC_API_KEY"
625650```
626651
627#### Response
652#### Response (200)
628653
629654```json
630655{
from line 669
644669
645670## Delete File
646671
647**delete** `/v1/files/{file_id}`
672**DELETE** `/v1/files/{file_id}`
648673
649674Delete File
650675
651### Path Parameters
676### Path parameters
652677
653678- `file_id: string`
654679
655680 ID of the File.
656681
657### Header Parameters
682### Headers
658683
659684- `"anthropic-beta": optional array of AnthropicBeta`
660685
from line 759
734759
735760### Returns
736761
737- `BetaDeletedFile object { id, type }`
762- `BetaDeletedFile object`
738763
739764 - `id: string`
740765
from line 771
746771
747772 For file deletion, this is always `"file_deleted"`.
748773
749 - `"file_deleted"`
774 default: file_deleted
750775
751776### Example
752777
753```http
778```bash
754779curl https://api.anthropic.com/v1/files/$FILE_ID \
755780 -X DELETE \
756781 -H 'anthropic-version: 2023-06-01' \
from line 783
758783 -H "X-Api-Key: $ANTHROPIC_API_KEY"
759784```
760785
761#### Response
786#### Response (200)
762787
763788```json
764789{
from line 792
767792}
768793```
769794
770## Domain Types
795## Domain types
771796
772797### Beta Deleted File
773798
774- `BetaDeletedFile object { id, type }`
799- `BetaDeletedFile object`
775800
776801 - `id: string`
777802
from line 808
783808
784809 For file deletion, this is always `"file_deleted"`.
785810
786 - `"file_deleted"`
811 default: file_deleted
787812
788813### Beta File Metadata
789814
790- `BetaFileMetadata object { id, created_at, filename, 5 more }`
815- `BetaFileMetadata object`
791816
792817 - `id: string`
793818
from line 824
799824
800825 RFC 3339 datetime string representing when the file was created.
801826
827 format: date-time
828
802829 - `filename: string`
803830
804831 Original filename of the uploaded file.
805832
833 maxLength: 500, minLength: 1
834
806835 - `mime_type: string`
807836
808837 MIME type of the file.
809838
839 maxLength: 255, minLength: 1
840
810841 - `size_bytes: number`
811842
812843 Size of the file in bytes.
813844
845 minimum: 0
846
814847 - `type: "file"`
815848
816849 Object type.
from line 850
817850
818851 For files, this is always `"file"`.
819852
820 - `"file"`
821
822853 - `downloadable: optional boolean`
823854
824855 Whether the file can be downloaded.
825856
857 default: false
858
826859 - `scope: optional BetaFileScope or null`
827860
828861 The scope of this file, indicating the context in which it was created (e.g., a session).
from line 868
835868
836869 The type of scope (e.g., `"session"`).
837870
838 - `"session"`
839
840871### Beta File Scope
841872
842- `BetaFileScope object { id, type }`
873- `BetaFileScope object`
843874
844875 - `id: string`
845876
from line 879
848879 - `type: "session"`
849880
850881 The type of scope (e.g., `"session"`).
851
852 - `"session"`
853882
No line in this hunk matches that.