Containers API
OpenAI Containers API, the sandboxes of the Responses code interpreter (ADR 0123). Containers run at an OpenAI provider; the gateway keeps an ownership row per container, so routes, lists and Responses tools only reach the caller’s own.
GET /api/v1/admin/containers
Section titled “GET /api/v1/admin/containers”GET /api/v1/admin/containers · operation listContainersAdmin
Live ownership records with the last state the provider reported (owner, team, key, provider connection, name, status, source api or responses, last activity, expiry minutes, memory limit). No provider call. Requires containers and containers:read; team roles see their teams, key-owned containers only global roles.
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
after |
query | string | |
limit |
query | integer, default 100, min 1, max 100 |
|
order |
query | string, one of "asc", "desc", default "desc" |
|
name |
query | string, max length 256 |
Responses
| Status | Description | Body |
|---|---|---|
200 |
Containers and has_more | — |
400 |
Invalid input | — |
404 |
Feature disabled | — |
DELETE /api/v1/admin/containers/{id}
Section titled “DELETE /api/v1/admin/containers/{id}”DELETE /api/v1/admin/containers/{id} · operation deleteContainerAdmin
Deletes the container at its provider and retires it. Requires containers:manage (admin, or team_admin of the container team).
Authentication: adminSession
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required | |
X-CSRF-Token |
header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
container.deleted object from the provider | — |
404 |
Feature disabled or not visible | — |
List the caller’s containers
Section titled “List the caller’s containers”GET /v1/containers · operation listContainers
Pages the gateway’s ownership table, never the provider list (which holds every team’s containers): only containers of the key’s team (or teamless key) appear. Containers that may still change are refreshed from their provider; one the provider no longer has is shown once with status deleted and then leaves the list. A cursor from another owner yields an empty page. Unknown query parameters answer 400.
Authentication: bearerAuth
Parameters
| Name | In | Type | Description |
|---|---|---|---|
after |
query | string | |
limit |
query | integer, default 20, min 1, max 100 |
|
order |
query | string, one of "asc", "desc", default "desc" |
|
name |
query | string, max length 256 | Exact container name |
Responses
| Status | Description | Body |
|---|---|---|
200 |
list of container objects with first_id, last_id and has_more | — |
400 |
Invalid input | application/json: Error |
401 |
Missing or invalid bearer key | application/json: Error |
404 |
Feature disabled | application/json: Error |
Create a container
Section titled “Create a container”POST /v1/containers · operation createContainer
Requires containers (with openai_responses and storage) and route:responses. The container is created at an OpenAI provider: the first OpenAI target of the alias named in model (a gateway field, removed before the call), or, without model, the only OpenAI provider the key reaches through its Responses aliases (422 model_required when there are several). file_ids are gateway files (/v1/files) of the key’s team, which the gateway uploads into the new container; a provider file ID answers 404. skills must be inline; a skill_reference is refused. The container is owned by the key’s team, or by the key when it has no team; if a file cannot be copied or the ownership cannot be recorded, the provider container is deleted (ADR 0123).
Authentication: bearerAuth
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-Request-Id |
header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |
traceparent |
header | string | W3C trace context. Invalid values create a new trace. |
Request body (required)
application/json: objectname(string, required, min length 1)model(string) — Gateway field: the alias whose provider holds the container; required when the key reaches several OpenAI providersfile_ids(array of string, max items 20) — Gateway file IDs of the key’s team, copied into the containerexpires_after(object)anchor(string, one of"last_active_at")minutes(integer)
memory_limit(string, one of"1g","4g","16g","64g")network_policy(object)skills(array of object) — Inline skills only
Responses
| Status | Description | Body |
|---|---|---|
200 |
container object, as the provider returned it | — |
400 |
Invalid input | application/json: Error |
401 |
Missing or invalid bearer key | application/json: Error |
403 |
Model not allowed | application/json: Error |
404 |
containers disabled, unknown model, or a file not of the key’s team | — |
415 |
application/json required | — |
422 |
No OpenAI provider for this key or alias, or model_required | — |
502 |
Provider unavailable | application/json: Error |
503 |
Container storage unavailable (the provider container is deleted) | — |
Retrieve a container
Section titled “Retrieve a container”GET /v1/containers/{id} · operation getContainer
Requires containers and route:responses. A container of another owner, an unknown ID or a malformed one answers 404 without calling the provider. A provider 404 retires the container from the gateway.
Authentication: bearerAuth
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container ID (cntr_…) owned by the caller’s team |
Responses
| Status | Description | Body |
|---|---|---|
200 |
container object | — |
401 |
Missing or invalid bearer key | application/json: Error |
404 |
Unknown container for this team, or containers disabled | — |
Delete a container
Section titled “Delete a container”DELETE /v1/containers/{id} · operation deleteContainer
Authentication: bearerAuth
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container ID (cntr_…) owned by the caller’s team |
Responses
| Status | Description | Body |
|---|---|---|
200 |
container.deleted object from the provider | — |
401 |
Missing or invalid bearer key | application/json: Error |
404 |
Unknown container for this team, or containers disabled | — |
List the files of a container
Section titled “List the files of a container”GET /v1/containers/{id}/files · operation listContainerFiles
Authentication: bearerAuth
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container ID (cntr_…) owned by the caller’s team |
after |
query | string | |
limit |
query | integer, min 1, max 100 | |
order |
query | string, one of "asc", "desc" |
Responses
| Status | Description | Body |
|---|---|---|
200 |
list of container.file objects from the provider | — |
400 |
Invalid input | application/json: Error |
401 |
Missing or invalid bearer key | application/json: Error |
404 |
Unknown container for this team, or containers disabled | — |
Add a file to a container
Section titled “Add a file to a container”POST /v1/containers/{id}/files · operation createContainerFile
multipart/form-data with exactly one file part (up to 50 MiB through the gateway), re-encoded before the call; or JSON {file_id} naming a gateway file of the key’s team, whose content the gateway uploads. A provider file ID is refused with 404.
Authentication: bearerAuth
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container ID (cntr_…) owned by the caller’s team |
Request body (required)
multipart/form-data: objectfile(string (binary), required)
application/json: objectfile_id(string, required)
Responses
| Status | Description | Body |
|---|---|---|
200 |
container.file object | — |
400 |
Invalid input | application/json: Error |
401 |
Missing or invalid bearer key | application/json: Error |
404 |
Unknown container or gateway file for this team | — |
413 |
File larger than 50 MiB | — |
415 |
multipart/form-data or application/json required | — |
Retrieve a container file
Section titled “Retrieve a container file”GET /v1/containers/{id}/files/{file_id} · operation getContainerFile
Authentication: bearerAuth
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container ID (cntr_…) owned by the caller’s team |
file_id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container file ID (cfile_…) |
Responses
| Status | Description | Body |
|---|---|---|
200 |
container.file object | — |
401 |
Missing or invalid bearer key | application/json: Error |
404 |
Unknown container or file | — |
Delete a container file
Section titled “Delete a container file”DELETE /v1/containers/{id}/files/{file_id} · operation deleteContainerFile
Authentication: bearerAuth
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container ID (cntr_…) owned by the caller’s team |
file_id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container file ID (cfile_…) |
Responses
| Status | Description | Body |
|---|---|---|
200 |
container.file.deleted object | — |
401 |
Missing or invalid bearer key | application/json: Error |
404 |
Unknown container or file | — |
Download a container file
Section titled “Download a container file”GET /v1/containers/{id}/files/{file_id}/content · operation getContainerFileContent
Streams the provider’s bytes with its Content-Type and Content-Disposition, for files the code interpreter wrote (container_file_citation) or that were uploaded.
Authentication: bearerAuth
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container ID (cntr_…) owned by the caller’s team |
file_id |
path | string, required, pattern ^[A-Za-z0-9_-]{1,128}$ |
Provider container file ID (cfile_…) |
Responses
| Status | Description | Body |
|---|---|---|
200 |
File content | application/octet-stream: string (binary) |
401 |
Missing or invalid bearer key | application/json: Error |
404 |
Unknown container or file | — |