Public preview: This API is in public preview. Endpoints, schemas, and limits may change before general availability.
Files API Reference
Upload, list, retrieve, download, and delete documents for use with the Responses API.
The Files API lets you upload, list, retrieve, download, and delete documents for use with the Responses API. It follows the OpenAI Files API, so client.files.* in the official SDKs works. Using files as context shows how to use a file in a request.
Files belong to the user who uploaded them, in the web app or through the API. A key only sees the files of the user who created it; any other file id returns 404.
The file object#
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"object": "file",
"bytes": 1048576,
"created_at": 1793577600,
"filename": "document.pdf",
"purpose": "assistants",
"status": "processed",
"expires_at": null,
"status_details": null
}
| Field | Description |
|---|---|
id | The file id (a UUID). Pass it as file_id in an input_file part. |
bytes | Size of the file in bytes. |
created_at | Upload time, in Unix epoch seconds. |
purpose | The purpose you uploaded the file with. |
status | processed when the file is ready to use, error when EU GPT could not read it. |
status_details | Why the file could not be read, when status is error; otherwise null. |
expires_at | Always null: files do not expire. |
Upload a file#
POST /v1/files
Uploads a file as multipart/form-data, with a file field and an optional purpose field (default "assistants"). The request returns 201 Created once the file has been read, so the status in the response is final.
Request:
curl https://api.eugpt.ai/v1/files \
-H "Authorization: Bearer $EUGPT_API_KEY" \
-F purpose="assistants" \
-F file="@document.pdf"
Response: the file object.
- Files can be up to 10 MB; a larger file returns
413. - Supported formats: PDF, Word, PowerPoint, Excel (also
.doc,.ppt,.xls), EPUB, RTF, HTML, Markdown, CSV, plain text, and images. - A file that cannot be read is still stored, with
status: "error"and the reason instatus_details. Delete it, and upload a readable version.
List files#
GET /v1/files
Returns your files, newest first.
| Query parameter | Description |
|---|---|
purpose | Only return files with this purpose. |
limit | Maximum number of files to return, from 1 to 10,000 (default 10,000). |
order | desc (default) or asc, by upload time. |
after | A file id: return the files after this one, for paging. |
Request:
curl "https://api.eugpt.ai/v1/files?purpose=assistants&limit=20" \
-H "Authorization: Bearer $EUGPT_API_KEY"
Response:
{
"object": "list",
"data": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"object": "file",
"bytes": 1048576,
"created_at": 1793577600,
"filename": "document.pdf",
"purpose": "assistants",
"status": "processed",
"expires_at": null,
"status_details": null
}
],
"first_id": "123e4567-e89b-12d3-a456-426614174000",
"last_id": "123e4567-e89b-12d3-a456-426614174000",
"has_more": false
}
To page, pass the last_id of a page as after for the next one, while has_more is true.
Retrieve file metadata#
GET /v1/files/{file_id}
Returns the file object; not the file content.
curl https://api.eugpt.ai/v1/files/123e4567-e89b-12d3-a456-426614174000 \
-H "Authorization: Bearer $EUGPT_API_KEY"
Download file content#
GET /v1/files/{file_id}/content
Returns the file’s bytes, with the file’s own Content-Type (for example application/pdf) and a Content-Disposition header with the file name.
curl https://api.eugpt.ai/v1/files/123e4567-e89b-12d3-a456-426614174000/content \
-H "Authorization: Bearer $EUGPT_API_KEY" \
-o document.pdf
Download a generated file#
GET /v1/files/generated/{key}
Files that tools create, such as a PDF report, are not in the file list. The response names them in generated_files (or a response.file.generated event) with a key; this endpoint turns that key into a short-lived download link.
curl https://api.eugpt.ai/v1/files/generated/8f14e45f-ceea-467a-a4ed-a9e9a5cb16ee/q3-report.pdf \
-H "Authorization: Bearer $EUGPT_API_KEY"
Response:
{
"url": "https://…",
"filename": "q3-report.pdf"
}
The url works for 60 seconds and needs no API key. Download the file right away.
Delete a file#
DELETE /v1/files/{file_id}
Permanently deletes a file.
curl -X DELETE https://api.eugpt.ai/v1/files/123e4567-e89b-12d3-a456-426614174000 \
-H "Authorization: Bearer $EUGPT_API_KEY"
Response:
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"object": "file",
"deleted": true
}