Upsert a file
Create or replace a file in the specified assistant. If a file with the given assistant_file_id already exists, it will be replaced with the new file. If it doesn't exist, a new file will be created with that identifier.
This operation is asynchronous. The file processing will occur in the background.
For guidance and examples, see Manage files.
Path parameters
The name of the assistant to upload files to.
The identifier of the file to be created or replaced. Must be 1-128 characters long and consist only of alphanumeric characters, hyphens (-), or underscores (_).
Query parameters
Optional flag to opt in to multimodal file processing (PDFs only). Can be either true or false. Default is false.
Headers
Required date-based version header
Response
File upload has been accepted for processing. The file will be created if it doesn't exist, or replaced if it already exists. The operation will complete asynchronously.
Example response
{
"id": "op-1234-abcd-5678",
"operation_type": "upload_file",
"file_id": "my-file-id-123",
"status": "Processing",
"created_on": "2025-10-01T12:30:00Z",
"completed_on": "2025-10-01T12:35:00Z",
"percent_complete": 42,
"error_message": "File processing failed: unsupported file format.",
"ingestion_units": 50
}