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

Environments changedapi/beta/environments

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+245added
Lines−607removed
From line 1 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits17to this page, all time

### Headers ### Body parameters #### Response (200) ### Query parameters ### Headers #### Response (200) ### Path parameters ### Headers #### Response (200) ### Path parameters ### Headers ### Body parameters #### Response (200) ### Path parameters ### Headers #### Response (200) ### Path parameters ### Headers #### Response (200) ## Domain types ## Environments › Work ### Get Work Item #### Path parameters #### Headers #### Returns #### Example ##### Response (200) ### Poll for Work #### Path parameters #### Query parameters #### Headers #### Returns #### Example ##### Response (200) ### Acknowledge Work #### Path parameters #### Headers #### Returns #### Example ##### Response (200) ### Record Heartbeat #### Path parameters #### Query parameters #### Headers #### Returns #### Example ##### Response (200) ### Stop Work #### Path parameters #### Headers #### Body parameters #### Returns #### Example ##### Response (200) ### List Work Items #### Path parameters #### Query parameters #### Headers #### Returns #### Example ##### Response (200) ### Update Work Item #### Path parameters #### Headers #### Body parameters #### Returns #### Example ##### Response (200) ### Get Queue Statistics #### Path parameters #### Headers #### Returns #### Example ##### Response (200) ### Header Parameters ### Body Parameters #### Response ### Query Parameters ### Header Parameters #### Response ### Path Parameters ### Header Parameters #### Response ### Path Parameters ### Header Parameters ### Body Parameters #### Response ### Path Parameters ### Header Parameters #### Response ### Path Parameters ### Header Parameters #### Response ## Domain Types # Work ## Get Work Item ### Path Parameters ### Header Parameters #### Response ## Poll for Work ### Path Parameters ### Query Parameters ### Header Parameters #### Response ## Acknowledge Work ### Path Parameters ### Header Parameters #### Response ## Record Heartbeat ### Path Parameters ### Query Parameters ### Header Parameters #### Response ## Stop Work ### Path Parameters ### Header Parameters ### Body Parameters #### Response ## List Work Items ### Path Parameters ### Query Parameters ### Header Parameters #### Response ## Update Work Item ### Path Parameters ### Header Parameters ### Body Parameters #### Response ## Get Queue Statistics ### Path Parameters ### Header Parameters #### Response ## Domain Types ### Beta Self Hosted Work ### Beta Self Hosted Work Heartbeat Response ### Beta Self Hosted Work List Response ### Beta Self Hosted Work Queue Stats ### Beta Self Hosted Work Stop Request ### Beta Self Hosted Work Update Request ### Beta Session Work Data

The whole hunk

from line 1, old and new numbered
/
lines

The two sides of this change are more than 400 edits apart, too far apart to line up, so this is the differ's own diff of it and the words inside a line are not marked.

