post /containers/{container_id}/files
Create a Container File
You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.
container_id: string
-
file: optional stringThe File object (not file name) to be uploaded.
-
file_id: optional stringName of the file to create.
-
id: stringUnique identifier for the file.
-
bytes: numberSize of the file in bytes.
-
container_id: stringThe container this file belongs to.
-
created_at: numberUnix timestamp (in seconds) when the file was created.
-
object: stringThe type of this object (
container.file). -
path: stringPath of the file in the container.
-
source: stringSource of the file (e.g.,
user,assistant).
curl https://api.openai.com/v1/containers/$CONTAINER_ID/files \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_API_KEY"{
"id": "id",
"bytes": 0,
"container_id": "container_id",
"created_at": 0,
"object": "object",
"path": "path",
"source": "source"
}curl https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-F file="@example.txt"{
"id": "cfile_682e0e8a43c88191a7978f477a09bdf5",
"object": "container.file",
"created_at": 1747848842,
"bytes": 880,
"container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04",
"path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json",
"source": "user"
}