from line 1
1---
2title: Service Accounts
3url: https://platform.claude.com/docs/en/api/admin/service_accounts
4---
5
61# Service Accounts
72
83## Create Service Account
94
10**post** `/v1/organizations/service_accounts`
5**POST** `/v1/organizations/service_accounts`
116
127Create a service account.
138
from line 15
2015an interactive credential (a user OAuth token or a Console session) — a
2116workload may only create `developer`-role service accounts.
2217
23### Header Parameters
18### Headers
2419
2520- `"anthropic-beta": optional array of string`
2621
from line 23
2823
2924 To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
3025
31### Body Parameters
26### Body parameters
3227
3328- `name: string`
3429
3530 Slug identifier (lowercase, digits, hyphens). Unique within the organization; a duplicate name returns 409.
3631
32 maxLength: 255, minLength: 1
33
3734- `description: optional string or null`
3835
3936 Optional free-text description.
4037
38 maxLength: 2000
39
4140- `organization_role: optional "admin" or "developer"`
4241
4342 Org-level role. Defaults to `developer`.
from line 47
4847
4948### Returns
5049
51- `ServiceAccount object { id, archived_at, archived_by_actor_id, 8 more }`
50- `ServiceAccount object`
5251
5352 Named non-human identity within the caller's organization.
5453
from line 62
6362
6463 If set, this service account is archived.
6564
65 format: date-time
66
6667 - `archived_by_actor_id: string or null`
6768
6869 Tagged ID (`user_`/`svac_`) of the actor that archived this service account.
from line 72
7172
7273 When this service account was created.
7374
75 format: date-time
76
7477 - `created_by_actor_id: string or null`
7578
7679 Tagged ID (`user_`/`svac_`) of the actor that created this service account.
from line 96
9396
9497 - `type: "service_account"`
9598
96 - `"service_account"`
99 default: service_account
97100
98101 - `updated_at: string`
99102
100103 When this service account was last updated.
101104
105 format: date-time
106
102107 - `updated_by_actor_id: string or null`
103108
104109 Tagged ID (`user_`/`svac_`) of the actor that last updated this service account.
from line 110
105110
106111### Example
107112
108```http
113```bash
109114curl https://api.anthropic.com/v1/organizations/service_accounts \
110115 -H 'Content-Type: application/json' \
111116 -H 'anthropic-version: 2023-06-01' \
from line 120
115120 }'
116121```
117122
118#### Response
123#### Response (200)
119124
120125```json
121126{
from line 140
135140
136141## Get Service Account
137142
138**get** `/v1/organizations/service_accounts/{service_account_id}`
143**GET** `/v1/organizations/service_accounts/{service_account_id}`
139144
140145Retrieve a service account by its ID (`svac_...`).
141146
142### Path Parameters
147### Path parameters
143148
144149- `service_account_id: string`
145150
146151 ID of the service account.
147152
148### Header Parameters
153### Headers
149154
150155- `"anthropic-beta": optional array of string`
151156
from line 160
155160
156161### Returns
157162
158- `ServiceAccount object { id, archived_at, archived_by_actor_id, 8 more }`
163- `ServiceAccount object`
159164
160165 Named non-human identity within the caller's organization.
161166
from line 175
170175
171176 If set, this service account is archived.
172177
178 format: date-time
179
173180 - `archived_by_actor_id: string or null`
174181
175182 Tagged ID (`user_`/`svac_`) of the actor that archived this service account.
from line 185
178185
179186 When this service account was created.
180187
188 format: date-time
189
181190 - `created_by_actor_id: string or null`
182191
183192 Tagged ID (`user_`/`svac_`) of the actor that created this service account.
from line 209
200209
201210 - `type: "service_account"`
202211
203 - `"service_account"`
212 default: service_account
204213
205214 - `updated_at: string`
206215
207216 When this service account was last updated.
208217
218 format: date-time
219
209220 - `updated_by_actor_id: string or null`
210221
211222 Tagged ID (`user_`/`svac_`) of the actor that last updated this service account.
from line 223
212223
213224### Example
214225
215```http
226```bash
216227curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID \
217228 -H 'anthropic-version: 2023-06-01' \
218229 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
219230```
220231
221#### Response
232#### Response (200)
222233
223234```json
224235{
from line 249
238249
239250## List Service Accounts
240251
241**get** `/v1/organizations/service_accounts`
252**GET** `/v1/organizations/service_accounts`
242253
243254List service accounts in the caller's organization.
244255
from line 257
246257`next_page` cursor to paginate; set `include_archived=true` to include
247258archived service accounts.
248259
249### Query Parameters
260### Query parameters
250261
251262- `include_archived: optional boolean`
252263
253264 Include archived resources. Defaults to false.
254265
266 default: false
267
255268- `limit: optional number`
256269
257270 Number of results per page.
258271
272 default: 20, maximum: 100, minimum: 1
273
259274- `page: optional string`
260275
261276 Opaque cursor from a previous response's `next_page`.
262277
263### Header Parameters
278### Headers
264279
265280- `"anthropic-beta": optional array of string`
266281
from line 295
280295
281296 If set, this service account is archived.
282297
298 format: date-time
299
283300 - `archived_by_actor_id: string or null`
284301
285302 Tagged ID (`user_`/`svac_`) of the actor that archived this service account.
from line 305
288305
289306 When this service account was created.
290307
308 format: date-time
309
291310 - `created_by_actor_id: string or null`
292311
293312 Tagged ID (`user_`/`svac_`) of the actor that created this service account.
from line 329
310329
311330 - `type: "service_account"`
312331
313 - `"service_account"`
332 default: service_account
314333
315334 - `updated_at: string`
316335
317336 When this service account was last updated.
318337
338 format: date-time
339
319340 - `updated_by_actor_id: string or null`
320341
321342 Tagged ID (`user_`/`svac_`) of the actor that last updated this service account.
from line 347
326347
327348### Example
328349
329```http
350```bash
330351curl https://api.anthropic.com/v1/organizations/service_accounts \
331352 -H 'anthropic-version: 2023-06-01' \
332353 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
333354```
334355
335#### Response
356#### Response (200)
336357
337358```json
338359{
from line 378
357378
358379## Update Service Account
359380
360**post** `/v1/organizations/service_accounts/{service_account_id}`
381**POST** `/v1/organizations/service_accounts/{service_account_id}`
361382
362383Update a service account.
363384
from line 388
367388interactive credential (a user OAuth token or a Console session). Admin
368389API keys are not accepted.
369390
370### Path Parameters
391### Path parameters
371392
372393- `service_account_id: string`
373394
374395 ID of the service account to update.
375396
376### Header Parameters
397### Headers
377398
378399- `"anthropic-beta": optional array of string`
379400
from line 402
381402
382403 To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
383404
384### Body Parameters
405### Body parameters
385406
386407- `description: optional string or null`
387408
388409 Replaces the description. Omit to leave unchanged; send `null` to clear (the field is stored as an empty string).
389410
411 maxLength: 2000
412
390413- `organization_role: optional "admin" or "developer" or null`
391414
392415 Replaces the org-level role. Omit or send `null` to leave unchanged.
from line 420
397420
398421### Returns
399422
400- `ServiceAccount object { id, archived_at, archived_by_actor_id, 8 more }`
423- `ServiceAccount object`
401424
402425 Named non-human identity within the caller's organization.
403426
from line 435
412435
413436 If set, this service account is archived.
414437
438 format: date-time
439
415440 - `archived_by_actor_id: string or null`
416441
417442 Tagged ID (`user_`/`svac_`) of the actor that archived this service account.
from line 445
420445
421446 When this service account was created.
422447
448 format: date-time
449
423450 - `created_by_actor_id: string or null`
424451
425452 Tagged ID (`user_`/`svac_`) of the actor that created this service account.
from line 469
442469
443470 - `type: "service_account"`
444471
445 - `"service_account"`
472 default: service_account
446473
447474 - `updated_at: string`
448475
449476 When this service account was last updated.
450477
478 format: date-time
479
451480 - `updated_by_actor_id: string or null`
452481
453482 Tagged ID (`user_`/`svac_`) of the actor that last updated this service account.
from line 483
454483
455484### Example
456485
457```http
486```bash
458487curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID \
459488 -H 'Content-Type: application/json' \
460489 -H 'anthropic-version: 2023-06-01' \
from line 491
462491 -d '{}'
463492```
464493
465#### Response
494#### Response (200)
466495
467496```json
468497{
from line 511
482511
483512## Archive Service Account
484513
485**post** `/v1/organizations/service_accounts/{service_account_id}/archive`
514**POST** `/v1/organizations/service_accounts/{service_account_id}/archive`
486515
487516Archive a service account.
488517
from line 523
494523Requires an OAuth bearer or Console session; Admin API keys are not
495524accepted.
496525
497### Path Parameters
526### Path parameters
498527
499528- `service_account_id: string`
500529
501530 ID of the service account to archive.
502531
503### Header Parameters
532### Headers
504533
505534- `"anthropic-beta": optional array of string`
506535
from line 539
510539
511540### Returns
512541
513- `ServiceAccount object { id, archived_at, archived_by_actor_id, 8 more }`
542- `ServiceAccount object`
514543
515544 Named non-human identity within the caller's organization.
516545
from line 554
525554
526555 If set, this service account is archived.
527556
557 format: date-time
558
528559 - `archived_by_actor_id: string or null`
529560
530561 Tagged ID (`user_`/`svac_`) of the actor that archived this service account.
from line 564
533564
534565 When this service account was created.
535566
567 format: date-time
568
536569 - `created_by_actor_id: string or null`
537570
538571 Tagged ID (`user_`/`svac_`) of the actor that created this service account.
from line 588
555588
556589 - `type: "service_account"`
557590
558 - `"service_account"`
591 default: service_account
559592
560593 - `updated_at: string`
561594
562595 When this service account was last updated.
563596
597 format: date-time
598
564599 - `updated_by_actor_id: string or null`
565600
566601 Tagged ID (`user_`/`svac_`) of the actor that last updated this service account.
from line 602
567602
568603### Example
569604
570```http
605```bash
571606curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/archive \
572607 -X POST \
573608 -H 'anthropic-version: 2023-06-01' \
from line 609
574609 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
575610```
576611
577#### Response
612#### Response (200)
578613
579614```json
580615{
from line 627
592627}
593628```
594629
595## Domain Types
630## Domain types
596631
597632### Service Account
598633
599- `ServiceAccount object { id, archived_at, archived_by_actor_id, 8 more }`
634- `ServiceAccount object`
600635
601636 Named non-human identity within the caller's organization.
602637
from line 646
611646
612647 If set, this service account is archived.
613648
649 format: date-time
650
614651 - `archived_by_actor_id: string or null`
615652
616653 Tagged ID (`user_`/`svac_`) of the actor that archived this service account.
from line 656
619656
620657 When this service account was created.
621658
659 format: date-time
660
622661 - `created_by_actor_id: string or null`
623662
624663 Tagged ID (`user_`/`svac_`) of the actor that created this service account.
from line 680
641680
642681 - `type: "service_account"`
643682
644 - `"service_account"`
683 default: service_account
645684
646685 - `updated_at: string`
647686
648687 When this service account was last updated.
649688
689 format: date-time
690
650691 - `updated_by_actor_id: string or null`
651692
652693 Tagged ID (`user_`/`svac_`) of the actor that last updated this service account.
653694
654# Workspaces
695## Service Accounts › Workspaces
655696
656## Add Workspace To Service Account
697### Add Workspace To Service Account
657698
658**post** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
699**POST** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
659700
660701Add a service account to a workspace with the given `workspace_role`.
661702
from line 708
667708rejected. Requires an OAuth bearer or Console session; Admin API keys
668709are not accepted.
669710
670### Path Parameters
711#### Path parameters
671712
672713- `service_account_id: string`
673714
674715 ID of the service account.
675716
676### Header Parameters
717#### Headers
677718
678719- `"anthropic-beta": optional array of string`
679720
from line 722
681722
682723 To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
683724
684### Body Parameters
725#### Body parameters
685726
686727- `workspace_id: string`
687728
from line 740
699740
700741 - `"workspace_user"`
701742
702### Returns
743#### Returns
703744
704745- `created_by_actor_id: string or null`
705746
from line 756
715756
716757- `type: "service_account_workspace_member"`
717758
718 - `"service_account_workspace_member"`
759 default: service_account_workspace_member
719760
720761- `workspace_id: string`
721762
from line 776
735776
736777 - `"workspace_user"`
737778
738### Example
779#### Example
739780
740```http
781```bash
741782curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces \
742783 -H 'Content-Type: application/json' \
743784 -H 'anthropic-version: 2023-06-01' \
from line 789
748789 }'
749790```
750791
751#### Response
792##### Response (200)
752793
753794```json
754795{
from line 802
761802}
762803```
763804
764## List Workspaces For Service Account
805### List Workspaces For Service Account
765806
766**get** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
807**GET** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
767808
768809List the workspaces a service account is a member of.
769810
from line 818
777818the service account is active; an archived service account returns an
778819empty list.
779820
780### Path Parameters
821#### Path parameters
781822
782823- `service_account_id: string`
783824
784825 ID of the service account.
785826
786### Query Parameters
827#### Query parameters
787828
788829- `limit: optional number`
789830
790831 Number of results per page.
791832
833 default: 20, maximum: 100, minimum: 1
834
792835- `page: optional string`
793836
794837 Opaque cursor from a previous response's `next_page`.
795838
796### Header Parameters
839#### Headers
797840
798841- `"anthropic-beta": optional array of string`
799842
from line 844
801844
802845 To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
803846
804### Returns
847#### Returns
805848
806- `data: array of object { created_by_actor_id, implicit, service_account_id, 3 more }`
849- `data: array of object`
807850
808851 - `created_by_actor_id: string or null`
809852
from line 862
819862
820863 - `type: "service_account_workspace_member"`
821864
822 - `"service_account_workspace_member"`
865 default: service_account_workspace_member
823866
824867 - `workspace_id: string`
825868
from line 886
843886
844887 Opaque cursor for the next page, or null if no more results.
845888
846### Example
889#### Example
847890
848```http
891```bash
849892curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces \
850893 -H 'anthropic-version: 2023-06-01' \
851894 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
852895```
853896
854#### Response
897##### Response (200)
855898
856899```json
857900{
from line 912
869912}
870913```
871914
872## Remove Workspace From Service Account
915### Remove Workspace From Service Account
873916
874**delete** `/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}`
917**DELETE** `/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}`
875918
876919Remove a service account from a workspace.
877920
from line 927
884927400. Requires an OAuth bearer or Console session; Admin API keys are not
885928accepted.
886929
887### Path Parameters
930#### Path parameters
888931
889932- `service_account_id: string`
890933
from line 937
894937
895938 ID of the workspace.
896939
897### Header Parameters
940#### Headers
898941
899942- `"anthropic-beta": optional array of string`
900943
from line 945
902945
903946 To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
904947
905### Returns
948#### Returns
906949
907950- `service_account_id: string`
908951
from line 953
910953
911954- `type: "service_account_workspace_member_deleted"`
912955
913 - `"service_account_workspace_member_deleted"`
956 default: service_account_workspace_member_deleted
914957
915958- `workspace_id: string`
916959
917960 Tagged workspace ID (`wrkspc_...`) named in the delete request.
918961
919### Example
962#### Example
920963
921```http
964```bash
922965curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces/$WORKSPACE_ID \
923966 -X DELETE \
924967 -H 'anthropic-version: 2023-06-01' \
from line 968
925968 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
926969```
927970
928#### Response
971##### Response (200)
929972
930973```json
931974{
from line 977
934977 "workspace_id": "workspace_id"
935978}
936979```
937
938## Domain Types
939
940### Workspace Create Response
941
942- `WorkspaceCreateResponse object { created_by_actor_id, implicit, service_account_id, 3 more }`
943
944 - `created_by_actor_id: string or null`
945
946 Tagged ID (`user_...`/`svac_...`) of the actor who created this membership.
947
948 - `implicit: boolean or null`
949
950 True when this is the implicit default-workspace membership every service account has when no explicit membership exists. Implicit memberships have role workspace_user and cannot be removed.
951
952 - `service_account_id: string`
953
954 Tagged service account ID (`svac_...`).
955
956 - `type: "service_account_workspace_member"`
957
958 - `"service_account_workspace_member"`
959
960 - `workspace_id: string`
961
962 Tagged workspace ID (`wrkspc_...`).
963
964 - `workspace_role: "workspace_admin" or "workspace_billing" or "workspace_developer" or 2 more`
965
966 Role of the service account in this workspace. Service accounts cannot hold the `workspace_billing` role.
967
968 - `"workspace_admin"`
969
970 - `"workspace_billing"`
971
972 - `"workspace_developer"`
973
974 - `"workspace_restricted_developer"`
975
976 - `"workspace_user"`
977
978### Workspace List Response
979
980- `WorkspaceListResponse object { created_by_actor_id, implicit, service_account_id, 3 more }`
981
982 - `created_by_actor_id: string or null`
983
984 Tagged ID (`user_...`/`svac_...`) of the actor who created this membership.
985
986 - `implicit: boolean or null`
987
988 True when this is the implicit default-workspace membership every service account has when no explicit membership exists. Implicit memberships have role workspace_user and cannot be removed.
989
990 - `service_account_id: string`
991
992 Tagged service account ID (`svac_...`).
993
994 - `type: "service_account_workspace_member"`
995
996 - `"service_account_workspace_member"`
997
998 - `workspace_id: string`
999
1000 Tagged workspace ID (`wrkspc_...`).
1001
1002 - `workspace_role: "workspace_admin" or "workspace_billing" or "workspace_developer" or 2 more`
1003
1004 Role of the service account in this workspace. Service accounts cannot hold the `workspace_billing` role.
1005
1006 - `"workspace_admin"`
1007
1008 - `"workspace_billing"`
1009
1010 - `"workspace_developer"`
1011
1012 - `"workspace_restricted_developer"`
1013
1014 - `"workspace_user"`
1015
1016### Workspace Delete Response
1017
1018- `WorkspaceDeleteResponse object { service_account_id, type, workspace_id }`
1019
1020 - `service_account_id: string`
1021
1022 Tagged service account ID (`svac_...`) named in the delete request. Removal is idempotent; see the endpoint description for the implicit-membership no-op.
1023
1024 - `type: "service_account_workspace_member_deleted"`
1025
1026 - `"service_account_workspace_member_deleted"`
1027
1028 - `workspace_id: string`
1029
1030 Tagged workspace ID (`wrkspc_...`) named in the delete request.
1031980
No line in this hunk matches that.