Sample - OpenAI API
POST/containers/{container_id}/files

Create a file in a container

Creates a file in the specified container from uploaded content or an existing file identifier. Supply either the raw file in a multipart request or file_id in a JSON request, depending on how you provide the source. The response identifies the stored file and its container path.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

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

Container file input provided as JSON or multipart form data; use either an existing file_id or uploaded file content.

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 with its identifier, container association, size, creation timestamp, and path.
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 was rejected because a rate limit was exceeded.
errorobjectrequired

Error handling

A 429 is returned when the request rate exceeds the allowed limit. Provide a valid container_id and supply either file as uploaded content or file_id as the source file identifier.