SPB Git

Repository Public

create.md 10.2 KB 358 lines markdown

1---2title: Create User Profile3url: https://platform.claude.com/docs/en/api/beta/user_profiles/create4---56# Create User Profile78**POST** `/v1/user_profiles`910Create User Profile1112## Headers1314- `"anthropic-beta": optional array of AnthropicBeta`1516  Optional header to specify the beta version(s) you want to use.1718  - `string`1920  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`2122    - `"message-batches-2024-09-24"`2324    - `"prompt-caching-2024-07-31"`2526    - `"computer-use-2024-10-22"`2728    - `"computer-use-2025-01-24"`2930    - `"pdfs-2024-09-25"`3132    - `"token-counting-2024-11-01"`3334    - `"token-efficient-tools-2025-02-19"`3536    - `"output-128k-2025-02-19"`3738    - `"files-api-2025-04-14"`3940    - `"mcp-client-2025-04-04"`4142    - `"mcp-client-2025-11-20"`4344    - `"dev-full-thinking-2025-05-14"`4546    - `"interleaved-thinking-2025-05-14"`4748    - `"code-execution-2025-05-22"`4950    - `"extended-cache-ttl-2025-04-11"`5152    - `"context-1m-2025-08-07"`5354    - `"context-management-2025-06-27"`5556    - `"model-context-window-exceeded-2025-08-26"`5758    - `"skills-2025-10-02"`5960    - `"fast-mode-2026-02-01"`6162    - `"output-300k-2026-03-24"`6364    - `"user-profiles-2026-03-24"`6566    - `"user-profiles-2026-08-18"`6768    - `"user-profiles-2026-09-04"`6970    - `"advisor-tool-2026-03-01"`7172    - `"managed-agents-2026-04-01"`7374    - `"cache-diagnosis-2026-04-07"`7576    - `"dreaming-2026-04-21"`7778    - `"thinking-token-count-2026-05-13"`7980    - `"server-side-fallback-2026-06-01"`8182    - `"server-side-fallback-2026-07-01"`8384    - `"fallback-credit-2026-06-01"`8586    - `"fallback-credit-2026-07-01"`8788    - `"agent-memory-2026-07-22"`8990    - `"mid-conversation-tool-changes-2026-07-01"`9192    - `"compact-2026-01-12"`9394    - `"computer-use-2025-11-24"`9596    - `"mcp-tunnels-2026-06-22"`9798    - `"structured-outputs-2025-11-13"`99100    - `"task-budgets-2026-03-13"`101102    - `"thinking-display-updates-2026-08-18"`103104    - `"ce-user-management-2026-07-13"`105106    - `"mid-conversation-output-config-2026-07-01"`107108    - `"thinking-binding-controls-2026-08-01"`109110    - `"mid-conversation-system-clear-at-2026-08-21"`111112    - `"compact-2026-09-04"`113114- `"anthropic-workspace-id": optional string`115116## Body parameters117118- `access_type: optional "application" or "passthrough"`119120  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.121122  - `"application"`123124  - `"passthrough"`125126- `external_id: optional string or null`127128  Platform's own identifier for this user. Not enforced unique. Maximum 255 characters. Accepted under the `user-profiles-2026-03-24` and `user-profiles-2026-08-18` beta headers; under `user-profiles-2026-09-04` send `external_user_details.reference_id` instead.129130  minLength: 1, maxLength: 255131132- `external_user_details: optional BetaUserProfileExternalUserDetailsParams`133134  Details about the entity this profile represents, as the platform states them. Every field is optional. Accepted under the `user-profiles-2026-09-04` beta header only.135136  - `account_status: optional "active" or "suspended" or "blocked" or null`137138    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 in `trust_grants` are Anthropic's and do not follow it.139140    - `"active"`141142    - `"suspended"`143144    - `"blocked"`145146  - `country: optional string or null`147148    The country of the entity (not of the platform), as the platform determines it: an ISO 3166-1 alpha-2 code in upper case, for example `US`. Only the form, two uppercase ASCII letters, is checked.149150  - `email_hash: optional string or null`151152    A hash of the entity's email address, computed by the platform. Anthropic treats it as an opaque string and does not prescribe the hash function. 1 to 255 characters.153154    minLength: 1, maxLength: 255155156  - `entity_type: optional "individual" or "business" or "non_profit" or "government" or null`157158    What kind of entity the profile represents, as the platform states it: `individual`, `business`, `non_profit` or `government`.159160    - `"individual"`161162    - `"business"`163164    - `"non_profit"`165166    - `"government"`167168  - `name_hash: optional string or null`169170    A hash of the entity's name, computed by the platform. Anthropic treats it as an opaque string and does not prescribe the hash function. 1 to 255 characters.171172    minLength: 1, maxLength: 255173174  - `onboarded_at: optional string`175176    A timestamp in RFC 3339 format177178    format: date-time179180  - `reference_id: optional string or null`181182    The platform's own reference for the entity, for example the key of the end-user's row in the platform's database. Not interpreted by Anthropic and not enforced unique. 1 to 255 characters.183184    minLength: 1, maxLength: 255185186- `external_user_onboarded_at: optional string`187188  A timestamp in RFC 3339 format189190  format: date-time191192- `metadata: optional map[string]`193194  Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings.195196- `name: optional string or null`197198  Optional for all profiles. Real-world name of the entity this profile represents (company or individual); for a company the platform resells Claude access to (`access_type` `passthrough`), that company's name where known. Maximum 255 characters.199200  minLength: 1, maxLength: 255201202## Returns203204- `BetaUserProfile object`205206  - `type: "user_profile"`207208    Object type. Always `user_profile`.209210  - `id: string`211212    Unique identifier for this user profile, prefixed `uprof_`.213214  - `created_at: string`215216    A timestamp in RFC 3339 format217218    format: date-time219220  - `metadata: map[string]`221222    Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.223224  - `trust_grants: map[BetaUserProfileTrustGrant]`225226    Trust grants for this profile, keyed by grant name. Key omitted when no grant is active or in flight.227228    - `status: "active" or "pending" or "rejected"`229230      Status of the trust grant.231232      - `"active"`233234      - `"pending"`235236      - `"rejected"`237238  - `updated_at: string`239240    A timestamp in RFC 3339 format241242    format: date-time243244  - `access_type: optional "application" or "passthrough"`245246    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.247248    - `"application"`249250    - `"passthrough"`251252  - `external_id: optional string or null`253254    Platform's own identifier for this user. Not enforced unique. Present under the `user-profiles-2026-03-24` and `user-profiles-2026-08-18` beta headers; under `user-profiles-2026-09-04` the value is `external_user_details.reference_id`.255256  - `external_user_details: optional BetaUserProfileExternalUserDetails`257258    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.259260    - `account_status: "active" or "suspended" or "blocked" or null`261262      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 in `trust_grants` are Anthropic's and do not follow it.263264      - `"active"`265266      - `"suspended"`267268      - `"blocked"`269270    - `country: string or null`271272      The country the platform associates with the entity, as an ISO 3166-1 alpha-2 code. `null` until the platform supplies one.273274    - `email_hash: string or null`275276      The platform-computed hash of the entity's email address. `null` until the platform supplies one.277278    - `entity_type: "individual" or "business" or "non_profit" or "government" or null`279280      What kind of entity the profile represents, as the platform states it: `individual`, `business`, `non_profit` or `government`.281282      - `"individual"`283284      - `"business"`285286      - `"non_profit"`287288      - `"government"`289290    - `name_hash: string or null`291292      The platform-computed hash of the entity's name. `null` until the platform supplies one.293294    - `onboarded_at: string or null`295296      A timestamp in RFC 3339 format297298      format: date-time299300    - `reference_id: string or null`301302      The platform's own reference for the entity. `null` until the platform supplies one.303304  - `external_user_onboarded_at: optional string or null`305306    A timestamp in RFC 3339 format307308    format: date-time309310  - `name: optional string or null`311312    Real-world name of the entity this profile represents (company or individual). For a company the platform resells Claude access to (`access_type` `passthrough`) this is that company's name.313314## Example315316```bash317curl https://api.anthropic.com/v1/user_profiles \318    -H 'Content-Type: application/json' \319    -H 'anthropic-version: 2023-06-01' \320    -H 'anthropic-beta: user-profiles-2026-08-18' \321    -H "X-Api-Key: $ANTHROPIC_API_KEY" \322    -d '{323          "external_id": "user_12345",324          "external_user_onboarded_at": "2024-11-02T08:15:00Z",325          "metadata": {}326        }'327```328329### Response (200)330331```json332{333  "id": "uprof_011CZkZCu8hGbp5mYRQgUmz9",334  "created_at": "2026-03-15T10:00:00Z",335  "metadata": {},336  "trust_grants": {337    "cyber": {338      "status": "active"339    }340  },341  "type": "user_profile",342  "updated_at": "2026-03-15T10:00:00Z",343  "access_type": "application",344  "external_id": "user_12345",345  "external_user_details": {346    "account_status": "active",347    "country": "country",348    "email_hash": "email_hash",349    "entity_type": "individual",350    "name_hash": "name_hash",351    "onboarded_at": "2019-12-27T18:11:19.117Z",352    "reference_id": "reference_id"353  },354  "external_user_onboarded_at": "2024-11-02T08:15:00Z",355  "name": "Example User"356}357```358
Files main
Menu

Theme