from line 1
1---
2title: Environments
3url: https://platform.claude.com/docs/en/api/beta/environments
4---
5 
61# Environments
72 
83## Create Environment
94 
10**post** `/v1/environments`
5**POST** `/v1/environments`
116 
127Create a new environment with the specified configuration.
138 
14### Header Parameters
9### Headers
1510 
1611- `"anthropic-beta": optional array of AnthropicBeta`
1712 
from line 84
8984 
9085 - `"mid-conversation-tool-changes-2026-07-01"`
9186 
92### Body Parameters
87### Body parameters
9388 
9489- `name: string`
9590 
9691 Human-readable name for the environment
9792 
93 maxLength: 256, minLength: 1
94 
9895- `config: optional BetaCloudConfigParams or BetaSelfHostedConfigParams or null`
9996 
10097 Environment configuration
10198 
102 - `BetaCloudConfigParams object { type, networking, packages }`
99 - `BetaCloudConfigParams object`
103100 
104101 Request params for `cloud` environment configuration.
105102 
from line 107
110107 
111108 Environment type
112109 
113 - `"cloud"`
114 
115110 - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams or null`
116111 
117112 Network configuration policy. Omit on update to preserve the existing value.
118113 
119 - `BetaUnrestrictedNetwork object { type }`
114 - `BetaUnrestrictedNetwork object`
120115 
121116 Unrestricted network access.
122117 
from line 119
124119 
125120 Network policy type
126121 
127 - `"unrestricted"`
128 
129 - `BetaLimitedNetworkParams object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }`
122 - `BetaLimitedNetworkParams object`
130123 
131124 Limited network request params.
132125 
from line 130
137130 
138131 Network policy type
139132 
140 - `"limited"`
141 
142133 - `allow_mcp_servers: optional boolean or null`
143134 
144135 Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.
from line 176
185176 
186177 Package configuration type
187178 
188 - `"packages"`
189 
190 - `BetaSelfHostedConfigParams object { type }`
179 default: packages
180 
181 - `BetaSelfHostedConfigParams object`
191182 
192183 Request params for `self_hosted` environment configuration.
193184 
from line 186
195186 
196187 Environment type
197188 
198 - `"self_hosted"`
199 
200189- `description: optional string or null`
201190 
202191 Optional description of the environment
203192 
193 maxLength: 1024
194 
204195- `metadata: optional map[string]`
205196 
206197 User-provided metadata key-value pairs
from line 206
215206 
216207### Returns
217208 
218- `BetaEnvironment object { id, archived_at, config, 7 more }`
209- `BetaEnvironment object`
219210 
220211 Unified Environment resource for both cloud and self-hosted environments.
221212 
from line 222
231222 
232223 Environment configuration (either Anthropic Cloud or self-hosted)
233224 
234 - `BetaCloudConfig object { networking, packages, type }`
225 - `BetaCloudConfig object`
235226 
236227 `cloud` environment configuration.
237228 
from line 230
239230 
240231 Network configuration policy.
241232 
242 - `BetaUnrestrictedNetwork object { type }`
233 - `BetaUnrestrictedNetwork object`
243234 
244235 Unrestricted network access.
245236 
from line 238
247238 
248239 Network policy type
249240 
250 - `"unrestricted"`
251 
252 - `BetaLimitedNetwork object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }`
241 - `BetaLimitedNetwork object`
253242 
254243 Limited network access.
255244 
from line 258
269258 
270259 Network policy type
271260 
272 - `"limited"`
273 
274261 - `packages: BetaPackages`
275262 
276263 Package manager configuration.
from line 290
303290 
304291 Package configuration type
305292 
306 - `"packages"`
293 default: packages
307294 
308295 - `type: "cloud"`
309296 
310297 Environment type
311298 
312 - `"cloud"`
313 
314 - `BetaSelfHostedConfig object { type }`
299 - `BetaSelfHostedConfig object`
315300 
316301 Configuration for self-hosted environments.
317302 
from line 304
319304 
320305 Environment type
321306 
322 - `"self_hosted"`
323 
324307 - `created_at: string`
325308 
326309 RFC 3339 timestamp when environment was created
from line 324
341324 
342325 The type of object (always 'environment')
343326 
344 - `"environment"`
327 default: environment
345328 
346329 - `updated_at: string`
347330 
from line 340
357340 
358341### Example
359342 
360```http
343```bash
361344curl https://api.anthropic.com/v1/environments \
362345 -H 'Content-Type: application/json' \
363346 -H 'anthropic-version: 2023-06-01' \
from line 368
385368 }'
386369```
387370 
388#### Response
371#### Response (200)
389372 
390373```json
391374{
from line 419
436419 
437420## List Environments
438421 
439**get** `/v1/environments`
422**GET** `/v1/environments`
440423 
441424List environments with pagination support.
442425 
443### Query Parameters
426### Query parameters
444427 
445428- `include_archived: optional boolean`
446429 
447430 Include archived environments in the response
448431 
432 default: false
433 
449434- `limit: optional number`
450435 
451436 Maximum number of environments to return
452437 
438 default: 20, maximum: 1000, minimum: 1
439 
453440- `page: optional string`
454441 
455442 Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response.
456443 
457### Header Parameters
444### Headers
458445 
459446- `"anthropic-beta": optional array of AnthropicBeta`
460447 
from line 537
550537 
551538 Environment configuration (either Anthropic Cloud or self-hosted)
552539 
553 - `BetaCloudConfig object { networking, packages, type }`
540 - `BetaCloudConfig object`
554541 
555542 `cloud` environment configuration.
556543 
from line 545
558545 
559546 Network configuration policy.
560547 
561 - `BetaUnrestrictedNetwork object { type }`
548 - `BetaUnrestrictedNetwork object`
562549 
563550 Unrestricted network access.
564551 
from line 553
566553 
567554 Network policy type
568555 
569 - `"unrestricted"`
570 
571 - `BetaLimitedNetwork object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }`
556 - `BetaLimitedNetwork object`
572557 
573558 Limited network access.
574559 
from line 573
588573 
589574 Network policy type
590575 
591 - `"limited"`
592 
593576 - `packages: BetaPackages`
594577 
595578 Package manager configuration.
from line 605
622605 
623606 Package configuration type
624607 
625 - `"packages"`
608 default: packages
626609 
627610 - `type: "cloud"`
628611 
629612 Environment type
630613 
631 - `"cloud"`
632 
633 - `BetaSelfHostedConfig object { type }`
614 - `BetaSelfHostedConfig object`
634615 
635616 Configuration for self-hosted environments.
636617 
from line 619
638619 
639620 Environment type
640621 
641 - `"self_hosted"`
642 
643622 - `created_at: string`
644623 
645624 RFC 3339 timestamp when environment was created
from line 639
660639 
661640 The type of object (always 'environment')
662641 
663 - `"environment"`
642 default: environment
664643 
665644 - `updated_at: string`
666645 
from line 659
680659 
681660### Example
682661 
683```http
662```bash
684663curl https://api.anthropic.com/v1/environments \
685664 -H 'anthropic-version: 2023-06-01' \
686665 -H 'anthropic-beta: managed-agents-2026-04-01' \
687666 -H "X-Api-Key: $ANTHROPIC_API_KEY"
688667```
689668 
690#### Response
669#### Response (200)
691670 
692671```json
693672{
from line 722
743722 
744723## Get Environment
745724 
746**get** `/v1/environments/{environment_id}`
725**GET** `/v1/environments/{environment_id}`
747726 
748727Retrieve a specific environment by ID.
749728 
750### Path Parameters
729### Path parameters
751730 
752731- `environment_id: string`
753732 
754### Header Parameters
733### Headers
755734 
756735- `"anthropic-beta": optional array of AnthropicBeta`
757736 
from line 810
831810 
832811### Returns
833812 
834- `BetaEnvironment object { id, archived_at, config, 7 more }`
813- `BetaEnvironment object`
835814 
836815 Unified Environment resource for both cloud and self-hosted environments.
837816 
from line 826
847826 
848827 Environment configuration (either Anthropic Cloud or self-hosted)
849828 
850 - `BetaCloudConfig object { networking, packages, type }`
829 - `BetaCloudConfig object`
851830 
852831 `cloud` environment configuration.
853832 
from line 834
855834 
856835 Network configuration policy.
857836 
858 - `BetaUnrestrictedNetwork object { type }`
837 - `BetaUnrestrictedNetwork object`
859838 
860839 Unrestricted network access.
861840 
from line 842
863842 
864843 Network policy type
865844 
866 - `"unrestricted"`
867 
868 - `BetaLimitedNetwork object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }`
845 - `BetaLimitedNetwork object`
869846 
870847 Limited network access.
871848 
from line 862
885862 
886863 Network policy type
887864 
888 - `"limited"`
889 
890865 - `packages: BetaPackages`
891866 
892867 Package manager configuration.
from line 894
919894 
920895 Package configuration type
921896 
922 - `"packages"`
897 default: packages
923898 
924899 - `type: "cloud"`
925900 
926901 Environment type
927902 
928 - `"cloud"`
929 
930 - `BetaSelfHostedConfig object { type }`
903 - `BetaSelfHostedConfig object`
931904 
932905 Configuration for self-hosted environments.
933906 
from line 908
935908 
936909 Environment type
937910 
938 - `"self_hosted"`
939 
940911 - `created_at: string`
941912 
942913 RFC 3339 timestamp when environment was created
from line 928
957928 
958929 The type of object (always 'environment')
959930 
960 - `"environment"`
931 default: environment
961932 
962933 - `updated_at: string`
963934 
from line 944
973944 
974945### Example
975946 
976```http
947```bash
977948curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \
978949 -H 'anthropic-version: 2023-06-01' \
979950 -H 'anthropic-beta: managed-agents-2026-04-01' \
980951 -H "X-Api-Key: $ANTHROPIC_API_KEY"
981952```
982953 
983#### Response
954#### Response (200)
984955 
985956```json
986957{
from line 1002
10311002 
10321003## Update Environment
10331004 
1034**post** `/v1/environments/{environment_id}`
1005**POST** `/v1/environments/{environment_id}`
10351006 
10361007Update an existing environment's configuration.
10371008 
1038### Path Parameters
1009### Path parameters
10391010 
10401011- `environment_id: string`
10411012 
1042### Header Parameters
1013### Headers
10431014 
10441015- `"anthropic-beta": optional array of AnthropicBeta`
10451016 
from line 1088
11171088 
11181089 - `"mid-conversation-tool-changes-2026-07-01"`
11191090 
1120### Body Parameters
1091### Body parameters
11211092 
11221093- `config: optional BetaCloudConfigParams or BetaSelfHostedConfigParams or null`
11231094 
11241095 Updated environment configuration
11251096 
1126 - `BetaCloudConfigParams object { type, networking, packages }`
1097 - `BetaCloudConfigParams object`
11271098 
11281099 Request params for `cloud` environment configuration.
11291100 
from line 1105
11341105 
11351106 Environment type
11361107 
1137 - `"cloud"`
1138 
11391108 - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams or null`
11401109 
11411110 Network configuration policy. Omit on update to preserve the existing value.
11421111 
1143 - `BetaUnrestrictedNetwork object { type }`
1112 - `BetaUnrestrictedNetwork object`
11441113 
11451114 Unrestricted network access.
11461115 
from line 1117
11481117 
11491118 Network policy type
11501119 
1151 - `"unrestricted"`
1152 
1153 - `BetaLimitedNetworkParams object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }`
1120 - `BetaLimitedNetworkParams object`
11541121 
11551122 Limited network request params.
11561123 
from line 1128
11611128 
11621129 Network policy type
11631130 
1164 - `"limited"`
1165 
11661131 - `allow_mcp_servers: optional boolean or null`
11671132 
11681133 Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.
from line 1174
12091174 
12101175 Package configuration type
12111176 
1212 - `"packages"`
1213 
1214 - `BetaSelfHostedConfigParams object { type }`
1177 default: packages
1178 
1179 - `BetaSelfHostedConfigParams object`
12151180 
12161181 Request params for `self_hosted` environment configuration.
12171182 
from line 1184
12191184 
12201185 Environment type
12211186 
1222 - `"self_hosted"`
1223 
12241187- `description: optional string or null`
12251188 
12261189 Updated description of the environment. Omit to preserve; null clears to null; an empty string is stored as an empty string.
12271190 
1191 maxLength: 1024
1192 
12281193- `metadata: optional map[string]`
12291194 
12301195 User-provided metadata key-value pairs. Set a value to null or empty string to delete the key.
from line 1198
12331198 
12341199 Updated name for the environment
12351200 
1201 maxLength: 256, minLength: 1
1202 
12361203- `scope: optional "organization" or "account" or null`
12371204 
12381205 The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only.
from line 1210
12431210 
12441211### Returns
12451212 
1246- `BetaEnvironment object { id, archived_at, config, 7 more }`
1213- `BetaEnvironment object`
12471214 
12481215 Unified Environment resource for both cloud and self-hosted environments.
12491216 
from line 1226
12591226 
12601227 Environment configuration (either Anthropic Cloud or self-hosted)
12611228 
1262 - `BetaCloudConfig object { networking, packages, type }`
1229 - `BetaCloudConfig object`
12631230 
12641231 `cloud` environment configuration.
12651232 
from line 1234
12671234 
12681235 Network configuration policy.
12691236 
1270 - `BetaUnrestrictedNetwork object { type }`
1237 - `BetaUnrestrictedNetwork object`
12711238 
12721239 Unrestricted network access.
12731240 
from line 1242
12751242 
12761243 Network policy type
12771244 
1278 - `"unrestricted"`
1279 
1280 - `BetaLimitedNetwork object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }`
1245 - `BetaLimitedNetwork object`
12811246 
12821247 Limited network access.
12831248 
from line 1262
12971262 
12981263 Network policy type
12991264 
1300 - `"limited"`
1301 
13021265 - `packages: BetaPackages`
13031266 
13041267 Package manager configuration.
from line 1294
13311294 
13321295 Package configuration type
13331296 
1334 - `"packages"`
1297 default: packages
13351298 
13361299 - `type: "cloud"`
13371300 
13381301 Environment type
13391302 
1340 - `"cloud"`
1341 
1342 - `BetaSelfHostedConfig object { type }`
1303 - `BetaSelfHostedConfig object`
13431304 
13441305 Configuration for self-hosted environments.
13451306 
from line 1308
13471308 
13481309 Environment type
13491310 
1350 - `"self_hosted"`
1351 
13521311 - `created_at: string`
13531312 
13541313 RFC 3339 timestamp when environment was created
from line 1328
13691328 
13701329 The type of object (always 'environment')
13711330 
1372 - `"environment"`
1331 default: environment
13731332 
13741333 - `updated_at: string`
13751334 
from line 1344
13851344 
13861345### Example
13871346 
1388```http
1347```bash
13891348curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \
13901349 -H 'Content-Type: application/json' \
13911350 -H 'anthropic-version: 2023-06-01' \
from line 1355
13961355 }'
13971356```
13981357 
1399#### Response
1358#### Response (200)
14001359 
14011360```json
14021361{
from line 1406
14471406 
14481407## Delete Environment
14491408 
1450**delete** `/v1/environments/{environment_id}`
1409**DELETE** `/v1/environments/{environment_id}`
14511410 
14521411Delete an environment by ID. Returns a confirmation of the deletion.
14531412 
1454### Path Parameters
1413### Path parameters
14551414 
14561415- `environment_id: string`
14571416 
1458### Header Parameters
1417### Headers
14591418 
14601419- `"anthropic-beta": optional array of AnthropicBeta`
14611420 
from line 1494
15351494 
15361495### Returns
15371496 
1538- `BetaEnvironmentDeleteResponse object { id, type }`
1497- `BetaEnvironmentDeleteResponse object`
15391498 
15401499 Response after deleting an environment.
15411500 
from line 1506
15471506 
15481507 The type of response
15491508 
1550 - `"environment_deleted"`
1509 default: environment_deleted
15511510 
15521511### Example
15531512 
1554```http
1513```bash
15551514curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \
15561515 -X DELETE \
15571516 -H 'anthropic-version: 2023-06-01' \
from line 1518
15591518 -H "X-Api-Key: $ANTHROPIC_API_KEY"
15601519```
15611520 
1562#### Response
1521#### Response (200)
15631522 
15641523```json
15651524{
from line 1529
15701529 
15711530## Archive Environment
15721531 
1573**post** `/v1/environments/{environment_id}/archive`
1532**POST** `/v1/environments/{environment_id}/archive`
15741533 
15751534Archive an environment by ID. Archived environments cannot be used to create new sessions.
15761535 
1577### Path Parameters
1536### Path parameters
15781537 
15791538- `environment_id: string`
15801539 
1581### Header Parameters
1540### Headers
15821541 
15831542- `"anthropic-beta": optional array of AnthropicBeta`
15841543 
from line 1617
16581617 
16591618### Returns
16601619 
1661- `BetaEnvironment object { id, archived_at, config, 7 more }`
1620- `BetaEnvironment object`
16621621 
16631622 Unified Environment resource for both cloud and self-hosted environments.
16641623 
from line 1633
16741633 
16751634 Environment configuration (either Anthropic Cloud or self-hosted)
16761635 
1677 - `BetaCloudConfig object { networking, packages, type }`
1636 - `BetaCloudConfig object`
16781637 
16791638 `cloud` environment configuration.
16801639 
from line 1641
16821641 
16831642 Network configuration policy.
16841643 
1685 - `BetaUnrestrictedNetwork object { type }`
1644 - `BetaUnrestrictedNetwork object`
16861645 
16871646 Unrestricted network access.
16881647 
from line 1649
16901649 
16911650 Network policy type
16921651 
1693 - `"unrestricted"`
1694 
1695 - `BetaLimitedNetwork object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }`
1652 - `BetaLimitedNetwork object`
16961653 
16971654 Limited network access.
16981655 
from line 1669
17121669 
17131670 Network policy type
17141671 
1715 - `"limited"`
1716 
17171672 - `packages: BetaPackages`
17181673 
17191674 Package manager configuration.
from line 1701
17461701 
17471702 Package configuration type
17481703 
1749 - `"packages"`
1704 default: packages
17501705 
17511706 - `type: "cloud"`
17521707 
17531708 Environment type
17541709 
1755 - `"cloud"`
1756 
1757 - `BetaSelfHostedConfig object { type }`
1710 - `BetaSelfHostedConfig object`
17581711 
17591712 Configuration for self-hosted environments.
17601713 
from line 1715
17621715 
17631716 Environment type
17641717 
1765 - `"self_hosted"`
1766 
17671718 - `created_at: string`
17681719 
17691720 RFC 3339 timestamp when environment was created
from line 1735
17841735 
17851736 The type of object (always 'environment')
17861737 
1787 - `"environment"`
1738 default: environment
17881739 
17891740 - `updated_at: string`
17901741 
from line 1751
18001751 
18011752### Example
18021753 
1803```http
1754```bash
18041755curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/archive \
18051756 -X POST \
18061757 -H 'anthropic-version: 2023-06-01' \
from line 1759
18081759 -H "X-Api-Key: $ANTHROPIC_API_KEY"
18091760```
18101761 
1811#### Response
1762#### Response (200)
18121763 
18131764```json
18141765{
from line 1808
18571808}
18581809```
18591810 
1860## Domain Types
1811## Domain types
18611812 
18621813### Beta Cloud Config
18631814 
1864- `BetaCloudConfig object { networking, packages, type }`
1815- `BetaCloudConfig object`
18651816 
18661817 `cloud` environment configuration.
18671818 
from line 1820
18691820 
18701821 Network configuration policy.
18711822 
1872 - `BetaUnrestrictedNetwork object { type }`
1823 - `BetaUnrestrictedNetwork object`
18731824 
18741825 Unrestricted network access.
18751826 
from line 1828
18771828 
18781829 Network policy type
18791830 
1880 - `"unrestricted"`
1881 
1882 - `BetaLimitedNetwork object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }`
1831 - `BetaLimitedNetwork object`
18831832 
18841833 Limited network access.
18851834 
from line 1848
18991848 
19001849 Network policy type
19011850 
1902 - `"limited"`
1903 
19041851 - `packages: BetaPackages`
19051852 
19061853 Package manager configuration.
from line 1880
19331880 
19341881 Package configuration type
19351882 
1936 - `"packages"`
1883 default: packages
19371884 
19381885 - `type: "cloud"`
19391886 
19401887 Environment type
19411888 
1942 - `"cloud"`
1943 
19441889### Beta Cloud Config Params
19451890 
1946- `BetaCloudConfigParams object { type, networking, packages }`
1891- `BetaCloudConfigParams object`
19471892 
19481893 Request params for `cloud` environment configuration.
19491894 
from line 1899
19541899 
19551900 Environment type
19561901 
1957 - `"cloud"`
1958 
19591902 - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams or null`
19601903 
19611904 Network configuration policy. Omit on update to preserve the existing value.
19621905 
1963 - `BetaUnrestrictedNetwork object { type }`
1906 - `BetaUnrestrictedNetwork object`
19641907 
19651908 Unrestricted network access.
19661909 
from line 1911
19681911 
19691912 Network policy type
19701913 
1971 - `"unrestricted"`
1972 
1973 - `BetaLimitedNetworkParams object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }`
1914 - `BetaLimitedNetworkParams object`
19741915 
19751916 Limited network request params.
19761917 
from line 1922
19811922 
19821923 Network policy type
19831924 
1984 - `"limited"`
1985 
19861925 - `allow_mcp_servers: optional boolean or null`
19871926 
19881927 Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.
from line 1968
20291968 
20301969 Package configuration type
20311970 
2032 - `"packages"`
1971 default: packages
20331972 
20341973### Beta Environment
20351974 
2036- `BetaEnvironment object { id, archived_at, config, 7 more }`
1975- `BetaEnvironment object`
20371976 
20381977 Unified Environment resource for both cloud and self-hosted environments.
20391978 
from line 1988
20491988 
20501989 Environment configuration (either Anthropic Cloud or self-hosted)
20511990 
2052 - `BetaCloudConfig object { networking, packages, type }`
1991 - `BetaCloudConfig object`
20531992 
20541993 `cloud` environment configuration.
20551994 
from line 1996
20571996 
20581997 Network configuration policy.
20591998 
2060 - `BetaUnrestrictedNetwork object { type }`
1999 - `BetaUnrestrictedNetwork object`
20612000 
20622001 Unrestricted network access.
20632002 
from line 2004
20652004 
20662005 Network policy type
20672006 
2068 - `"unrestricted"`
2069 
2070 - `BetaLimitedNetwork object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }`
2007 - `BetaLimitedNetwork object`
20712008 
20722009 Limited network access.
20732010 
from line 2024
20872024 
20882025 Network policy type
20892026 
2090 - `"limited"`
2091 
20922027 - `packages: BetaPackages`
20932028 
20942029 Package manager configuration.
from line 2056
21212056 
21222057 Package configuration type
21232058 
2124 - `"packages"`
2059 default: packages
21252060 
21262061 - `type: "cloud"`
21272062 
21282063 Environment type
21292064 
2130 - `"cloud"`
2131 
2132 - `BetaSelfHostedConfig object { type }`
2065 - `BetaSelfHostedConfig object`
21332066 
21342067 Configuration for self-hosted environments.
21352068 
from line 2070
21372070 
21382071 Environment type
21392072 
2140 - `"self_hosted"`
2141 
21422073 - `created_at: string`
21432074 
21442075 RFC 3339 timestamp when environment was created
from line 2090
21592090 
21602091 The type of object (always 'environment')
21612092 
2162 - `"environment"`
2093 default: environment
21632094 
21642095 - `updated_at: string`
21652096 
from line 2106
21752106 
21762107### Beta Environment Delete Response
21772108 
2178- `BetaEnvironmentDeleteResponse object { id, type }`
2109- `BetaEnvironmentDeleteResponse object`
21792110 
21802111 Response after deleting an environment.
21812112 
from line 2118
21872118 
21882119 The type of response
21892120 
2190 - `"environment_deleted"`
2121 default: environment_deleted
21912122 
21922123### Beta Limited Network
21932124 
2194- `BetaLimitedNetwork object { allow_mcp_servers, allow_package_managers, allowed_hosts, type }`
2125- `BetaLimitedNetwork object`
21952126 
21962127 Limited network access.
21972128 
from line 2142
22112142 
22122143 Network policy type
22132144 
2214 - `"limited"`
2215 
22162145### Beta Limited Network Params
22172146 
2218- `BetaLimitedNetworkParams object { type, allow_mcp_servers, allow_package_managers, allowed_hosts }`
2147- `BetaLimitedNetworkParams object`
22192148 
22202149 Limited network request params.
22212150 
from line 2155
22262155 
22272156 Network policy type
22282157 
2229 - `"limited"`
2230 
22312158 - `allow_mcp_servers: optional boolean or null`
22322159 
22332160 Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.
from line 2169
22422169 
22432170### Beta Packages
22442171 
2245- `BetaPackages object { apt, cargo, gem, 4 more }`
2172- `BetaPackages object`
22462173 
22472174 Packages (and their versions) available in this environment.
22482175 
from line 2201
22742201 
22752202 Package configuration type
22762203 
2277 - `"packages"`
2204 default: packages
22782205 
22792206### Beta Packages Params
22802207 
2281- `BetaPackagesParams object { apt, cargo, gem, 4 more }`
2208- `BetaPackagesParams object`
22822209 
22832210 Specify packages (and optionally their versions) available in this environment.
22842211 
from line 2239
23122239 
23132240 Package configuration type
23142241 
2315 - `"packages"`
2242 default: packages
23162243 
23172244### Beta Self Hosted Config
23182245 
2319- `BetaSelfHostedConfig object { type }`
2246- `BetaSelfHostedConfig object`
23202247 
23212248 Configuration for self-hosted environments.
23222249 
from line 2251
23242251 
23252252 Environment type
23262253 
2327 - `"self_hosted"`
2328 
23292254### Beta Self Hosted Config Params
23302255 
2331- `BetaSelfHostedConfigParams object { type }`
2256- `BetaSelfHostedConfigParams object`
23322257 
23332258 Request params for `self_hosted` environment configuration.
23342259 
from line 2261
23362261 
23372262 Environment type
23382263 
2339 - `"self_hosted"`
2340 
23412264### Beta Unrestricted Network
23422265 
2343- `BetaUnrestrictedNetwork object { type }`
2266- `BetaUnrestrictedNetwork object`
23442267 
23452268 Unrestricted network access.
23462269 
from line 2271
23482271 
23492272 Network policy type
23502273 
2351 - `"unrestricted"`
2352 
2353# Work
2354 
2355## Get Work Item
2356 
2357**get** `/v1/environments/{environment_id}/work/{work_id}`
2274## Environments › Work
2275 
2276### Get Work Item
2277 
2278**GET** `/v1/environments/{environment_id}/work/{work_id}`
23582279 
23592280Note: 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.
23602281 
23612282Retrieve detailed information about a specific work item.
23622283 
2363### Path Parameters
2284#### Path parameters
23642285 
23652286- `environment_id: string`
23662287 
23672288- `work_id: string`
23682289 
2369### Header Parameters
2290#### Headers
23702291 
23712292- `"anthropic-beta": optional array of AnthropicBeta`
23722293 
from line 2365
24442365 
24452366 - `"mid-conversation-tool-changes-2026-07-01"`
24462367 
2447### Returns
2448 
2449- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
2368#### Returns
2369 
2370- `BetaSelfHostedWork object`
24502371 
24512372 Work resource representing a unit of work in a self-hosted environment.
24522373 
from line 2399
24782399 
24792400 Type of work data
24802401 
2481 - `"session"`
2482 
24832402 - `environment_id: string`
24842403 
24852404 Environment identifier this work belongs to (e.g., `env_...`)
from line 2445
25262445 
25272446 The type of object (always 'work')
25282447 
2529 - `"work"`
2530 
2531### Example
2532 
2533```http
2448 default: work
2449 
2450#### Example
2451 
2452```bash
25342453curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID \
25352454 -H 'anthropic-version: 2023-06-01' \
25362455 -H 'anthropic-beta: managed-agents-2026-04-01' \
25372456 -H "X-Api-Key: $ANTHROPIC_API_KEY"
25382457```
25392458 
2540#### Response
2459##### Response (200)
25412460 
25422461```json
25432462{
from line 2481
25622481}
25632482```
25642483 
2565## Poll for Work
2566 
2567**get** `/v1/environments/{environment_id}/work/poll`
2484### Poll for Work
2485 
2486**GET** `/v1/environments/{environment_id}/work/poll`
25682487 
25692488Note: 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.
25702489 
25712490Long poll for work items in the queue.
25722491 
2573### Path Parameters
2492#### Path parameters
25742493 
25752494- `environment_id: string`
25762495 
2577### Query Parameters
2496#### Query parameters
25782497 
25792498- `block_ms: optional number`
25802499 
25812500 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).
25822501 
2502 minimum: 1
2503 
25832504- `reclaim_older_than_ms: optional number`
25842505 
25852506 Reclaim unacknowledged work items older than this many milliseconds. If omitted, uses the default (5000ms).
25862507 
2587### Header Parameters
2508 minimum: 1
2509 
2510#### Headers
25882511 
25892512- `"anthropic-beta": optional array of AnthropicBeta`
25902513 
from line 2589
26662589 
26672590 Unique identifier for the specific worker polling, used to track aggregated environment-level work metrics in Console
26682591 
2669### Returns
2670 
2671- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
2592#### Returns
2593 
2594- `BetaSelfHostedWork object`
26722595 
26732596 Work resource representing a unit of work in a self-hosted environment.
26742597 
from line 2623
27002623 
27012624 Type of work data
27022625 
2703 - `"session"`
2704 
27052626 - `environment_id: string`
27062627 
27072628 Environment identifier this work belongs to (e.g., `env_...`)
from line 2669
27482669 
27492670 The type of object (always 'work')
27502671 
2751 - `"work"`
2752 
2753### Example
2754 
2755```http
2672 default: work
2673 
2674#### Example
2675 
2676```bash
27562677curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/poll \
27572678 -H 'anthropic-version: 2023-06-01' \
27582679 -H 'anthropic-beta: managed-agents-2026-04-01' \
27592680 -H "X-Api-Key: $ANTHROPIC_API_KEY"
27602681```
27612682 
2762#### Response
2683##### Response (200)
27632684 
27642685```json
27652686{
from line 2705
27842705}
27852706```
27862707 
2787## Acknowledge Work
2788 
2789**post** `/v1/environments/{environment_id}/work/{work_id}/ack`
2708### Acknowledge Work
2709 
2710**POST** `/v1/environments/{environment_id}/work/{work_id}/ack`
27902711 
27912712Note: 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.
27922713 
27932714Acknowledge receipt of a work item, transitioning it from 'queued' to 'starting' and removing it from the queue.
27942715 
2795### Path Parameters
2716#### Path parameters
27962717 
27972718- `environment_id: string`
27982719 
27992720- `work_id: string`
28002721 
2801### Header Parameters
2722#### Headers
28022723 
28032724- `"anthropic-beta": optional array of AnthropicBeta`
28042725 
from line 2797
28762797 
28772798 - `"mid-conversation-tool-changes-2026-07-01"`
28782799 
2879### Returns
2880 
2881- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
2800#### Returns
2801 
2802- `BetaSelfHostedWork object`
28822803 
28832804 Work resource representing a unit of work in a self-hosted environment.
28842805 
from line 2831
29102831 
29112832 Type of work data
29122833 
2913 - `"session"`
2914 
29152834 - `environment_id: string`
29162835 
29172836 Environment identifier this work belongs to (e.g., `env_...`)
from line 2877
29582877 
29592878 The type of object (always 'work')
29602879 
2961 - `"work"`
2962 
2963### Example
2964 
2965```http
2880 default: work
2881 
2882#### Example
2883 
2884```bash
29662885curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID/ack \
29672886 -X POST \
29682887 -H 'anthropic-version: 2023-06-01' \
from line 2889
29702889 -H "X-Api-Key: $ANTHROPIC_API_KEY"
29712890```
29722891 
2973#### Response
2892##### Response (200)
29742893 
29752894```json
29762895{
from line 2914
29952914}
29962915```
29972916 
2998## Record Heartbeat
2999 
3000**post** `/v1/environments/{environment_id}/work/{work_id}/heartbeat`
2917### Record Heartbeat
2918 
2919**POST** `/v1/environments/{environment_id}/work/{work_id}/heartbeat`
30012920 
30022921Note: 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.
30032922 
30042923Record a heartbeat for a work item to maintain the lease.
30052924 
3006### Path Parameters
2925#### Path parameters
30072926 
30082927- `environment_id: string`
30092928 
30102929- `work_id: string`
30112930 
3012### Query Parameters
2931#### Query parameters
30132932 
30142933- `desired_ttl_seconds: optional number`
30152934 
from line 2938
30192938 
30202939 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.
30212940 
3022### Header Parameters
2941#### Headers
30232942 
30242943- `"anthropic-beta": optional array of AnthropicBeta`
30252944 
from line 3016
30973016 
30983017 - `"mid-conversation-tool-changes-2026-07-01"`
30993018 
3100### Returns
3101 
3102- `BetaSelfHostedWorkHeartbeatResponse object { last_heartbeat, lease_extended, state, 2 more }`
3019#### Returns
3020 
3021- `BetaSelfHostedWorkHeartbeatResponse object`
31033022 
31043023 Response after recording a heartbeat for a work item.
31053024 
from line 3052
31333052 
31343053 The type of response
31353054 
3136 - `"work_heartbeat"`
3137 
3138### Example
3139 
3140```http
3055 default: work_heartbeat
3056 
3057#### Example
3058 
3059```bash
31413060curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID/heartbeat \
31423061 -X POST \
31433062 -H 'anthropic-version: 2023-06-01' \
from line 3064
31453064 -H "X-Api-Key: $ANTHROPIC_API_KEY"
31463065```
31473066 
3148#### Response
3067##### Response (200)
31493068 
31503069```json
31513070{
from line 3076
31573076}
31583077```
31593078 
3160## Stop Work
3161 
3162**post** `/v1/environments/{environment_id}/work/{work_id}/stop`
3079### Stop Work
3080 
3081**POST** `/v1/environments/{environment_id}/work/{work_id}/stop`
31633082 
31643083Note: 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.
31653084 
31663085Stop a work item, initiating graceful or forced shutdown.
31673086 
3168### Path Parameters
3087#### Path parameters
31693088 
31703089- `environment_id: string`
31713090 
31723091- `work_id: string`
31733092 
3174### Header Parameters
3093#### Headers
31753094 
31763095- `"anthropic-beta": optional array of AnthropicBeta`
31773096 
from line 3168
32493168 
32503169 - `"mid-conversation-tool-changes-2026-07-01"`
32513170 
3252### Body Parameters
3171#### Body parameters
32533172 
32543173- `force: optional boolean`
32553174 
32563175 If true, immediately stop work without graceful shutdown
32573176 
3258### Returns
3259 
3260- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
3177 default: false
3178 
3179#### Returns
3180 
3181- `BetaSelfHostedWork object`
32613182 
32623183 Work resource representing a unit of work in a self-hosted environment.
32633184 
from line 3210
32893210 
32903211 Type of work data
32913212 
3292 - `"session"`
3293 
32943213 - `environment_id: string`
32953214 
32963215 Environment identifier this work belongs to (e.g., `env_...`)
from line 3256
33373256 
33383257 The type of object (always 'work')
33393258 
3340 - `"work"`
3341 
3342### Example
3343 
3344```http
3259 default: work
3260 
3261#### Example
3262 
3263```bash
33453264curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID/stop \
33463265 -H 'Content-Type: application/json' \
33473266 -H 'anthropic-version: 2023-06-01' \
from line 3269
33503269 -d '{}'
33513270```
33523271 
3353#### Response
3272##### Response (200)
33543273 
33553274```json
33563275{
from line 3294
33753294}
33763295```
33773296 
3378## List Work Items
3379 
3380**get** `/v1/environments/{environment_id}/work`
3297### List Work Items
3298 
3299**GET** `/v1/environments/{environment_id}/work`
33813300 
33823301Note: 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.
33833302 
33843303List work items in an environment.
33853304 
3386### Path Parameters
3305#### Path parameters
33873306 
33883307- `environment_id: string`
33893308 
3390### Query Parameters
3309#### Query parameters
33913310 
33923311- `limit: optional number`
33933312 
33943313 Maximum number of work items to return
33953314 
3315 default: 20, maximum: 1000, minimum: 1
3316 
33963317- `page: optional string`
33973318 
33983319 Opaque cursor from previous response for pagination
33993320 
3400### Header Parameters
3321#### Headers
34013322 
34023323- `"anthropic-beta": optional array of AnthropicBeta`
34033324 
from line 3396
34753396 
34763397 - `"mid-conversation-tool-changes-2026-07-01"`
34773398 
3478### Returns
3479 
3480- `BetaSelfHostedWorkListResponse object { data, next_page }`
3399#### Returns
3400 
3401- `BetaSelfHostedWorkListResponse object`
34813402 
34823403 Response when listing work items with cursor-based pagination.
34833404 
from line 3430
35093430 
35103431 Type of work data
35113432 
3512 - `"session"`
3513 
35143433 - `environment_id: string`
35153434 
35163435 Environment identifier this work belongs to (e.g., `env_...`)
from line 3476
35573476 
35583477 The type of object (always 'work')
35593478 
3560 - `"work"`
3479 default: work
35613480 
35623481 - `next_page: string or null`
35633482 
35643483 Opaque cursor for fetching the next page of results
35653484 
3566### Example
3567 
3568```http
3485#### Example
3486 
3487```bash
35693488curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work \
35703489 -H 'anthropic-version: 2023-06-01' \
35713490 -H 'anthropic-beta: managed-agents-2026-04-01' \
35723491 -H "X-Api-Key: $ANTHROPIC_API_KEY"
35733492```
35743493 
3575#### Response
3494##### Response (200)
35763495 
35773496```json
35783497{
from line 3521
36023521}
36033522```
36043523 
3605## Update Work Item
3606 
3607**post** `/v1/environments/{environment_id}/work/{work_id}`
3524### Update Work Item
3525 
3526**POST** `/v1/environments/{environment_id}/work/{work_id}`
36083527 
36093528Note: 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.
36103529 
36113530Update work item metadata with merge semantics.
36123531 
3613### Path Parameters
3532#### Path parameters
36143533 
36153534- `environment_id: string`
36163535 
36173536- `work_id: string`
36183537 
3619### Header Parameters
3538#### Headers
36203539 
36213540- `"anthropic-beta": optional array of AnthropicBeta`
36223541 
from line 3613
36943613 
36953614 - `"mid-conversation-tool-changes-2026-07-01"`
36963615 
3697### Body Parameters
3616#### Body parameters
36983617 
36993618- `metadata: map[string]`
37003619 
37013620 Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve existing metadata.
37023621 
3703### Returns
3704 
3705- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
3622#### Returns
3623 
3624- `BetaSelfHostedWork object`
37063625 
37073626 Work resource representing a unit of work in a self-hosted environment.
37083627 
from line 3653
37343653 
37353654 Type of work data
37363655 
3737 - `"session"`
3738 
37393656 - `environment_id: string`
37403657 
37413658 Environment identifier this work belongs to (e.g., `env_...`)
from line 3699
37823699 
37833700 The type of object (always 'work')
37843701 
3785 - `"work"`
3786 
3787### Example
3788 
3789```http
3702 default: work
3703 
3704#### Example
3705 
3706```bash
37903707curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID \
37913708 -H 'Content-Type: application/json' \
37923709 -H 'anthropic-version: 2023-06-01' \
from line 3716
37993716 }'
38003717```
38013718 
3802#### Response
3719##### Response (200)
38033720 
38043721```json
38053722{
from line 3741
38243741}
38253742```
38263743 
3827## Get Queue Statistics
3828 
3829**get** `/v1/environments/{environment_id}/work/stats`
3744### Get Queue Statistics
3745 
3746**GET** `/v1/environments/{environment_id}/work/stats`
38303747 
38313748Get statistics about the work queue for an environment.
38323749 
3833### Path Parameters
3750#### Path parameters
38343751 
38353752- `environment_id: string`
38363753 
3837### Header Parameters
3754#### Headers
38383755 
38393756- `"anthropic-beta": optional array of AnthropicBeta`
38403757 
from line 3829
39123829 
39133830 - `"mid-conversation-tool-changes-2026-07-01"`
39143831 
3915### Returns
3916 
3917- `BetaSelfHostedWorkQueueStats object { depth, oldest_queued_at, pending, 2 more }`
3832#### Returns
3833 
3834- `BetaSelfHostedWorkQueueStats object`
39183835 
39193836 Statistics about the work queue for an environment.
39203837 
from line 3849
39323849 
39333850 Number of work items being processed (polled but not acknowledged)
39343851 
3852 default: 0
3853 
39353854 - `type: "work_queue_stats"`
39363855 
39373856 The type of object
39383857 
3939 - `"work_queue_stats"`
3858 default: work_queue_stats
39403859 
39413860 - `workers_polling: number or null`
39423861 
39433862 Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.
39443863 
3945### Example
3946 
3947```http
3864#### Example
3865 
3866```bash
39483867curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/stats \
39493868 -H 'anthropic-version: 2023-06-01' \
39503869 -H 'anthropic-beta: managed-agents-2026-04-01' \
39513870 -H "X-Api-Key: $ANTHROPIC_API_KEY"
39523871```
39533872 
3954#### Response
3873##### Response (200)
39553874 
39563875```json
39573876{
from line 3881
39623881 "workers_polling": 0
39633882}
39643883```
3965 
3966## Domain Types
3967 
3968### Beta Self Hosted Work
3969 
3970- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }`
3971 
3972 Work resource representing a unit of work in a self-hosted environment.
3973 
3974 Work items are queued when sessions are created or when long-dormant sessions
3975 receive new messages. The environment worker polls for work to execute in a
3976 self-hosted sandbox.
3977 
3978 - `id: string`
3979 
3980 Work identifier (e.g., 'work_...')
3981 
3982 - `acknowledged_at: string or null`
3983 
3984 RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox
3985 
3986 - `created_at: string`
3987 
3988 RFC 3339 timestamp when work was created
3989 
3990 - `data: BetaSessionWorkData`
3991 
3992 The actual work to be performed
3993 
3994 - `id: string`
3995 
3996 Session identifier (e.g., 'session_...')
3997 
3998 - `type: "session"`
3999 
4000 Type of work data
4001 
4002 - `"session"`
4003 
4004 - `environment_id: string`
4005 
4006 Environment identifier this work belongs to (e.g., `env_...`)
4007 
4008 - `latest_heartbeat_at: string or null`
4009 
4010 RFC 3339 timestamp of the most recent heartbeat
4011 
4012 - `metadata: map[string]`
4013 
4014 User-provided metadata key-value pairs associated with this work item
4015 
4016 - `secret: string or null`
4017 
4018 Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.
4019 
4020 - `started_at: string or null`
4021 
4022 RFC 3339 timestamp when work execution started
4023 
4024 - `state: "queued" or "starting" or "active" or 2 more`
4025 
4026 Current state of the work item
4027 
4028 - `"queued"`
4029 
4030 - `"starting"`
4031 
4032 - `"active"`
4033 
4034 - `"stopping"`
4035 
4036 - `"stopped"`
4037 
4038 - `stop_requested_at: string or null`
4039 
4040 RFC 3339 timestamp when stop was requested
4041 
4042 - `stopped_at: string or null`
4043 
4044 RFC 3339 timestamp when work execution stopped
4045 
4046 - `type: "work"`
4047 
4048 The type of object (always 'work')
4049 
4050 - `"work"`
4051 
4052### Beta Self Hosted Work Heartbeat Response
4053 
4054- `BetaSelfHostedWorkHeartbeatResponse object { last_heartbeat, lease_extended, state, 2 more }`
4055 
4056 Response after recording a heartbeat for a work item.
4057 
4058 - `last_heartbeat: string`
4059 
4060 RFC 3339 timestamp of the actual heartbeat from DB
4061 
4062 - `lease_extended: boolean`
4063 
4064 Whether the heartbeat succeeded in extending the lease
4065 
4066 - `state: "queued" or "starting" or "active" or 2 more`
4067 
4068 Current state of the work item (active/stopping/stopped)
4069 
4070 - `"queued"`
4071 
4072 - `"starting"`
4073 
4074 - `"active"`
4075 
4076 - `"stopping"`
4077 
4078 - `"stopped"`
4079 
4080 - `ttl_seconds: number`
4081 
4082 Effective TTL applied to the lease
4083 
4084 - `type: "work_heartbeat"`
4085 
4086 The type of response
4087 
4088 - `"work_heartbeat"`
4089 
4090### Beta Self Hosted Work List Response
4091 
4092- `BetaSelfHostedWorkListResponse object { data, next_page }`
4093 
4094 Response when listing work items with cursor-based pagination.
4095 
4096 - `data: array of BetaSelfHostedWork`
4097 
4098 List of work items
4099 
4100 - `id: string`
4101 
4102 Work identifier (e.g., 'work_...')
4103 
4104 - `acknowledged_at: string or null`
4105 
4106 RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox
4107 
4108 - `created_at: string`
4109 
4110 RFC 3339 timestamp when work was created
4111 
4112 - `data: BetaSessionWorkData`
4113 
4114 The actual work to be performed
4115 
4116 - `id: string`
4117 
4118 Session identifier (e.g., 'session_...')
4119 
4120 - `type: "session"`
4121 
4122 Type of work data
4123 
4124 - `"session"`
4125 
4126 - `environment_id: string`
4127 
4128 Environment identifier this work belongs to (e.g., `env_...`)
4129 
4130 - `latest_heartbeat_at: string or null`
4131 
4132 RFC 3339 timestamp of the most recent heartbeat
4133 
4134 - `metadata: map[string]`
4135 
4136 User-provided metadata key-value pairs associated with this work item
4137 
4138 - `secret: string or null`
4139 
4140 Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.
4141 
4142 - `started_at: string or null`
4143 
4144 RFC 3339 timestamp when work execution started
4145 
4146 - `state: "queued" or "starting" or "active" or 2 more`
4147 
4148 Current state of the work item
4149 
4150 - `"queued"`
4151 
4152 - `"starting"`
4153 
4154 - `"active"`
4155 
4156 - `"stopping"`
4157 
4158 - `"stopped"`
4159 
4160 - `stop_requested_at: string or null`
4161 
4162 RFC 3339 timestamp when stop was requested
4163 
4164 - `stopped_at: string or null`
4165 
4166 RFC 3339 timestamp when work execution stopped
4167 
4168 - `type: "work"`
4169 
4170 The type of object (always 'work')
4171 
4172 - `"work"`
4173 
4174 - `next_page: string or null`
4175 
4176 Opaque cursor for fetching the next page of results
4177 
4178### Beta Self Hosted Work Queue Stats
4179 
4180- `BetaSelfHostedWorkQueueStats object { depth, oldest_queued_at, pending, 2 more }`
4181 
4182 Statistics about the work queue for an environment.
4183 
4184 Uses Redis Stream consumer group metrics for O(1) queries.
4185 
4186 - `depth: number`
4187 
4188 Number of work items waiting to be picked up (lag from consumer group)
4189 
4190 - `oldest_queued_at: string or null`
4191 
4192 RFC 3339 timestamp of oldest item in the work stream (includes both queued and pending items), null if stream empty
4193 
4194 - `pending: number`
4195 
4196 Number of work items being processed (polled but not acknowledged)
4197 
4198 - `type: "work_queue_stats"`
4199 
4200 The type of object
4201 
4202 - `"work_queue_stats"`
4203 
4204 - `workers_polling: number or null`
4205 
4206 Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.
4207 
4208### Beta Self Hosted Work Stop Request
4209 
4210- `BetaSelfHostedWorkStopRequest object { force }`
4211 
4212 Request to stop a work item.
4213 
4214 - `force: optional boolean`
4215 
4216 If true, immediately stop work without graceful shutdown
4217 
4218### Beta Self Hosted Work Update Request
4219 
4220- `BetaSelfHostedWorkUpdateRequest object { metadata }`
4221 
4222 Request to update work item metadata.
4223 
4224 - `metadata: map[string]`
4225 
4226 Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve existing metadata.
4227 
4228### Beta Session Work Data
4229 
4230- `BetaSessionWorkData object { id, type }`
4231 
4232 Work data for session work items.
4233 
4234 This resource type is used when work represents a session that needs to be executed
4235 in a self-hosted environment.
4236 
4237 - `id: string`
4238 
4239 Session identifier (e.g., 'session_...')
4240 
4241 - `type: "session"`
4242 
4243 Type of work data
4244 
4245 - `"session"`
42463884 
Feedback