Claude Platform Docs

Perfis de usuário

Criar perfil de usuário
client.UserProfiles.New(ctx, params) (*UserProfile, error)
POST/v1/user_profiles
Listar perfis de usuário
client.UserProfiles.List(ctx, params) (*PageCursor[UserProfile], error)
GET/v1/user_profiles
Obter perfil de usuário
client.UserProfiles.Get(ctx, userProfileID, query) (*UserProfile, error)
GET/v1/user_profiles/{user_profile_id}
Atualizar perfil de usuário
client.UserProfiles.Update(ctx, userProfileID, params) (*UserProfile, error)
POST/v1/user_profiles/{user_profile_id}
Excluir perfil de usuário
client.UserProfiles.Delete(ctx, userProfileID, body) (*DeletedUserProfile, error)
DELETE/v1/user_profiles/{user_profile_id}
Models
type DeletedUserProfile struct { Type: "user_profile_deleted"; ID }
Type UserProfileDeleted

Object type. Always user_profile_deleted.

ID string

Identifier of the deleted user profile, prefixed uprof_.

type UserProfile struct { Type: "user_profile"; ID; AccessType; /* 8 more */ }

A record of an entity that the platform serves through the API, such as an end-user of the platform's product or a company that the platform resells Claude access to.

A Messages, Message Batches or token counting request can send a profile's id in the anthropic-user-profile-id header to attribute the request to that entity.

type UserProfileAccessType string

How the platform uses the API on behalf of the entity this profile represents. application: the platform sells a product that uses the API behind the scenes, and the profile represents an individual end-user of that product. passthrough: the platform resells raw inference, and the profile identifies the resold-to company.

One of the following:
const UserProfileAccessTypeApplication UserProfileAccessType = "application"

The user profile represents an individual end-user of a product that the platform builds on the API. New profiles get this value by default.

const UserProfileAccessTypePassthrough UserProfileAccessType = "passthrough"

The user profile represents a company that the platform resells Claude access to.

type UserProfileBillingNotAuthorizedErrorDetails struct { ErrorCode }
ErrorCode UserProfileBillingNotAuthorizedErrorCode
type UserProfileCyberProgram struct { Requirements; Status; Tiers }

A user profile's standing in the Cyber Verification Program, which relaxes cyber safeguards for requests that name the profile.

type UserProfileCyberRequirements struct { DataRetention; HumanReview }

What a request that names the profile must allow to get the relaxed safeguards of the profile's active tiers. A field reads true when at least one of those tiers has the requirement and Anthropic has not waived it on that tier for the profile. A request that does not meet a requirement is still served, without the relaxed safeguards of the tiers that have it. The values differ between profiles and can change, so read them rather than assuming them.

DataRetention bool

Whether Anthropic must be able to retain the request's inference data.

HumanReview bool

Whether Anthropic personnel must be allowed to review the data retained from the request.

type UserProfileCyberTier struct { Status }

One tier of the Cyber Verification Program.

Status UserProfileCyberTierStatus

active when the tier applies to the profile, otherwise inactive. The response does not say why a tier is inactive: it can be in review, declined, withdrawn, never applied for, or approved but not applied to this profile.

One of the following:
const UserProfileCyberTierStatusActive UserProfileCyberTierStatus = "active"
const UserProfileCyberTierStatusInactive UserProfileCyberTierStatus = "inactive"
type UserProfileEfsFeature struct { Status }

One feature of Enterprise Frontier Safeguards.

Status UserProfileEfsFeatureStatus

active when Anthropic has approved the entity the profile represents to use the feature, otherwise inactive. active does not mean that the feature is set up or switched on, which is a separate step.

One of the following:
const UserProfileEfsFeatureStatusActive UserProfileEfsFeatureStatus = "active"
const UserProfileEfsFeatureStatusInactive UserProfileEfsFeatureStatus = "inactive"
type UserProfileEfsProgram struct { Features; Status }

A user profile's standing in Enterprise Frontier Safeguards, a program under which Anthropic approves the entity the profile represents and may approve any of the program's features.

Features map[string]UserProfileEfsFeature

The program's features, keyed by feature: data_retention_exemption (use of models that normally require data retention, without the data being retained), cmek (customer-managed encryption keys) and storage (customer-owned storage). Every feature that the caller's organization may read has a key, whether or not it is approved; a missing key does not mean that the feature is inactive. Anthropic may add features; ignore a key you do not recognize.

