Skip to main content
POST
Create an Environment

Headers

kimi-api-version
enum<string>

API version for this request, in YYYY-MM-DD form. Send 2026-09-01-beta for the version documented here. Required outside /v1/files*: a missing header there is rejected with 400 invalid_request_error; on /v1/files* its absence selects the compatibility behavior. An unknown value is rejected with 400 invalid_request_error on every endpoint. API versions served by the platform. New dated versions are added as they ship; a version is removed after its announced Sunset date.

Available options:
2026-09-01-beta
Idempotency-Key
string

Optional idempotency key. Reusing the same key with the same request target, API version, and body replays the first response for 24 hours. Reusing it with a different target, API version, or body, or while the first request is still being processed, returns 409.

Body

application/json

Definition and initial execution settings for the new Environment.

Request body for creating an Environment.

name
string
required

Human-readable environment name. Not required to be unique.

Required string length: 1 - 256
Example:

"Data analysis"

config
Cloud environment · object
required

Configuration for a cloud Environment: outbound networking, packages, and a setup script.

Example:
description
string

Optional human-readable description.

Maximum string length: 2048
Example:

"Environment for data analysis tasks"

metadata
object

Caller-defined metadata with up to 16 entries.

Example:

Response

The new Environment. Its first version is building when the build pipeline is on.

A persisted execution environment that hosts agent sessions.

id
string
required

Environment ID.

Example:

"env_01h455vb4pex5vsknk084sn02q"

name
string
required

Human-readable environment name.

Example:

"Data analysis"

config
Cloud environment · object
required

Configuration for a cloud Environment: outbound networking, packages, and a setup script.

Example:
created_at
string<date-time>
required

Time when the Environment was created.

Example:

"2026-08-26T12:00:00Z"

updated_at
string<date-time>
required

Time when the Environment was last updated.

Example:

"2026-08-26T12:00:00Z"

scope
enum<string>
required

Visibility scope.

Available options:
official,
org,
project,
user
Example:

"project"

description
string

Optional human-readable description.

Example:

"Environment for data analysis tasks"

metadata
object

Caller-defined metadata with up to 16 entries.

Example:
build_status
enum<string>

Build state of the latest Environment version.

Available options:
building,
ready,
failed
Example:

"building"

archived_at
string<date-time>

Archive timestamp. Absent while active. Archived environments are read-only: no new sessions, existing sessions unaffected, no unarchive.

Example:

"2026-08-27T12:00:00Z"