---
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).

In 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 a Developer 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. The credential also needs [the developer role or higher](https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests#which-role-a-credential-needs). A person needs it in the organization, because a workspace role isn’t enough. 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:** The organization that holds your Foundry resource has to be linked to the one that holds your user profiles. Until then, your Foundry requests can’t carry those 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 [Register an existing customer base](https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests#register-existing-end-customers).

### 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

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>
  <CodeGroupItem>
    This sample and others like it 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. The SDK and the CLI also read it, and it takes precedence over federation environment variables and federation profiles.

    ```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"
        }
      }'
    ```
  </CodeGroupItem>

  ```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 that the API reports, such as the Cyber Verification Program. Attribution doesn’t use this field. For what its values mean, see [a user profile’s program statuses](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
  };
  var message = await client.Messages.Create(parameters);

  Console.WriteLine(message);
  ```

  ```go Go
  client := anthropic.NewClient()

  message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeOpus5_5,
  	MaxTokens: 1024,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, Claude")),
  	},
  	UserProfileID: anthropic.String(profileID),
  })
  if err != nil {
  	log.Fatal(err)
  }

  fmt.Println(message)
  ```

  ```java Java
  import com.anthropic.models.messages.MessageCreateParams;
  import com.anthropic.models.messages.Model;

  void main() {
      AnthropicClient client = AnthropicOkHttpClient.fromEnv();

      var params = MessageCreateParams.builder()
          .model(Model.CLAUDE_OPUS_5_5)
          .maxTokens(1024L)
          .addUserMessage("Hello, Claude")
          .userProfileId(profileId)
          .build();
      var message = client.messages().create(params);

      IO.println(message);
  }
  ```

  ```php PHP
  $client = new Client();

  $message = $client->messages->create(
      maxTokens: 1024,
      messages: [['role' => 'user', 'content' => 'Hello, Claude']],
      model: Model::CLAUDE_OPUS_5_5,
      userProfileID: $profileId,
  );

  echo json_encode($message, JSON_PRETTY_PRINT), PHP_EOL;
  ```

  ```ruby Ruby
  client = Anthropic::Client.new

  message = client.messages.create(
    model: Anthropic::Model::CLAUDE_OPUS_5_5,
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello, Claude" }],
    user_profile_id: profile_id
  )

  puts message
  ```
</CodeGroup>

Send the header the same way on [token counting](https://platform.claude.com/docs/en/build-with-claude/token-counting), [Message Batches](https://platform.claude.com/docs/en/build-with-claude/batch-processing), and [OpenAI SDK compatibility](https://platform.claude.com/docs/en/cli-sdks-libraries/libraries/openai-sdk) requests. A batch’s header applies to every request in it, so put only one end customer’s requests in [each batch](https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests#if-you-send-a-batch).

On Amazon Bedrock, the ID goes in the request body instead, and only on the [models that accept a user profile ID](https://platform.claude.com/docs/en/manage-claude/user-profiles/platforms#amazon-bedrock-models). To find where the ID goes on each cloud platform, see [Use user profiles on a cloud platform](https://platform.claude.com/docs/en/manage-claude/user-profiles/platforms).

Here’s how the API handles the ID:

* **No ID:** Anthropic counts the request as your own usage.
* **A malformed or unrecognized ID:** The Claude API rejects the request with a `400`. See [If a request returns a `400`](https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests#if-a-request-returns-a-400).

To bill a user profile’s requests to that customer’s own Claude organization, see [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing).

### Identify one person within a company

A company’s user profile identifies the company, not the person a request comes from. If a request comes from one person you can identify, also set [`metadata.user_id`](https://platform.claude.com/docs/en/api/messages/create) on the Messages request to an identifier for them. That field sits in the request’s own `metadata` object, not in the user profile’s `metadata` field. The identifier is optional.

## Rules and special cases

### Which role a credential needs

These rules apply to a credential that creates or manages user profiles. If the credential belongs to a person, they need the developer, admin, owner, or primary owner role in the organization. If the credential belongs to a service account, the developer or admin role in the organization or the workspace works.

### If a workspace has a user profile attached

Once a workspace has a user profile attached, every inference request through it must carry that user profile’s ID. The API rejects a request with a different ID or none.

To [delete the user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles/manage-profiles#delete-a-profile), you first have to archive the workspace, and archiving can’t be undone. See [If the user profile is attached to a workspace](https://platform.claude.com/docs/en/manage-claude/user-profiles/manage-profiles#if-the-user-profile-is-attached-to-a-workspace).

You attach a user profile by setting `user_profile_id` in [Create Workspace](https://platform.claude.com/docs/en/api/organization/workspaces/create) or [Update Workspace](https://platform.claude.com/docs/en/api/organization/workspaces/update).

### If a request returns a `400`

The Claude API and Claude Platform on AWS check the ID on every request. So do Claude Models on Google Cloud (Anthropic managed) and Microsoft Foundry deployments [hosted on Anthropic](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#hosting-options). If the check fails, they return a `400` error of type `invalid_request_error`. The check can fail in cases such as these:

* The ID is malformed.
* Outside Microsoft Foundry, the request comes from one organization, and another organization created the user profile. This can happen even if both organizations are yours, such as one on the Claude API and one on Claude Platform on AWS. To avoid that, create the user profile and send its ID from the same organization.
* On a Microsoft Foundry deployment hosted on Anthropic, [the organization that holds your Foundry resource isn’t linked](https://platform.claude.com/docs/en/manage-claude/user-profiles/platforms#microsoft-foundry) to the one that created the user profile.

For Claude Models on Google Cloud (Google managed) and Amazon Bedrock, see [How each platform checks the ID](https://platform.claude.com/docs/en/manage-claude/user-profiles/platforms#how-each-platform-checks-the-id).

### If you send a batch

Unless the workspace has a [user profile attached](https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests#if-a-workspace-has-a-profile-attached), creating a message batch checks only the ID’s format. If a well-formed ID would fail the [rest of the check](https://platform.claude.com/docs/en/manage-claude/user-profiles/attribute-requests#if-a-request-returns-a-400), the batch is still created. Each request in it then fails with an `errored` result that contains an `invalid_request_error`.
