Skip to main content
POST
Create a Session

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

Agent and Environment for the new Session, plus any resource bindings.

Request body for creating a Session. Only agent_id and environment_id are required.

agent_id
string
required

Agent to run in the new Session.

Example:

"agent_01h455vb4pex5vsknk084sn02q"

environment_id
string
required

Environment for the Session. Its newest build-ready version is pinned for the Session's lifetime. The Environment must be visible and active with a build-ready version. Self-hosted environments support agent_toolset_20260901 (including its deprecated alias default_toolset_20260901) and agent_toolset_20261101. An incompatible effective coordinator or child toolset is rejected before creation with 400 invalid_parameter_error and param=environment_id.

Maximum string length: 128
Example:

"env_01h455vb4pex5vsknk084sn02q"

agent_version
string

Optional Agent version to run ("1", "2", …). If omitted, the latest version available at creation is used.

Maximum string length: 128
Example:

"1"

title
string

Optional human-readable title.

Maximum string length: 256
Example:

"Example Session"

metadata
object

Caller-defined metadata with up to 16 entries.

Example:
resources
(File · object | Vault · object | Memory Store · object | GitHub repository · object)[]

Files, Vaults, Memory Stores, and GitHub repositories to make available when the Session is created. A Session can include at most 16 Vaults and 8 Memory Stores. Repository bindings and their checkout settings are fixed at creation.

An uploaded file available to a Session.

Example:
agent_overrides
object

Session-local agent configuration overrides applied from creation.

Example:

Response

The created Session (idle), with its resource bindings and Agent snapshot.

A Session running an immutable Agent version.

id
string
required

Session ID.

Example:

"sesn_01h455vb4pex5vsknk084sn02q"

agent_id
string
required

Agent this session is running.

Example:

"agent_01h455vb4pex5vsknk084sn02q"

environment_id
string
required

Environment hosting this session.

Example:

"env_01h455vb4pex5vsknk084sn02q"

status
enum<string>
required

Current lifecycle status.

Available options:
idle,
running,
stopping,
terminated
Example:

"idle"

created_at
string<date-time>
required

Creation timestamp.

Example:

"2026-01-01T00:00:00Z"

updated_at
string<date-time>
required

Last-update timestamp.

Example:

"2026-01-01T00:00:00Z"

interrupted
boolean

Whether a committed stop pauses execution. A new message or explicit continue can resume it.

Example:

false

control_epoch
string

Current Session control generation.

Maximum string length: 19
Pattern: ^(0|[1-9][0-9]{0,18})$
Example:

"1"

continue_pending
boolean

A continue was accepted but execution has not started yet.

Example:

false

title
string

Human-readable title.

Example:

"Example Session"

metadata
object

Caller-defined metadata with up to 16 entries.

Example:
agent_overrides
object

Session-local agent configuration overrides. Absent when none are stored.

Example:
archived_at
string<date-time>

Archive timestamp. Absent while active.

Example:

"2026-01-03T00:00:00Z"

resources
(File · object | Vault · object | Memory Store · object | GitHub repository · object)[]

Resources bound to this session. Omitted from GET /v1/sessions list items.

An uploaded file available to a Session.

Example:
agent
object

Agent version snapshot used by the coordinator thread.

Example:
resolved_skills
object[]

Effective Skills after applying Session overrides and merging roster and shared workspace Skills. Present only when Get Session explicitly uses include=resolved_skills. An explicitly requested empty set is []. Otherwise this field is omitted, including from Session list items. Entries are sorted by name.

Example:
usage
object

Cumulative token usage of this Session across all Threads. Grows in real time as model calls complete. Also returned in list items, filled with one batch aggregate query per page.

Example: