Create Service Account

Changed on

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.

Create a service account.

A service account is a named workload identity that federation rules target. organization_role is developer (default) or admin; a rule may only be created or retargeted to grant org:admin scope when the target's organization_role is admin. Creating an admin-role service account requires an interactive credential (a user OAuth token or a Console session) — a workload may only create developer-role service accounts.

post/v1/organizations/service_accounts

Request

  • Base URL
    https://api.anthropic.com
  • Auth
    none declared

Headers

anthropic-versionstring

The version of the Claude API you want to use.

Read more about versioning and our version history here.

Request body

descriptionstring nullable

Optional free-text description.

namestring required

Slug identifier (lowercase, digits, hyphens). Unique within the organization; a duplicate name returns 409.

organization_role'admin' | 'developer'

Org-level role. Defaults to developer.

Example request

{
  "name": "ci-deploy-bot"
}

Response

Successful Response

archived_atstring date-time nullable required

If set, this service account is archived.

archived_by_actor_idstring nullable required

Tagged ID (user_/svac_) of the actor that archived this service account.

created_atstring date-time required

When this service account was created.

created_by_actor_idstring nullable required

Tagged ID (user_/svac_) of the actor that created this service account.

descriptionstring nullable required

Optional free-text description.

idstring required

Tagged ID of the service account.

namestring required

Admin-chosen slug identifier.

organization_role'admin' | 'developer' required

Org-level role. A federation rule may only be created or retargeted to grant org:admin scope when this is admin. A rule granting org:admin whose target is later demoted to developer is rejected at token exchange. Rules granting org:admin are managed in the Console.

type'service_account' required
updated_atstring date-time required

When this service account was last updated.

updated_by_actor_idstring nullable required

Tagged ID (user_/svac_) of the actor that last updated this service account.

Example response

{
  "created_at": "2024-10-30T23:58:27.427722Z",
  "id": "svac_01SDCCSbTxrXDpWc1phhtcfK",
  "name": "ci-deploy-bot",
  "updated_at": "2024-10-30T23:58:27.427722Z"
}

Changes