Follow Discord
Sweep 22 Oct 2026 · 21:04Z Build v2.1.309 528 read Stable v2.1.308 Latest v2.1.309 Next v2.1.309 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

Work changedapi/beta/environments/work

Nearest release: v2.1.245, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+87added
Lines−96removed
From line 1 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits18to this page, all time

### Path parameters ### Headers #### Response (200) ### Path parameters ### Query parameters ### Headers #### Response (200) ### Path parameters ### Headers #### Response (200) ### Path parameters ### Query parameters ### Headers #### Response (200) ### Path parameters ### Headers ### Body parameters #### Response (200) ### Path parameters ### Query parameters ### Headers #### Response (200) ### Path parameters ### Headers ### Body parameters #### Response (200) ### Path parameters ### Headers #### Response (200) ## Domain types ### Path Parameters ### Header Parameters #### Response ### Path Parameters ### Query Parameters ### Header Parameters #### Response ### Path Parameters ### Header Parameters #### Response ### Path Parameters ### Query Parameters ### Header Parameters #### Response ### Path Parameters ### Header Parameters ### Body Parameters #### Response ### Path Parameters ### Query Parameters ### Header Parameters #### Response ### Path Parameters ### Header Parameters ### Body Parameters #### Response ### Path Parameters ### Header Parameters #### Response ## Domain Types

The whole hunk

