---
title: "Create container file"
method: POST
path: "/containers/{container_id}/files"
---

# Create container file

`POST /containers/{container_id}/files`

## Request

- Base URL: `https://api.openai.com/v1`
- URL: `https://api.openai.com/v1/containers/{container_id}/files`
- Auth: HTTP bearer

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.

## Path parameters

- `container_id` string, required

## Request body

- CreateContainerFileBody
  - `file_id` string: Name of the file to create.
  - `file` string, binary: The File object (not file name) to be uploaded.

## Response `200`

Success

- ContainerFileResource
  - `id` string, required: Unique identifier for the file.
  - `object` string, required: The type of this object (`container.file`).
  - `container_id` string, required: The container this file belongs to.
  - `created_at` integer, required: Unix timestamp (in seconds) when the file was created.
  - `bytes` integer, required: Size of the file in bytes.
  - `path` string, required: Path of the file in the container.
  - `source` string, required: Source of the file (e.g., `user`, `assistant`).

## Other responses

- `400`: The file input is invalid, or the container file limit would be exceeded.
- `404`: The container was not found or has expired.
- `429`: The request was rejected because a rate limit was exceeded.

## Changes

- **2026-10-06** `487892d3954e`: 3 info
  - added the optional property `error/misalignment/review_target` to the response with the `400` status
  - added the optional property `error/misalignment/review_target` to the response with the `404` status
  - added the optional property `error/misalignment/review_target` to the response with the `429` status
- **2026-10-05** `7f654af7f94f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/omnistack-sh/apis/openai-api/changes/containers/:container_id/files/post.md)

---

[API](https://skmtc.dev/omnistack-sh/apis/openai-api.md) - [All operations](https://skmtc.dev/omnistack-sh/apis/openai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/omnistack-sh/apis/openai-api/revisions/0a26f104d35f?raw)
