from line 1
1---
2title: Add Workspace To Service Account
3url: https://platform.claude.com/docs/en/api/admin/service_accounts/workspaces/create
4---
1# Add Workspace To Service Account
52
6## Add Workspace To Service Account
3**POST** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
74
8**post** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
9
105Add a service account to a workspace with the given `workspace_role`.
116
127Mirror of `POST /workspaces/{workspace_id}/service_accounts`, addressed
from line 12
1712rejected. Requires an OAuth bearer or Console session; Admin API keys
1813are not accepted.
1914
20### Path Parameters
15## Path parameters
2116
2217- `service_account_id: string`
2318
2419 ID of the service account.
2520
26### Header Parameters
21## Headers
2722
2823- `"anthropic-beta": optional array of string`
2924
from line 26
3126
3227 To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta.
3328
34### Body Parameters
29## Body parameters
3530
3631- `workspace_id: string`
3732
from line 44
4944
5045 - `"workspace_user"`
5146
52### Returns
47## Returns
5348
5449- `created_by_actor_id: string or null`
5550
from line 60
6560
6661- `type: "service_account_workspace_member"`
6762
68 - `"service_account_workspace_member"`
63 default: service_account_workspace_member
6964
7065- `workspace_id: string`
7166
from line 80
8580
8681 - `"workspace_user"`
8782
88### Example
83## Example
8984
90```http
85```bash
9186curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces \
9287 -H 'Content-Type: application/json' \
9388 -H 'anthropic-version: 2023-06-01' \
from line 93
9893 }'
9994```
10095
101#### Response
96### Response (200)
10297
10398```json
10499{
No line in this hunk matches that.