attribute-requests changedmanage-claude/user-profiles/attribute-requests
Nearest release: v2.1.333, published 4 hours after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
## Before you begin ## Decide who gets a user profile ## Create a user profile for each end customer ### What to tell Anthropic about an end customer ### Send the create request ### Register an existing customer base ## Attribute each request ### Identify one person within a company ## Rules and special cases ### If a workspace has a user profile attached ### If a request returns a `400` ### If you send a batch
The whole hunk
404 lines, new pageA whole new page. There's nothing to diff it against, so here is what it says.
---
title: Create user profiles and attribute requests
url: https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests
description: Create a user profile for each end customer and send its ID on every request for them. A safety restriction or ban can then apply to that one end customer.
---
User profiles tell Anthropic which of your end customers each API request is for. That way, a safety enforcement action, such as a restriction or a ban, can apply to one end customer instead of your whole organization. If you aren’t sure that you need user profiles, see [How user profiles work](https://platform.claude.com/docs/en/manage-claude/user-profiles/how-user-profiles-work).
If you write the code that serves your end customers, you create a user profile for each one with `POST /v1/user_profiles`. You keep the opaque `uprof_` ID it returns and send it on every request you make for them.
If you use Claude through a cloud platform, that platform determines which organization holds your user profiles and how you send their IDs. Read [Use user profiles on a cloud platform](https://platform.claude.com/docs/en/manage-claude/user-profiles/platforms) before you create your first user profile.
## Before you begin
You need the following:
* **An organization for end-customer traffic:** Keep it separate from the one for your own usage. Separate workspaces in the same organization aren’t enough. Only the organization for end-customer traffic needs user profiles. To create another organization on the Claude API, see “How to create a new organization” in [Create and manage Workspaces in the Claude Console](https://support.claude.com/en/articles/9796807).
* **Credentials for that organization:** To create and manage user profiles, use a [workload identity federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation) or OAuth token with the `workspace:developer` scope, or an API key. A workload identity federation token is a short-lived Anthropic token that you get in exchange for one from your own identity provider. If the credential belongs to a person, they need the developer, admin, or owner role in the organization, because a workspace role isn’t enough. If it belongs to a service account, the developer or admin role in the organization or the workspace works. To send user profile IDs, any credential from that organization that can call the Messages API works. You don’t need an Admin API key.
* **On a Microsoft Foundry deployment hosted on Anthropic, a linked organization:** Anthropic has to link the organization that holds your Foundry resource to the one that holds your user profiles. Until then, your Foundry requests can’t carry user profile IDs. See [If you use Microsoft Foundry](https://platform.claude.com/docs/en/manage-claude/user-profiles/platforms#microsoft-foundry).
## Decide who gets a user profile
Each end customer gets one user profile, so a company gets a single one rather than one for each person in it. Send its ID on every request you make for anyone at the company. To also tell Anthropic which person a request comes from, see [Identify one person within a company](https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests#identify-individual-users-within-a-company).
The `access_type` you set depends on whether the end customer uses your product or buys API access from you, such as through your gateway:
| The end customer | `access_type` |
| ----- | ----- |
| Uses your product | `application` (the default, set when you leave `access_type` out) |
| Is a company that buys API access from you | `passthrough` (not the default, so you have to send it) |
Your own usage doesn’t need a user profile.
Don’t create a user profile for a workspace. A user profile belongs to your whole organization, so its ID works on requests through any workspace in the organization. The exception is [a workspace that has a different user profile attached](https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests#if-a-workspace-has-a-profile-attached). You can’t replace or remove that attachment.
## Create a user profile for each end customer
Create one user profile for each end customer before the first request that you send with its ID. Onboarding is a common place to do it. Because `POST /v1/user_profiles` isn’t idempotent, every call creates a new user profile, even when `reference_id` (your own ID for the end customer) matches an existing one. Store the ID it returns and reuse it.
If you already have end customers without user profiles, see the [guidance on registering an existing customer base](https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests#register-existing-end-customers) later in this section.
### What to tell Anthropic about an end customer
Every field is optional, except that an end customer who buys API access from you needs `access_type` set to `passthrough`. Besides `access_type`, you can send `name`, `metadata`, and these fields in `external_user_details`: `entity_type`, `country`, `reference_id`, `onboarded_at`, `account_status`, `name_hash`, and `email_hash`. For each field’s type, format, and length limit, see the [Create a user profile](https://platform.claude.com/docs/en/api/user_profiles/create) reference.
Follow these rules as you fill them in:
* **Names:** If you send `name`, use the end customer’s real-world name. For a company, that’s its legal name, if you know it.
* **Names you can’t share:** Leave out `name` and send `external_user_details.name_hash` instead.
* **Email addresses:** Send `external_user_details.email_hash`, because a user profile has no field for the address itself.
* **Hashes:** Compute the hashes yourself with a function you choose. They let Anthropic see which of your user profiles share a name or email address. Because only values computed the same way match, use the same function for every user profile and handle case and whitespace the same way.
* **Country:** `country` is the end customer’s country, not yours.
* **Your own ID:** `reference_id` takes your own stable identifier for the end customer, and it doesn’t have to be unique.
* **Health information:** Don’t include protected health information (PHI) in a user profile, because the user profiles API [isn’t a HIPAA-eligible service](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#feature-eligibility).
For more, see [What a user profile contains and how Anthropic uses it](https://platform.claude.com/docs/en/manage-claude/user-profiles/how-user-profiles-work#what-a-profile-contains-and-how-anthropic-uses-it).
<Warning>
If you don’t know a value, leave it out instead of sending a placeholder. You can replace a value in `external_user_details` later, but you can’t clear it.
</Warning>
### Send the create request
The cURL samples on this page send an access token from `ANTHROPIC_AUTH_TOKEN`, such as a [workload identity federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#authenticate-from-your-workload) token. Set that variable only in the shell where you run them, because it takes precedence over federation environment variables and federation profiles.
This example creates a user profile for a company that buys API access from you, so it sets `access_type` to `passthrough`. For an `application` user profile, leave `access_type` out.
<CodeGroup>
```bash cURL
curl https://api.anthropic.com/v1/user_profiles \
-H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
-H "anthropic-version: 2026-10-21" \
-H "content-type: application/json" \
-d '{
"name": "Acme Analytics, Inc.",
"access_type": "passthrough",
"external_user_details": {
"reference_id": "cust-8f2a1c",
"country": "US"
}
}'
```
```bash CLI
ant user-profiles create \
--name "Acme Analytics, Inc." \
--access-type passthrough \
--external-user-details '{reference_id: cust-8f2a1c, country: US}'
```
```python Python
client = anthropic.Anthropic()
profile = client.user_profiles.create(
name="Acme Analytics, Inc.",
access_type="passthrough",
external_user_details={"reference_id": "cust-8f2a1c", "country": "US"},
)
print(profile.id)
```
```typescript TypeScript
const client = new Anthropic();
const profile = await client.userProfiles.create({
name: "Acme Analytics, Inc.",
access_type: "passthrough",
external_user_details: { reference_id: "cust-8f2a1c", country: "US" }
});
console.log(profile.id);
```
```csharp C#
AnthropicClient client = new();
var profile = await client.UserProfiles.Create(new()
{
Name = "Acme Analytics, Inc.",
AccessType = UserProfileAccessType.Passthrough,
ExternalUserDetails = new()
{
ReferenceID = "cust-8f2a1c",
Country = "US"
}
});
Console.WriteLine(profile.ID);
```
```go Go
client := anthropic.NewClient()
profile, err := client.UserProfiles.New(context.Background(), anthropic.UserProfileNewParams{
Name: anthropic.String("Acme Analytics, Inc."),
AccessType: anthropic.UserProfileAccessTypePassthrough,
ExternalUserDetails: anthropic.UserProfileExternalUserDetailsParams{
ReferenceID: anthropic.String("cust-8f2a1c"),
Country: anthropic.String("US"),
},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(profile.ID)
```
```java Java
import com.anthropic.models.userprofiles.UserProfileAccessType;
import com.anthropic.models.userprofiles.UserProfileCreateParams;
import com.anthropic.models.userprofiles.UserProfileExternalUserDetailsParams;
void main() {
AnthropicClient client = AnthropicOkHttpClient.fromEnv();
var params = UserProfileCreateParams.builder()
.name("Acme Analytics, Inc.")
.accessType(UserProfileAccessType.PASSTHROUGH)
.externalUserDetails(UserProfileExternalUserDetailsParams.builder()
.referenceId("cust-8f2a1c")
.country("US")
.build())
.build();
var profile = client.userProfiles().create(params);
IO.println(profile.id());
// ...
}
```
```php PHP
$client = new Client();
$profile = $client->userProfiles->create(
name: 'Acme Analytics, Inc.',
accessType: 'passthrough',
externalUserDetails: ['referenceID' => 'cust-8f2a1c', 'country' => 'US'],
);
echo $profile->id, PHP_EOL;
```
```ruby Ruby
client = Anthropic::Client.new
profile = client.user_profiles.create(
name: "Acme Analytics, Inc.",
access_type: :passthrough,
external_user_details: { reference_id: "cust-8f2a1c", country: "US" }
)
puts profile.id
```
</CodeGroup>
You get the new user profile back, abridged here:
```json
{
"type": "user_profile",
"id": "uprof_011CZkZCu8hGbp5mYRQgUmz9",
"name": "Acme Analytics, Inc.",
"access_type": "passthrough",
"external_user_details": {
"reference_id": "cust-8f2a1c",
"onboarded_at": null,
"account_status": null,
"entity_type": null,
"country": "US",
"name_hash": null,
"email_hash": null
},
"metadata": {},
"programs": {
"cyber": null
},
"enforcement_status": "unrestricted",
"enforcement_actions": [],
"created_at": "2026-03-15T10:00:00Z",
"updated_at": "2026-03-15T10:00:00Z"
}
```
Store the `id` on your customer record and have your service instances read it from there, rather than each creating its own user profile. It’s also the ID you use to retrieve, update, or delete the user profile later.
Anthropic sets the following fields itself, so leave them out of your request:
* `programs`: The end customer’s status in each Anthropic program, such as the Cyber Verification Program. Attribution doesn’t use this field. For what its values mean, see [which programs apply to a user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles-verification-portal#after-the-end-customer-links-the-profile).
* `enforcement_status` and `enforcement_actions`: Restrictions or bans that Anthropic has open on the end customer. See [Check whether Anthropic has restricted or banned a user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles/manage-profiles#check-whether-anthropic-has-restricted-or-banned-a-profile).
### Register an existing customer base
An organization can hold any number of user profiles, but creating them is rate limited. Before you register an existing customer base in bulk, contact your Anthropic account team.
## Attribute each request
Send the user profile’s `uprof_` ID, not your own ID for the end customer, in the `anthropic-user-profile-id` header on every request you make for them. The SDK and the [`ant` CLI](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/quickstart) add the header for you when you set `user_profile_id` (java: `.userProfileId()`; php: `userProfileID`; csharp, go: `UserProfileID`; cli: `--user-profile-id`).
<CodeGroup>
```bash cURL
curl https://api.anthropic.com/v1/messages \
-H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
-H "anthropic-version: 2026-10-21" \
-H "anthropic-user-profile-id: $PROFILE_ID" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, Claude"}
]
}'
```
```bash CLI
ant messages create \
--model claude-opus-5-5 \
--max-tokens 1024 \
--message '{role: user, content: "Hello, Claude"}' \
--user-profile-id "$PROFILE_ID"
```
```python Python
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude"}],
user_profile_id=profile_id,
)
print(message)
```
```typescript TypeScript
const client = new Anthropic();
const message = await client.messages.create({
model: "claude-opus-5-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Claude" }],
user_profile_id: profileId
});
console.log(message);
```
```csharp C#
AnthropicClient client = new();
var parameters = new MessageCreateParams
{
Model = Model.ClaudeOpus5_5,
MaxTokens = 1024,
Messages = [new UserMessageParam { Content = "Hello, Claude" }],
UserProfileID = profileId
};
Cut at 300 lines. The page has the rest.
No line in this hunk matches that.