apicheats.dev anthropic/llms.txt Raw .md
POST

POST /v1/environments/{environment_id}/work/{work_id}/heartbeat?beta=true — Claude API

Beta

Anthropic API key (required); https://api.anthropic.com

Claude API

Record Heartbeat

Base URL
https://api.anthropic.com
Auth
x-api-key: <ANTHROPIC_API_KEY>
Last verified
2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 219 tokens · Vary: Accept

Critical gotchas

Authentication uses the x-api-key header and requests also require an anthropic-version header.

The official OpenAPI URL is discovered from the SDK repository manifest and must remain under Anthropic's trusted Stainless storage prefix.

cURL

curl -X POST 'https://api.anthropic.com/v1/environments/environment-id/work/work-id/heartbeat?beta=true&desired_ttl_seconds=10&expected_last_heartbeat=example-expected-last-heartbeat' \  -H "x-api-key: $ANTHROPIC_API_KEY" \  -H 'anthropic-version: 2023-06-01'

Parameters

Name In Type Required Description
environment_id path string Yes path parameter environment_id.
work_id path string Yes path parameter work_id.
desired_ttl_seconds query integer No Desired TTL in seconds
expected_last_heartbeat query string No 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.

Response 200 OK

{
  "last_heartbeat": "string",
  "lease_extended": true,
  "state": "queued",
  "ttl_seconds": 0,
  "type": "work_heartbeat"
}
Get a free Claude API key → sponsored

Affiliate link - we may earn a commission, at no extra cost to you.