List files

GEThttps:/api.openai.com/v1/files

Returns a list of files.

Query parameters

  • purpose
    string
    Only return files with the given purpose.
  • limit
    integer
    Defaults: 10000
    A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.
  • order
    string
    Defaults: desc

    Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

  • after
    string

    A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

Response

A list of File objects.

Example request
1
curl https://api.openai.com/v1/files \
2
-H "Authorization: Bearer $OPENAI_API_KEY"
Example response
1
{
2
"data": [
3
{
4
"id": "file-abc123",
5
"object": "file",
6
"bytes": 175,
7
"created_at": 1613677385,
8
"filename": "salesOverview.pdf",
9
"purpose": "assistants",
10
},
11
{
12
"id": "file-abc123",
13
"object": "file",
14
"bytes": 140,
15
"created_at": 1613779121,
16
"filename": "puppy.jsonl",
17
"purpose": "fine-tune",
18
}
19
],
20
"object": "list"
21
}
Built with