v49

latestOpenAPI 3.1.0raw.githubusercontent.com2026-07-261319281.7 MB

Record Heartbeat

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Record a heartbeat for a work item to maintain the lease.

post/v1/environments/{environment_id}/work/{work_id}/heartbeat?beta=true

Path parameters

environment_idstring required
work_idstring required

Query parameters

desired_ttl_secondsinteger nullable

Desired TTL in seconds

Desired TTL in seconds

expected_last_heartbeatstring nullable

Expected last_heartbeat for conditional update (optimistic concurrency). Use literal 'NO_HEARTBEAT' to claim an unclaimed lease (first heartbeat). For subsequent heartbeats, echo the server's previous last_heartbeat value exactly. Returns 412 Precondition Failed if the actual value doesn't match.

Expected last_heartbeat for conditional update (optimistic concurrency). Use literal 'NO_HEARTBEAT' to claim an unclaimed lease (first heartbeat). For subsequent heartbeats, echo the server's previous last_heartbeat value exactly. Returns 412 Precondition Failed if the actual value doesn't match.

Headers

anthropic-betastring

Optional header to specify the beta version(s) you want to use.

To use multiple betas, use a comma separated list like beta1,beta2 or specify the header multiple times for each beta.

Optional header to specify the beta version(s) you want to use.

To use multiple betas, use a comma separated list like beta1,beta2 or specify the header multiple times for each beta.

anthropic-versionstring

The version of the Claude API you want to use.

Read more about versioning and our version history here.

The version of the Claude API you want to use.

Read more about versioning and our version history here.

authorizationstring nullable

Response

Successful Response

last_heartbeatstring required

RFC 3339 timestamp of the actual heartbeat from DB

lease_extendedboolean required

Whether the heartbeat succeeded in extending the lease

state'queued' | 'starting' | 'active' | 'stopping' | 'stopped' required

Current state of the work item (active/stopping/stopped)

ttl_secondsinteger required

Effective TTL applied to the lease

type'work_heartbeat' required

The type of response