Claude Platform Docs

Service Accounts

Create Service Account
client.Beta.Organization.ServiceAccounts.New(ctx, params) (*BetaServiceAccount, error)
POST/v1/organizations/service_accounts
List Service Accounts
client.Beta.Organization.ServiceAccounts.List(ctx, params) (*PageCursor[BetaServiceAccount], error)
GET/v1/organizations/service_accounts
Get Service Account
client.Beta.Organization.ServiceAccounts.Get(ctx, serviceAccountID, query) (*BetaServiceAccount, error)
GET/v1/organizations/service_accounts/{service_account_id}
Update Service Account
client.Beta.Organization.ServiceAccounts.Update(ctx, serviceAccountID, params) (*BetaServiceAccount, error)
POST/v1/organizations/service_accounts/{service_account_id}
Archive Service Account
client.Beta.Organization.ServiceAccounts.Archive(ctx, serviceAccountID, body) (*BetaServiceAccount, error)
POST/v1/organizations/service_accounts/{service_account_id}/archive
Models
type BetaServiceAccount struct{…}

Named non-human identity within the caller's organization.

A service account is a pure identity: name + org. Authorization lives on whatever references it (federation rules).

ID string

Tagged ID of the service account.

ArchivedAt Time

If set, this service account is archived.

formatdate-time
ArchivedByActorID string

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

CreatedAt Time

When this service account was created.

formatdate-time
CreatedByActorID string

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

Description string

Optional free-text description.

Name string

Admin-chosen slug identifier.

OrganizationRole BetaServiceAccountOrganizationRole

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.

One of the following:
const BetaServiceAccountOrganizationRoleAdmin BetaServiceAccountOrganizationRole = "admin"
const BetaServiceAccountOrganizationRoleDeveloper BetaServiceAccountOrganizationRole = "developer"
Type ServiceAccount
defaultservice_account
UpdatedAt Time

When this service account was last updated.

formatdate-time
UpdatedByActorID string

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

type BetaServiceAccountWorkspaceMember struct{…}
CreatedByActorID string

Tagged ID (user_.../svac_...) of the actor who created this membership.

Implicit bool

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.

ServiceAccountID string

Tagged service account ID (svac_...).

Type ServiceAccountWorkspaceMember
defaultservice_account_workspace_member
WorkspaceID string

Tagged workspace ID (wrkspc_...).

WorkspaceRole BetaWorkspaceRole

Role of the service account in this workspace. Service accounts cannot hold the workspace_billing role.

One of the following:
const BetaWorkspaceRoleWorkspaceAdmin BetaWorkspaceRole = "workspace_admin"
const BetaWorkspaceRoleWorkspaceBilling BetaWorkspaceRole = "workspace_billing"
const BetaWorkspaceRoleWorkspaceDeveloper BetaWorkspaceRole = "workspace_developer"
const BetaWorkspaceRoleWorkspaceRestrictedDeveloper BetaWorkspaceRole = "workspace_restricted_developer"
const BetaWorkspaceRoleWorkspaceUser BetaWorkspaceRole = "workspace_user"

Service AccountsWorkspaces

Add Workspace To Service Account
client.Beta.Organization.ServiceAccounts.Workspaces.Add(ctx, serviceAccountID, params) (*BetaServiceAccountWorkspaceMember, error)
POST/v1/organizations/service_accounts/{service_account_id}/workspaces
List Workspaces For Service Account
client.Beta.Organization.ServiceAccounts.Workspaces.List(ctx, serviceAccountID, params) (*PageCursor[BetaServiceAccountWorkspaceMember], error)
GET/v1/organizations/service_accounts/{service_account_id}/workspaces
Remove Workspace From Service Account
client.Beta.Organization.ServiceAccounts.Workspaces.Remove(ctx, workspaceID, params) (*BetaOrganizationServiceAccountWorkspaceRemoveResponse, error)
DELETE/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}