Status UserProfileEfsFeatureStatus

active when Anthropic has approved the entity the profile represents to use the feature, otherwise inactive. active does not mean that the feature is set up or switched on, which is a separate step.

One of the following:
const UserProfileEfsFeatureStatusActive UserProfileEfsFeatureStatus = "active"
const UserProfileEfsFeatureStatusInactive UserProfileEfsFeatureStatus = "inactive"

Anthropic's decision on the entity the profile represents: pending while it is awaited, active once Anthropic has approved the entity for the program, or rejected once Anthropic has declined or has removed the entity from the program. active does not mean that any one feature is approved: read the feature you need in features.

One of the following:
const UserProfileProgramStatusActive UserProfileProgramStatus = "active"

The profile is in the program.

const UserProfileProgramStatusPending UserProfileProgramStatus = "pending"

The profile is not in the program yet, and something is still awaited.

const UserProfileProgramStatusRejected UserProfileProgramStatus = "rejected"

The profile is not in the program and nothing is awaited: Anthropic has declined, or has withdrawn an earlier approval.

type UserProfileEnforcementActionUnion interface{…}

A limit Anthropic has placed on the entity this profile represents and not yet resolved, discriminated by type: restriction or ban. More types may be added; read a type you do not recognize as restriction.

One of the following:
type UserProfileEnforcementActionRestriction struct { Type: "restriction"; ID; Action; /* 3 more */ }

Anthropic has limited how it serves the end user until the action is resolved. The end user may still be served in part.

type UserProfileEnforcementActionBan struct { Type: "ban"; ID; Action; /* 3 more */ }

Anthropic has stopped serving the end user where the ban applies and does not plan to serve them there again.

type UserProfileEnforcementActionBan struct { Type: "ban"; ID; Action; /* 3 more */ }

Anthropic has stopped serving the end user where the ban applies and does not plan to serve them there again.

type UserProfileEnforcementActionNextStep string

The next step on this enforcement action: verify means the end user can clear the action by passing an identity check. More values may be added; read a value you do not recognize as null.

type UserProfileEnforcementActionReason string

Why Anthropic placed this enforcement action: unsupported_region, fraud_or_abuse, high_harm, usage_policy_violation, account_compromise or unspecified. More values may be added; read a value you do not recognize as unspecified.

One of the following:
const UserProfileEnforcementActionReasonUnsupportedRegion UserProfileEnforcementActionReason = "unsupported_region"
const UserProfileEnforcementActionReasonFraudOrAbuse UserProfileEnforcementActionReason = "fraud_or_abuse"
const UserProfileEnforcementActionReasonHighHarm UserProfileEnforcementActionReason = "high_harm"
const UserProfileEnforcementActionReasonUsagePolicyViolation UserProfileEnforcementActionReason = "usage_policy_violation"
const UserProfileEnforcementActionReasonAccountCompromise UserProfileEnforcementActionReason = "account_compromise"
const UserProfileEnforcementActionReasonUnspecified UserProfileEnforcementActionReason = "unspecified"
type UserProfileEnforcementActionRestriction struct { Type: "restriction"; ID; Action; /* 3 more */ }

Anthropic has limited how it serves the end user until the action is resolved. The end user may still be served in part.

type UserProfileEnforcementStatus string

Anthropic's enforcement status of this profile: unrestricted, pending, restricted or banned. More values may be added; read a value you do not recognize as restricted.

One of the following:
const UserProfileEnforcementStatusUnrestricted UserProfileEnforcementStatus = "unrestricted"
const UserProfileEnforcementStatusPending UserProfileEnforcementStatus = "pending"
const UserProfileEnforcementStatusRestricted UserProfileEnforcementStatus = "restricted"
const UserProfileEnforcementStatusBanned UserProfileEnforcementStatus = "banned"
type UserProfileExternalUserAccountStatus string

The status of the entity's account on the platform, as the platform states it: active; suspended, when the platform has restricted the account and may restore it; or blocked, when the platform has barred it. It records the platform's decision only. The statuses that Anthropic itself reports for the profile, such as its status in a program, are Anthropic's decisions and do not change with it.

One of the following:
const UserProfileExternalUserAccountStatusActive UserProfileExternalUserAccountStatus = "active"

The platform has neither restricted nor barred the account of the entity that the user profile represents.

const UserProfileExternalUserAccountStatusSuspended UserProfileExternalUserAccountStatus = "suspended"

