The whole hunk
from line 4, old and new numbered
/
lines
from line 4
44
55**POST** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
66
7**Requires an OAuth access token with the `org:admin` scope**, from `ant auth login --scope org:admin` or a workload identity federation rule; Admin API keys are not accepted. See [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
8
79Add a service account to a workspace with the given `workspace_role`.
810
911Mirror of `POST /workspaces/{workspace_id}/service_accounts`, addressed
from line 13
1113service account is already an explicit member of the workspace, its
1214`workspace_role` is replaced with the value supplied here. Archived
1315workspaces return 400. Archived service accounts cannot be added and are
14rejected. Requires an OAuth bearer or Console session; Admin API keys
15are not accepted.
16rejected.
1617
1718### Path parameters
1819
from line 89
8889curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces \
8990 -H 'Content-Type: application/json' \
9091 -H 'anthropic-version: 2023-06-01' \
91 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN" \
92 -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
9293 -d '{
9394 "workspace_id": "workspace_id",
9495 "workspace_role": "workspace_admin"
from line 113
112113
113114**GET** `/v1/organizations/service_accounts/{service_account_id}/workspaces`
114115
116**Requires an OAuth access token with the `org:admin` scope**, from `ant auth login --scope org:admin` or a workload identity federation rule; Admin API keys are not accepted. See [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
117
115118List the workspaces a service account is a member of.
116119
117120Each entry includes the service account's `workspace_role` in that
from line 124
121124the first page; with `limit=1` the first page may return up to 2 entries
122125(the implicit entry plus one explicit membership) so a pagination cursor
123126can be derived. Memberships are returned only while
124the service account is active; an archived service account returns an
125empty list.
127the service account is active. Without a `page` cursor, an archived
128service account returns an empty list. A `page` cursor that does not
129match an active membership returns a 400 invalid-request error. A cursor
130stops matching when the membership is removed, the workspace is deleted,
131or the service account is archived. Restart pagination from the first
132page to recover.
126133
127134### Path parameters
128135
from line 204
197204```bash
198205curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces \
199206 -H 'anthropic-version: 2023-06-01' \
200 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
207 -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN"
201208```
202209
203210#### Response (200)
from line 229
222229
223230**DELETE** `/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}`
224231
232**Requires an OAuth access token with the `org:admin` scope**, from `ant auth login --scope org:admin` or a workload identity federation rule; Admin API keys are not accepted. See [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
233
225234Remove a service account from a workspace.
226235
227236Mirror of `DELETE /workspaces/{workspace_id}/service_accounts/{service_account_id}`,
from line 239
230239implicit default-workspace membership returns 200 but is a no-op and the
231240membership persists; deleting an explicit default-workspace row reverts
232241to the implicit `workspace_user` membership. Archived workspaces return
233400. Requires an OAuth bearer or Console session; Admin API keys are not
234accepted.
242400.
235243
236244### Path parameters
237245
from line 279
271279curl https://api.anthropic.com/v1/organizations/service_accounts/$SERVICE_ACCOUNT_ID/workspaces/$WORKSPACE_ID \
272280 -X DELETE \
273281 -H 'anthropic-version: 2023-06-01' \
274 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
282 -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN"
275283```
276284
277285#### Response (200)