Skip to main content
POST
Send a WorkItem heartbeat

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

Path Parameters

environment_id
string
required

Environment the item belongs to.

id
string
required

WorkItem ID.

Body

application/json

Worker identity and current fencing token for renewing the lease.

Request body of POST /v1/environments/{environment_id}/work/{id}/heartbeat.

worker_id
string
required

Worker holding the lease.

Minimum string length: 1
Example:

"worker-1"

generation
integer<int64>
required

Fencing token the claim returned.

Required range: x >= 1
Example:

1

Response

The item's lease state after renewal.

Lease state of a WorkItem after a successful heartbeat.

last_heartbeat
string<date-time>
required

When the lease was last renewed.

Example:

"2026-09-20T12:05:00Z"

lease_extended
boolean
required

Whether the heartbeat extended the lease (always true on success; failures are 412).

Example:

true

state
enum<string>
required

Lifecycle state after the update.

Available options:
queued,
starting,
active,
stopping,
completed,
failed,
cancelled
Example:

"active"

ttl_seconds
integer<int64>
required

Effective lease TTL in seconds, applied from the heartbeat time.

Example:

300

generation
integer<int64>
required

Current fencing token of the item, returned with heartbeat state.

Example:

2