The platform has restricted the account of the entity that the user profile represents and may restore it.

const UserProfileExternalUserAccountStatusBlocked UserProfileExternalUserAccountStatus = "blocked"

The platform has barred the account of the entity that the user profile represents.

type UserProfileExternalUserDetails struct { AccountStatus; Country; EmailHash; /* 4 more */ }

Details about the entity this profile represents, as the platform states them. Anthropic does not verify them. Every field is present, null until the platform supplies a value.

type UserProfileExternalUserDetailsParams struct { AccountStatus; Country; EmailHash; /* 4 more */ }
type UserProfileExternalUserEntityType string

What kind of entity the profile represents, as the platform states it: individual, business, non_profit or government.

One of the following:
const UserProfileExternalUserEntityTypeIndividual UserProfileExternalUserEntityType = "individual"
const UserProfileExternalUserEntityTypeBusiness UserProfileExternalUserEntityType = "business"
const UserProfileExternalUserEntityTypeNonProfit UserProfileExternalUserEntityType = "non_profit"
const UserProfileExternalUserEntityTypeGovernment UserProfileExternalUserEntityType = "government"
type UserProfileListOrder string

The direction that a list of user profiles is sorted in.

One of the following:
const UserProfileListOrderAsc UserProfileListOrder = "asc"

Oldest first when order_by is created_at, or names in ascending order when order_by is name.

const UserProfileListOrderDesc UserProfileListOrder = "desc"

Newest first when order_by is created_at, or names in descending order when order_by is name. This is the default.

type UserProfileListOrderBy string

Sort field for listing user profiles: created_at (default) or name (case-insensitive; profiles without a name sort last).

One of the following:
const UserProfileListOrderByCreatedAt UserProfileListOrderBy = "created_at"

Sort by when each user profile was created. This is the default.

const UserProfileListOrderByName UserProfileListOrderBy = "name"

Sort by name, ignoring the case of ASCII letters. Profiles without a name come last in either direction.

type UserProfileNotBillableErrorDetails struct { ErrorCode }
ErrorCode UserProfileNotBillableErrorCode
type UserProfileNotFoundErrorDetails struct { ErrorCode }
ErrorCode UserProfileNotFoundErrorCode
type UserProfileProgramStatus string

A user profile's status in a program. Each program's status field says what the values mean there.

One of the following:
const UserProfileProgramStatusActive UserProfileProgramStatus = "active"

The profile is in the program.

const UserProfileProgramStatusPending UserProfileProgramStatus = "pending"

The profile is not in the program yet, and something is still awaited.

const UserProfileProgramStatusRejected UserProfileProgramStatus = "rejected"

The profile is not in the program and nothing is awaited: Anthropic has declined, or has withdrawn an earlier approval.

type UserProfilePrograms struct { Cyber; Efs }

A user profile's standing in each program. A program is a set of capabilities or exemptions that Anthropic approves for the entity the profile represents. A program reads null when the profile has no status in it, when the caller's organization is not entitled to read programs, or when the response does not report that program. Retrieving the profile reports every program. Anthropic may add programs; ignore a key you do not recognize.

type UserProfileRequiredErrorDetails struct { ErrorCode }
ErrorCode UserProfileRequiredErrorCode
Errors
const ErrorCodeUserProfileNotFound ErrorCode = "user_profile_not_found"⁠HTTP status 400

The request depends on a user profile that does not exist in the organization or is no longer active. The request either names this user profile by ID, or names a resource, such as an External Key, that is bound to it.

const ErrorCodeUserProfileRequired ErrorCode = "user_profile_required"⁠HTTP status 400

The request sets billing_policy.bill_to to "user_profile" but names no user profile. Name the profile to bill in the anthropic-user-profile-id header.

const ErrorCodeUserProfileBillingNotAuthorized ErrorCode = "user_profile_billing_not_authorized"⁠HTTP status 403

The customer that the request's user profile represents has not authorized the caller to bill them, or the authorization that the request's credential uses has ended. The response does not say which applies.

const ErrorCodeUserProfileNotBillable ErrorCode = "user_profile_not_billable"⁠HTTP status 403

The request's user profile cannot be billed. The response gives no more specific error code and does not say what the reason is.

Perfis de usuárioURLs de ação

Criar URL de ação
client.UserProfiles.ActionURLs.New(ctx, userProfileID, params) (*UserProfileActionURL, error)
POST/v1/user_profiles/{user_profile_id}/action_urls