Endpoints
Upload a file
POST /v1/files — multipart form body.
file
required
The document to upload. Supported formats: PDF, DOCX, PPTX, XLSX, CSV, TXT, MD, EPUB, SRT, and common image types.
string
default:"knowledge_base"
Accepts
knowledge_base (default) or assistants (OpenAI alias — treated identically). Use either value; both result in the file being added to your project’s knowledge base.status: "uploaded". The parse and embed pipeline runs asynchronously in the background.
Processing status
PollGET /v1/files/{id} until the file reaches a terminal status:
List files
GET /v1/files — returns a paginated list of files in your project.
integer
default:"20"
Number of files to return per page. Between 1 and 100.
string
Cursor for pagination — the file ID to start after (returns files created after the given ID).
string
Filter results by purpose (
knowledge_base or assistants).{ "object": "list", "data": [...] } with OpenAI file objects.
Retrieve a file
GET /v1/files/{id} — returns the full OpenAI file object for a single file, or 404 if it doesn’t exist in your project.
Delete a file
DELETE /v1/files/{id} — removes the file and all associated data, including any embeddings from the vector store. Returns:
Examples
- TypeScript SDK
- Python (openai SDK)
- curl