from line 1, old and new numbered
/
lines
from line 1
1---
2title: Work
3url: https://platform.claude.com/docs/en/api/beta/environments/work
4---
5 
61# Work
72 
83## Get Work Item
94 
10**get** `/v1/environments/{environment_id}/work/{work_id}`
5**GET** `/v1/environments/{environment_id}/work/{work_id}`
116 
127Note: 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.
138 
149Retrieve detailed information about a specific work item.
1510 
16### Path Parameters
11### Path parameters
1712 
1813- `environment_id: string`
1914 
2015- `work_id: string`
2116 
22### Header Parameters
17### Headers
2318 
2419- `"anthropic-beta": optional array of AnthropicBeta`
2520 
from line 94
9994 
10095### Returns
10196 
102- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
97- `BetaSelfHostedWork object`
10398 
10499 Work resource representing a unit of work in a self-hosted environment.
105100 
from line 126
131126 
132127 Type of work data
133128 
134 - `"session"`
135 
136129 - `environment_id: string`
137130 
138131 Environment identifier this work belongs to (e.g., `env_...`)
from line 172
179172 
180173 The type of object (always 'work')
181174 
182 - `"work"`
175 default: work
183176 
184177### Example
185178 
186```http
179```bash
187180curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID \
188181 -H 'anthropic-version: 2023-06-01' \
189182 -H 'anthropic-beta: managed-agents-2026-04-01' \
from line 183
190183 -H "X-Api-Key: $ANTHROPIC_API_KEY"
191184```
192185 
193#### Response
186#### Response (200)
194187 
195188```json
196189{
from line 210
217210 
218211## Poll for Work
219212 
220**get** `/v1/environments/{environment_id}/work/poll`
213**GET** `/v1/environments/{environment_id}/work/poll`
221214 
222215Note: 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.
223216 
224217Long poll for work items in the queue.
225218 
226### Path Parameters
219### Path parameters
227220 
228221- `environment_id: string`
229222 
230### Query Parameters
223### Query parameters
231224 
232225- `block_ms: optional number`
233226 
234227 How long to wait for work to arrive before returning. Must be 1-999 in milliseconds. Defaults to non-blocking (returns immediately if no work is available).
235228 
229 minimum: 1
230 
236231- `reclaim_older_than_ms: optional number`
237232 
238233 Reclaim unacknowledged work items older than this many milliseconds. If omitted, uses the default (5000ms).
239234 
240### Header Parameters
235 minimum: 1
241236 
237### Headers
238 
242239- `"anthropic-beta": optional array of AnthropicBeta`
243240 
244241 Optional header to specify the beta version(s) you want to use.
from line 318
321318 
322319### Returns
323320 
324- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
321- `BetaSelfHostedWork object`
325322 
326323 Work resource representing a unit of work in a self-hosted environment.
327324 
from line 350
353350 
354351 Type of work data
355352 
356 - `"session"`
357 
358353 - `environment_id: string`
359354 
360355 Environment identifier this work belongs to (e.g., `env_...`)
from line 396
401396 
402397 The type of object (always 'work')
403398 
404 - `"work"`
399 default: work
405400 
406401### Example
407402 
408```http
403```bash
409404curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/poll \
410405 -H 'anthropic-version: 2023-06-01' \
411406 -H 'anthropic-beta: managed-agents-2026-04-01' \
from line 407
412407 -H "X-Api-Key: $ANTHROPIC_API_KEY"
413408```
414409 
415#### Response
410#### Response (200)
416411 
417412```json
418413{
from line 434
439434 
440435## Acknowledge Work
441436 
442**post** `/v1/environments/{environment_id}/work/{work_id}/ack`
437**POST** `/v1/environments/{environment_id}/work/{work_id}/ack`
443438 
444439Note: 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.
445440 
446441Acknowledge receipt of a work item, transitioning it from 'queued' to 'starting' and removing it from the queue.
447442 
448### Path Parameters
443### Path parameters
449444 
450445- `environment_id: string`
451446 
452447- `work_id: string`
453448 
454### Header Parameters
449### Headers
455450 
456451- `"anthropic-beta": optional array of AnthropicBeta`
457452 
from line 526
531526 
532527### Returns
533528 
534- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
529- `BetaSelfHostedWork object`
535530 
536531 Work resource representing a unit of work in a self-hosted environment.
537532 
from line 558
563558 
564559 Type of work data
565560 
566 - `"session"`
567 
568561 - `environment_id: string`
569562 
570563 Environment identifier this work belongs to (e.g., `env_...`)
from line 604
611604 
612605 The type of object (always 'work')
613606 
614 - `"work"`
607 default: work
615608 
616609### Example
617610 
618```http
611```bash
619612curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID/ack \
620613 -X POST \
621614 -H 'anthropic-version: 2023-06-01' \
from line 616
623616 -H "X-Api-Key: $ANTHROPIC_API_KEY"
624617```
625618 
626#### Response
619#### Response (200)
627620 
628621```json
629622{
from line 643
650643 
651644## Record Heartbeat
652645 
653**post** `/v1/environments/{environment_id}/work/{work_id}/heartbeat`
646**POST** `/v1/environments/{environment_id}/work/{work_id}/heartbeat`
654647 
655648Note: 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.
656649 
657650Record a heartbeat for a work item to maintain the lease.
658651 
659### Path Parameters
652### Path parameters
660653 
661654- `environment_id: string`
662655 
663656- `work_id: string`
664657 
665### Query Parameters
658### Query parameters
666659 
667660- `desired_ttl_seconds: optional number`
668661 
from line 665
672665 
673666 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.
674667 
675### Header Parameters
668### Headers
676669 
677670- `"anthropic-beta": optional array of AnthropicBeta`
678671 
from line 745
752745 
753746### Returns
754747 
755- `BetaSelfHostedWorkHeartbeatResponse object { last_heartbeat, lease_extended, state, 2 more }`
748- `BetaSelfHostedWorkHeartbeatResponse object`
756749 
757750 Response after recording a heartbeat for a work item.
758751 
from line 779
786779 
787780 The type of response
788781 
789 - `"work_heartbeat"`
782 default: work_heartbeat
790783 
791784### Example
792785 
793```http
786```bash
794787curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID/heartbeat \
795788 -X POST \
796789 -H 'anthropic-version: 2023-06-01' \
from line 791
798791 -H "X-Api-Key: $ANTHROPIC_API_KEY"
799792```
800793 
801#### Response
794#### Response (200)
802795 
803796```json
804797{
from line 805
812805 
813806## Stop Work
814807 
815**post** `/v1/environments/{environment_id}/work/{work_id}/stop`
808**POST** `/v1/environments/{environment_id}/work/{work_id}/stop`
816809 
817810Note: 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.
818811 
819812Stop a work item, initiating graceful or forced shutdown.
820813 
821### Path Parameters
814### Path parameters
822815 
823816- `environment_id: string`
824817 
825818- `work_id: string`
826819 
827### Header Parameters
820### Headers
828821 
829822- `"anthropic-beta": optional array of AnthropicBeta`
830823 
from line 895
902895 
903896 - `"mid-conversation-tool-changes-2026-07-01"`
904897 
905### Body Parameters
898### Body parameters
906899 
907900- `force: optional boolean`
908901 
909902 If true, immediately stop work without graceful shutdown
910903 
904 default: false
905 
911906### Returns
912907 
913- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
908- `BetaSelfHostedWork object`
914909 
915910 Work resource representing a unit of work in a self-hosted environment.
916911 
from line 937
942937 
943938 Type of work data
944939 
945 - `"session"`
946 
947940 - `environment_id: string`
948941 
949942 Environment identifier this work belongs to (e.g., `env_...`)
from line 983
990983 
991984 The type of object (always 'work')
992985 
993 - `"work"`
986 default: work
994987 
995988### Example
996989 
997```http
990```bash
998991curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID/stop \
999992 -H 'Content-Type: application/json' \
1000993 -H 'anthropic-version: 2023-06-01' \
from line 996
1003996 -d '{}'
1004997```
1005998 
1006#### Response
999#### Response (200)
10071000 
10081001```json
10091002{
from line 1023
10301023 
10311024## List Work Items
10321025 
1033**get** `/v1/environments/{environment_id}/work`
1026**GET** `/v1/environments/{environment_id}/work`
10341027 
10351028Note: 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.
10361029 
10371030List work items in an environment.
10381031 
1039### Path Parameters
1032### Path parameters
10401033 
10411034- `environment_id: string`
10421035 
1043### Query Parameters
1036### Query parameters
10441037 
10451038- `limit: optional number`
10461039 
10471040 Maximum number of work items to return
10481041 
1042 default: 20, maximum: 1000, minimum: 1
1043 
10491044- `page: optional string`
10501045 
10511046 Opaque cursor from previous response for pagination
10521047 
1053### Header Parameters
1048### Headers
10541049 
10551050- `"anthropic-beta": optional array of AnthropicBeta`
10561051 
from line 1125
11301125 
11311126### Returns
11321127 
1133- `BetaSelfHostedWorkListResponse object { data, next_page }`
1128- `BetaSelfHostedWorkListResponse object`
11341129 
11351130 Response when listing work items with cursor-based pagination.
11361131 
from line 1157
11621157 
11631158 Type of work data
11641159 
1165 - `"session"`
1166 
11671160 - `environment_id: string`
11681161 
11691162 Environment identifier this work belongs to (e.g., `env_...`)
from line 1203
12101203 
12111204 The type of object (always 'work')
12121205 
1213 - `"work"`
1206 default: work
12141207 
12151208 - `next_page: string or null`
12161209 
from line 1211
12181211 
12191212### Example
12201213 
1221```http
1214```bash
12221215curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work \
12231216 -H 'anthropic-version: 2023-06-01' \
12241217 -H 'anthropic-beta: managed-agents-2026-04-01' \
from line 1218
12251218 -H "X-Api-Key: $ANTHROPIC_API_KEY"
12261219```
12271220 
1228#### Response
1221#### Response (200)
12291222 
12301223```json
12311224{
from line 1250
12571250 
12581251## Update Work Item
12591252 
1260**post** `/v1/environments/{environment_id}/work/{work_id}`
1253**POST** `/v1/environments/{environment_id}/work/{work_id}`
12611254 
12621255Note: 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.
12631256 
12641257Update work item metadata with merge semantics.
12651258 
1266### Path Parameters
1259### Path parameters
12671260 
12681261- `environment_id: string`
12691262 
12701263- `work_id: string`
12711264 
1272### Header Parameters
1265### Headers
12731266 
12741267- `"anthropic-beta": optional array of AnthropicBeta`
12751268 
from line 1340
13471340 
13481341 - `"mid-conversation-tool-changes-2026-07-01"`
13491342 
1350### Body Parameters
1343### Body parameters
13511344 
13521345- `metadata: map[string]`
13531346 
from line 1348
13551348 
13561349### Returns
13571350 
1358- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
1351- `BetaSelfHostedWork object`
13591352 
13601353 Work resource representing a unit of work in a self-hosted environment.
13611354 
from line 1380
13871380 
13881381 Type of work data
13891382 
1390 - `"session"`
1391 
13921383 - `environment_id: string`
13931384 
13941385 Environment identifier this work belongs to (e.g., `env_...`)
from line 1426
14351426 
14361427 The type of object (always 'work')
14371428 
1438 - `"work"`
1429 default: work
14391430 
14401431### Example
14411432 
1442```http
1433```bash
14431434curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID \
14441435 -H 'Content-Type: application/json' \
14451436 -H 'anthropic-version: 2023-06-01' \
from line 1443
14521443 }'
14531444```
14541445 
1455#### Response
1446#### Response (200)
14561447 
14571448```json
14581449{
from line 1470
14791470 
14801471## Get Queue Statistics
14811472 
1482**get** `/v1/environments/{environment_id}/work/stats`
1473**GET** `/v1/environments/{environment_id}/work/stats`
14831474 
14841475Get statistics about the work queue for an environment.
14851476 
1486### Path Parameters
1477### Path parameters
14871478 
14881479- `environment_id: string`
14891480 
1490### Header Parameters
1481### Headers
14911482 
14921483- `"anthropic-beta": optional array of AnthropicBeta`
14931484 
from line 1558
15671558 
15681559### Returns
15691560 
1570- `BetaSelfHostedWorkQueueStats object { depth, oldest_queued_at, pending, 2 more }`
1561- `BetaSelfHostedWorkQueueStats object`
15711562 
15721563 Statistics about the work queue for an environment.
15731564 
from line 1576
15851576 
15861577 Number of work items being processed (polled but not acknowledged)
15871578 
1579 default: 0
1580 
15881581 - `type: "work_queue_stats"`
15891582 
15901583 The type of object
15911584 
1592 - `"work_queue_stats"`
1585 default: work_queue_stats
15931586 
15941587 - `workers_polling: number or null`
15951588 
from line 1590
15971590 
15981591### Example
15991592 
1600```http
1593```bash
16011594curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/stats \
16021595 -H 'anthropic-version: 2023-06-01' \
16031596 -H 'anthropic-beta: managed-agents-2026-04-01' \
from line 1597
16041597 -H "X-Api-Key: $ANTHROPIC_API_KEY"
16051598```
16061599 
1607#### Response
1600#### Response (200)
16081601 
16091602```json
16101603{
from line 1609
16161609}
16171610```
16181611 
1619## Domain Types
1612## Domain types
16201613 
16211614### Beta Self Hosted Work
16221615 
1623- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
1616- `BetaSelfHostedWork object`
16241617 
16251618 Work resource representing a unit of work in a self-hosted environment.
16261619 
from line 1645
16521645 
16531646 Type of work data
16541647 
1655 - `"session"`
1656 
16571648 - `environment_id: string`
16581649 
16591650 Environment identifier this work belongs to (e.g., `env_...`)
from line 1691
17001691 
17011692 The type of object (always 'work')
17021693 
1703 - `"work"`
1694 default: work
17041695 
17051696### Beta Self Hosted Work Heartbeat Response
17061697 
1707- `BetaSelfHostedWorkHeartbeatResponse object { last_heartbeat, lease_extended, state, 2 more }`
1698- `BetaSelfHostedWorkHeartbeatResponse object`
17081699 
17091700 Response after recording a heartbeat for a work item.
17101701 
from line 1729
17381729 
17391730 The type of response
17401731 
1741 - `"work_heartbeat"`
1732 default: work_heartbeat
17421733 
17431734### Beta Self Hosted Work List Response
17441735 
1745- `BetaSelfHostedWorkListResponse object { data, next_page }`
1736- `BetaSelfHostedWorkListResponse object`
17461737 
17471738 Response when listing work items with cursor-based pagination.
17481739 
from line 1765
17741765 
17751766 Type of work data
17761767 
1777 - `"session"`
1778 
17791768 - `environment_id: string`
17801769 
17811770 Environment identifier this work belongs to (e.g., `env_...`)
from line 1811
18221811 
18231812 The type of object (always 'work')
18241813 
1825 - `"work"`
1814 default: work
18261815 
18271816 - `next_page: string or null`
18281817 
from line 1819
18301819 
18311820### Beta Self Hosted Work Queue Stats
18321821 
1833- `BetaSelfHostedWorkQueueStats object { depth, oldest_queued_at, pending, 2 more }`
1822- `BetaSelfHostedWorkQueueStats object`
18341823 
18351824 Statistics about the work queue for an environment.
18361825 
from line 1837
18481837 
18491838 Number of work items being processed (polled but not acknowledged)
18501839 
1840 default: 0
1841 
18511842 - `type: "work_queue_stats"`
18521843 
18531844 The type of object
18541845 
1855 - `"work_queue_stats"`
1846 default: work_queue_stats
18561847 
18571848 - `workers_polling: number or null`
18581849 
from line 1851
18601851 
18611852### Beta Self Hosted Work Stop Request
18621853 
1863- `BetaSelfHostedWorkStopRequest object { force }`
1854- `BetaSelfHostedWorkStopRequest object`
18641855 
18651856 Request to stop a work item.
18661857 
from line 1859
18681859 
18691860 If true, immediately stop work without graceful shutdown
18701861 
1862 default: false
1863 
18711864### Beta Self Hosted Work Update Request
18721865 
1873- `BetaSelfHostedWorkUpdateRequest object { metadata }`
1866- `BetaSelfHostedWorkUpdateRequest object`
18741867 
18751868 Request to update work item metadata.
18761869 
from line 1873
18801873 
18811874### Beta Session Work Data
18821875 
1883- `BetaSessionWorkData object { id, type }`
1876- `BetaSessionWorkData object`
18841877 
18851878 Work data for session work items.
18861879 
from line 1887
18941887 - `type: "session"`
18951888 
18961889 Type of work data
1897 
1898 - `"session"`
18991890 
Feedback