Swagger Petstore - OpenAPI 3.0
POST/containers/{container_id}/files

Create a container file

Creates a container file by uploading raw file content or referencing an existing file object. Send either a multipart/form-data request with the raw file or a JSON request with a file_id. Returns the created file object with its unique identifier, size, and metadata.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 2 body fields
container_idstringrequired
The unique identifier of the container to add the file to.

File upload payload. Send either as multipart/form-data with raw file content or as JSON with a file ID reference.

file_idstringoptional
Name of the file to create.
filestringoptional
The File object (not file name) to be uploaded.

2 status codes
200Returns the created container file object including its unique identifier, size in bytes, creation timestamp, path, and source.
idstringrequired
Unique identifier for the file.
objectstringrequired
The type of this object (`container.file`).
container_idstringrequired
The container this file belongs to.
created_atintegerrequired
Unix timestamp (in seconds) when the file was created.
bytesintegerrequired
Size of the file in bytes.
pathstringrequired
Path of the file in the container.
sourcestringrequired
Source of the file (e.g., `user`, `assistant`).
429Returned when the request rate limit is exceeded.
errorobjectrequired

Error handling

A 429 is returned when the request rate limit is exceeded. Either file or file_id must be provided — a request omitting both is rejected. container_id must identify an existing container.