from line 1
1---
2title: Workspaces
3url: https://platform.claude.com/docs/en/api/admin/service_accounts/workspaces
4---
5
61# Workspaces
72
83## Add Workspace To Service Account
94
10**post** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
5**POST** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
116
127Add a service account to a workspace with the given `workspace_role`.
138
from line 14
1914rejected. Requires an OAuth bearer or Console session; Admin API keys
2015are not accepted.
2116
22### Path Parameters
17### Path parameters
2318
2419- `service_account_id: string`
2520
2621 ID of the service account.
2722
28### Header Parameters
23### Headers
2924
3025- `"anthropic-beta": optional array of string`
3126
from line 28
3328
3429 To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
3530
36### Body Parameters
31### Body parameters
3732
3833- `workspace_id: string`
3934
from line 62
6762
6863- `type: "service_account_workspace_member"`
6964
70 - `"service_account_workspace_member"`
65 default: service_account_workspace_member
7166
7267- `workspace_id: string`
7368
from line 84
8984
9085### Example
9186
92```http
87```bash
9388curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces \
9489 -H 'Content-Type: application/json' \
9590 -H 'anthropic-version: 2023-06-01' \
from line 95
10095 }'
10196```
10297
103#### Response
98#### Response (200)
10499
105100```json
106101{
from line 110
115110
116111## List Workspaces For Service Account
117112
118**get** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
113**GET** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
119114
120115List the workspaces a service account is a member of.
121116
from line 124
129124the service account is active; an archived service account returns an
130125empty list.
131126
132### Path Parameters
127### Path parameters
133128
134129- `service_account_id: string`
135130
136131 ID of the service account.
137132
138### Query Parameters
133### Query parameters
139134
140135- `limit: optional number`
141136
142137 Number of results per page.
143138
139 default: 20, maximum: 100, minimum: 1
140
144141- `page: optional string`
145142
146143 Opaque cursor from a previous response's `next_page`.
147144
148### Header Parameters
145### Headers
149146
150147- `"anthropic-beta": optional array of string`
151148
from line 152
155152
156153### Returns
157154
158- `data: array of object { created_by_actor_id, implicit, service_account_id, 3 more }`
155- `data: array of object`
159156
160157 - `created_by_actor_id: string or null`
161158
from line 168
171168
172169 - `type: "service_account_workspace_member"`
173170
174 - `"service_account_workspace_member"`
171 default: service_account_workspace_member
175172
176173 - `workspace_id: string`
177174
from line 194
197194
198195### Example
199196
200```http
197```bash
201198curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces \
202199 -H 'anthropic-version: 2023-06-01' \
203200 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
204201```
205202
206#### Response
203#### Response (200)
207204
208205```json
209206{
from line 220
223220
224221## Remove Workspace From Service Account
225222
226**delete** `/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}`
223**DELETE** `/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}`
227224
228225Remove a service account from a workspace.
229226
from line 233
236233400. Requires an OAuth bearer or Console session; Admin API keys are not
237234accepted.
238235
239### Path Parameters
236### Path parameters
240237
241238- `service_account_id: string`
242239
from line 243
246243
247244 ID of the workspace.
248245
249### Header Parameters
246### Headers
250247
251248- `"anthropic-beta": optional array of string`
252249
from line 259
262259
263260- `type: "service_account_workspace_member_deleted"`
264261
265 - `"service_account_workspace_member_deleted"`
262 default: service_account_workspace_member_deleted
266263
267264- `workspace_id: string`
268265
from line 267
270267
271268### Example
272269
273```http
270```bash
274271curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces/$WORKSPACE_ID \
275272 -X DELETE \
276273 -H 'anthropic-version: 2023-06-01' \
from line 274
277274 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
278275```
279276
280#### Response
277#### Response (200)
281278
282279```json
283280{
from line 284
287284}
288285```
289286
290## Domain Types
287## Domain types
291288
292289### Workspace Create Response
293290
294- `WorkspaceCreateResponse object { created_by_actor_id, implicit, service_account_id, 3 more }`
291- `WorkspaceCreateResponse object`
295292
296293 - `created_by_actor_id: string or null`
297294
from line 304
307304
308305 - `type: "service_account_workspace_member"`
309306
310 - `"service_account_workspace_member"`
307 default: service_account_workspace_member
311308
312309 - `workspace_id: string`
313310
from line 326
329326
330327### Workspace List Response
331328
332- `WorkspaceListResponse object { created_by_actor_id, implicit, service_account_id, 3 more }`
329- `WorkspaceListResponse object`
333330
334331 - `created_by_actor_id: string or null`
335332
from line 342
345342
346343 - `type: "service_account_workspace_member"`
347344
348 - `"service_account_workspace_member"`
345 default: service_account_workspace_member
349346
350347 - `workspace_id: string`
351348
from line 364
367364
368365### Workspace Delete Response
369366
370- `WorkspaceDeleteResponse object { service_account_id, type, workspace_id }`
367- `WorkspaceDeleteResponse object`
371368
372369 - `service_account_id: string`
373370
from line 372
375372
376373 - `type: "service_account_workspace_member_deleted"`
377374
378 - `"service_account_workspace_member_deleted"`
375 default: service_account_workspace_member_deleted
379376
380377 - `workspace_id: string`
381378
No line in this hunk matches that.