from line 1
1---
2title: Service Accounts
3url: https://platform.claude.com/docs/en/api/admin/workspaces/service_accounts
4---
5
61# Service Accounts
72
83## Create Service Account Workspace Member
94
10**post** `/v1/organizations/workspaces/{workspace_id}/service_accounts`
5**POST** `/v1/organizations/workspaces/{workspace_id}/service_accounts`
116
127Add a service account to a workspace with the given `workspace_role`.
138
from line 16
2116accounts cannot be added and are rejected. Requires an OAuth bearer or
2217Console session; Admin API keys are not accepted.
2318
24### Path Parameters
19### Path parameters
2520
2621- `workspace_id: string`
2722
2823 ID of the workspace.
2924
30### Header Parameters
25### Headers
3126
3227- `"anthropic-beta": optional array of string`
3328
from line 30
3530
3631 To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
3732
38### Body Parameters
33### Body parameters
3934
4035- `service_account_id: string`
4136
from line 64
6964
7065- `type: "service_account_workspace_member"`
7166
72 - `"service_account_workspace_member"`
67 default: service_account_workspace_member
7368
7469- `workspace_id: string`
7570
from line 86
9186
9287### Example
9388
94```http
89```bash
9590curl https://api.anthropic.com/v1/organizations/workspaces/$WORKSPACE_ID/service_accounts \
9691 -H 'Content-Type: application/json' \
9792 -H 'anthropic-version: 2023-06-01' \
from line 97
10297 }'
10398```
10499
105#### Response
100#### Response (200)
106101
107102```json
108103{
from line 112
117112
118113## Get Service Account Workspace Member
119114
120**get** `/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}`
115**GET** `/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}`
121116
122117Retrieve a service account's membership in a workspace.
123118
from line 123
128123membership is returned with its assigned role. An archived service
129124account returns 404.
130125
131### Path Parameters
126### Path parameters
132127
133128- `workspace_id: string`
134129
from line 133
138133
139134 ID of the service account.
140135
141### Header Parameters
136### Headers
142137
143138- `"anthropic-beta": optional array of string`
144139
from line 157
162157
163158- `type: "service_account_workspace_member"`
164159
165 - `"service_account_workspace_member"`
160 default: service_account_workspace_member
166161
167162- `workspace_id: string`
168163
from line 179
184179
185180### Example
186181
187```http
182```bash
188183curl https://api.anthropic.com/v1/organizations/workspaces/$WORKSPACE_ID/service_accounts/$SERVICE_ACCOUNT_ID \
189184 -H 'anthropic-version: 2023-06-01' \
190185 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
191186```
192187
193#### Response
188#### Response (200)
194189
195190```json
196191{
from line 200
205200
206201## List Service Account Workspace Members
207202
208**get** `/v1/organizations/workspaces/{workspace_id}/service_accounts`
203**GET** `/v1/organizations/workspaces/{workspace_id}/service_accounts`
209204
210205List the service accounts that are members of a workspace.
211206
from line 211
216211included in this list. Memberships of archived service accounts are
217212omitted from the results.
218213
219### Path Parameters
214### Path parameters
220215
221216- `workspace_id: string`
222217
223218 ID of the workspace.
224219
225### Query Parameters
220### Query parameters
226221
227222- `limit: optional number`
228223
229224 Number of results per page.
230225
226 default: 20, maximum: 100, minimum: 1
227
231228- `page: optional string`
232229
233230 Opaque cursor from a previous response's `next_page`.
234231
235### Header Parameters
232### Headers
236233
237234- `"anthropic-beta": optional array of string`
238235
from line 239
242239
243240### Returns
244241
245- `data: array of object { created_by_actor_id, implicit, service_account_id, 3 more }`
242- `data: array of object`
246243
247244 - `created_by_actor_id: string or null`
248245
from line 255
258255
259256 - `type: "service_account_workspace_member"`
260257
261 - `"service_account_workspace_member"`
258 default: service_account_workspace_member
262259
263260 - `workspace_id: string`
264261
from line 281
284281
285282### Example
286283
287```http
284```bash
288285curl https://api.anthropic.com/v1/organizations/workspaces/$WORKSPACE_ID/service_accounts \
289286 -H 'anthropic-version: 2023-06-01' \
290287 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
291288```
292289
293#### Response
290#### Response (200)
294291
295292```json
296293{
from line 307
310307
311308## Update Service Account Workspace Member
312309
313**post** `/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}`
310**POST** `/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}`
314311
315312Change a service account's role in a workspace.
316313
from line 319
322319rejected. Requires an OAuth bearer or Console session; Admin API keys
323320are not accepted.
324321
325### Path Parameters
322### Path parameters
326323
327324- `workspace_id: string`
328325
from line 329
332329
333330 ID of the service account.
334331
335### Header Parameters
332### Headers
336333
337334- `"anthropic-beta": optional array of string`
338335
from line 337
340337
341338 To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
342339
343### Body Parameters
340### Body parameters
344341
345342- `workspace_role: "workspace_admin" or "workspace_developer" or "workspace_restricted_developer" or "workspace_user"`
346343
from line 367
370367
371368- `type: "service_account_workspace_member"`
372369
373 - `"service_account_workspace_member"`
370 default: service_account_workspace_member
374371
375372- `workspace_id: string`
376373
from line 389
392389
393390### Example
394391
395```http
392```bash
396393curl https://api.anthropic.com/v1/organizations/workspaces/$WORKSPACE_ID/service_accounts/$SERVICE_ACCOUNT_ID \
397394 -H 'Content-Type: application/json' \
398395 -H 'anthropic-version: 2023-06-01' \
from line 399
402399 }'
403400```
404401
405#### Response
402#### Response (200)
406403
407404```json
408405{
from line 414
417414
418415## Delete Service Account Workspace Member
419416
420**delete** `/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}`
417**DELETE** `/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}`
421418
422419Remove a service account from a workspace.
423420
from line 425
428425membership. Archived workspaces return 400. Requires an OAuth bearer or
429426Console session; Admin API keys are not accepted.
430427
431### Path Parameters
428### Path parameters
432429
433430- `workspace_id: string`
434431
from line 435
438435
439436 ID of the service account.
440437
441### Header Parameters
438### Headers
442439
443440- `"anthropic-beta": optional array of string`
444441
from line 451
454451
455452- `type: "service_account_workspace_member_deleted"`
456453
457 - `"service_account_workspace_member_deleted"`
454 default: service_account_workspace_member_deleted
458455
459456- `workspace_id: string`
460457
from line 459
462459
463460### Example
464461
465```http
462```bash
466463curl https://api.anthropic.com/v1/organizations/workspaces/$WORKSPACE_ID/service_accounts/$SERVICE_ACCOUNT_ID \
467464 -X DELETE \
468465 -H 'anthropic-version: 2023-06-01' \
from line 466
469466 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
470467```
471468
472#### Response
469#### Response (200)
473470
474471```json
475472{
from line 476
479476}
480477```
481478
482## Domain Types
479## Domain types
483480
484481### Service Account Create Response
485482
486- `ServiceAccountCreateResponse object { created_by_actor_id, implicit, service_account_id, 3 more }`
483- `ServiceAccountCreateResponse object`
487484
488485 - `created_by_actor_id: string or null`
489486
from line 496
499496
500497 - `type: "service_account_workspace_member"`
501498
502 - `"service_account_workspace_member"`
499 default: service_account_workspace_member
503500
504501 - `workspace_id: string`
505502
from line 518
521518
522519### Service Account Retrieve Response
523520
524- `ServiceAccountRetrieveResponse object { created_by_actor_id, implicit, service_account_id, 3 more }`
521- `ServiceAccountRetrieveResponse object`
525522
526523 - `created_by_actor_id: string or null`
527524
from line 534
537534
538535 - `type: "service_account_workspace_member"`
539536
540 - `"service_account_workspace_member"`
537 default: service_account_workspace_member
541538
542539 - `workspace_id: string`
543540
from line 556
559556
560557### Service Account List Response
561558
562- `ServiceAccountListResponse object { created_by_actor_id, implicit, service_account_id, 3 more }`
559- `ServiceAccountListResponse object`
563560
564561 - `created_by_actor_id: string or null`
565562
from line 572
575572
576573 - `type: "service_account_workspace_member"`
577574
578 - `"service_account_workspace_member"`
575 default: service_account_workspace_member
579576
580577 - `workspace_id: string`
581578
from line 594
597594
598595### Service Account Update Response
599596
600- `ServiceAccountUpdateResponse object { created_by_actor_id, implicit, service_account_id, 3 more }`
597- `ServiceAccountUpdateResponse object`
601598
602599 - `created_by_actor_id: string or null`
603600
from line 610
613610
614611 - `type: "service_account_workspace_member"`
615612
616 - `"service_account_workspace_member"`
613 default: service_account_workspace_member
617614
618615 - `workspace_id: string`
619616
from line 632
635632
636633### Service Account Delete Response
637634
638- `ServiceAccountDeleteResponse object { service_account_id, type, workspace_id }`
635- `ServiceAccountDeleteResponse object`
639636
640637 - `service_account_id: string`
641638
from line 640
643640
644641 - `type: "service_account_workspace_member_deleted"`
645642
646 - `"service_account_workspace_member_deleted"`
643 default: service_account_workspace_member_deleted
647644
648645 - `workspace_id: string`
649646
No line in this hunk matches that.