# Create image in project

`POST /v1/projects/{project}/images`, operation `environments.CreateImageInProject`

Creates an image, which kosem prepares so that the environments that run it start and read its files faster.

The image is checked as its organization's or project's environments would pull it, and refused as CheckImage refuses one. Its size counts against the organization's quota.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `project` | path | Yes | `string` | The project's ID. |

## Request body

Content-Type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `availability` | `Availability` | No | For an organization's image: the projects whose environments use it. None, unless set. Setting it also takes environments.images.setAvailability. |
| `availability.allProjects` | `boolean` | Yes | Every project, including those created later. |
| `availability.projects` | `string[]` | Yes | Projects, projects/{project_id}, when not all of them; at most 500. Past that, make the resource available to every project. |
| `displayName` | `string` | Yes | What people call the image. |
| `followTag` | `boolean` | No | Whether kosem resolves its tag again every hour; true unless set. |
| `keepVersions` | `integer (int32)` | No | How many of its newest versions it keeps, from 1 to 10; 3 unless set. |
| `source` | `string` | Yes | The image's reference, with a tag or a digest, such as ghcr.io/acme/devbox:2026.10. Unique in its organization or project. |

## Responses

### 201

Created

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `availability` | `Availability` | Yes | For an organization's image: the projects whose environments use it. A project's image is available to none. |
| `availability.allProjects` | `boolean` | Yes | Every project, including those created later. |
| `availability.projects` | `string[]` | Yes | Projects, projects/{project_id}, when not all of them; at most 500. Past that, make the resource available to every project. |
| `checkTime` | `string (date-time)` | No | When kosem last resolved its source; unset until it has. |
| `createTime` | `string (date-time)` | Yes | When the image was created. |
| `displayName` | `string` | Yes | What people call the image. |
| `followTag` | `boolean` | Yes | Whether kosem resolves its tag again every hour, as RefreshImage does, so that it prepares each new version. A source named by a digest never moves. |
| `keepVersions` | `integer (int32)` | Yes | How many of its newest versions it keeps. An older one is deleted once no environment runs it. |
| `name` | `string` | Yes | Resource name, organizations/{organization_id}/images/{image_id} or projects/{project_id}/images/{image_id}. |
| `refreshReason` | `string` | Yes | Why kosem's last check of its tag couldn't refresh it, which leaves it as it was; empty once a check can. |
| `registry` | `string` | No | The registry that kosem signs in with to pull it, when it's private. |
| `source` | `string` | Yes | The image's reference, with a tag or a digest, in its shortest spelling, such as node:24 for docker.io/library/node:24. Set when the image is created, and never changed. |
| `state` | `string` | Yes | PREPARING until its latest version is ready to run, READY once it is, and FAILED if kosem can't prepare it. Values: `PREPARING`, `READY`, `FAILED`. |
| `stateReason` | `string` | Yes | Why kosem can't prepare it, when it can't. |
| `updateTime` | `string (date-time)` | Yes | When the image last changed. |
| `versions` | `ImageVersion[]` | Yes | What its source named each time it was resolved, newest first. |

### default

Error

Base URL: `https://api.kosem.ai`. See [API conventions](https://docs.kosem.ai/reference/api-conventions.md) for authentication, pagination and errors, and [https://docs.kosem.ai/openapi.yaml](https://docs.kosem.ai/openapi.yaml) for the full OpenAPI document.