Claude Platform Docs

Manage linked customers

Check and manage linked customers: see their usage, unlink them or link them again, and move them to another organization or off their API key.

After customers link, you manage them from the Claude Console and from your back end. Each customer has a user profile in your organization, which you created to link them. Linking creates a connection, the record that ties the customer’s Claude organization to that profile.

Before you begin

  • The customer’s IDs: the user profile ID (uprof_…) and the connection_id (ocon_…) that you stored when you linked the customer.
  • To check a customer’s status or use the unlink endpoint: your app’s operator service account with an access token from Workload Identity Federation. The token must come from a federation rule with the workspace:developer scope, which is the default.
  • To unlink through auth.claude.com: your app’s client authentication. The samples read a client assertion from the file that the CLIENT_ASSERTION_FILE environment variable names, or you paste one in place of YOUR_CLIENT_ASSERTION_JWT. It’s a JWT for your app’s Expected audience.
  • To read usage from your back end: an Admin API credential.

View customers and usage

Open the User profiles page in the Console. Your app’s Overview tab also lists its linked customers. For each user profile, the User profiles page lists Requests, Tokens, and Your spend over the last 28 days. Click a profile to see its usage over the last 7, 28, or 90 days.

  • A profile with an active connection reads Linked, one whose connection has ended reads Unlinked, and one never linked reads Not linked. Only members with the Admin role see these statuses and Unlink.
  • Your spend is your own cost for the profile’s requests, before Anthropic applies any credits.
  • A request that the customer pays for adds to Requests and Tokens and adds nothing to Your spend.
  • The page doesn’t display what the customer paid or the customer’s rates.

The figures refresh about once an hour, and a request can take a few hours to appear.

Don’t use these figures to stop a customer’s usage at an amount that you choose. The customer’s own spend caps do that.

From your back end, call GET /v1/user_profiles/{id} with the customer’s user profile ID. Send your app’s client ID in oauth_app_id, and send the user-profiles-search-2026-08-30 beta header. Authenticate as your operator service account. The SDK doesn’t send oauth_app_id, so the sample calls the endpoint over HTTP.

In this sample, ANTHROPIC_AUTH_TOKEN holds the service account’s access token, which you get from your workload. Set the variable only where you run cURL: the SDK and CLI would use it in place of federation.

cURL
curl "https://api.anthropic.com/v1/user_profiles/uprof_01HV9Z?oauth_app_id=clid_01ABcDeFgHiJkLmNoPqRsTuV" \
  -H "authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2026-10-21" \
  -H "anthropic-beta: user-profiles-search-2026-08-30"

In the response, connection_status.type describes the profile’s connection to your app:

connection_status.typeIn the ConsoleMeaning
connectedLinkedA connection to your app is active
disconnectedUnlinkedThe profile was linked, and its connections have ended
not_connectedNot linkedThe profile has never been linked to your app

A connected status doesn’t promise that a request bills the customer. On every request that bills a customer, handle both 403 codes and the two 402 billing errors.

For a disconnected profile, these fields say more. The reasons listed are examples:

FieldWhat it says
last_revoked_atWhen the last connection ended
last_revoked_reason.typeWhy. revoked_by_admin: a member of the customer’s organization with the Admin or Billing role unlinked your app. revoked_by_app_owner: your organization or your back end unlinked the customer.

For any status, oauth_connections.data lists the profile’s connections to your app, up to 100, with truncated set when the list might be incomplete.

In the Console, you can unlink a customer in two places:

  • Your app’s Overview tab: Under Linked customers, Unlink in the customer’s row menu ends their connection to that app only.
  • The User profiles page: Unlink is in a profile’s row menu and at the top right of its page. It ends the profile’s connections to all of your apps, test apps included.

From your back end, send a revocation request to auth.claude.com with your app’s client authentication and one of these:

  • connection_id: Ends that one connection. Use it when you have it.
  • user_profile_id: Sent in place of connection_id, it ends every connection of your app on that profile. That includes one the customer made after you stored your IDs.
import os
from pathlib import Path

import httpx2  # comes with the Anthropic SDK

# The connection ID that you stored when you linked the customer
connection_id = "ocon_01HV9Z"

assertion_file = Path(os.environ["CLIENT_ASSERTION_FILE"])

response = httpx2.post(
    "https://auth.claude.com/v1/oauth/revoke",
    json={
        "connection_id": connection_id,
        "client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV",
        "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
        "client_assertion": assertion_file.read_text().strip(),
    },
    timeout=10,
)
if not response.is_success:
    raise RuntimeError(f"Revoke failed: {response.status_code} {response.text}")

print(response.json()["revoked_connection_ids"])

The response’s revoked_connection_ids lists the connections that the request ended. An empty list means that it found none to end: usually the connection had already ended, or the ID was unknown. This means that you can safely repeat a request that sends connection_id. To confirm, check whether the customer is linked. To unlink through the Claude API instead, see If you unlink through the Claude API.

After you unlink, these things happen:

  • The profile shows as Unlinked. Unlinking doesn’t delete it.
  • The connection’s OAuth tokens stop working, so you can delete them from your secret store.
  • New requests that bill the customer typically stop within about 10 seconds, whoever unlinked. Requests that are already running finish and are billed to the customer.
  • A request that bills the customer gets 403 user_profile_billing_not_authorized. One sent with the customer’s access token can get a 401 authentication_error instead.
  • Anthropic emails the customer’s Admin and Billing members when you unlink from your back end by either route. It doesn’t email them when you unlink in the Console. See which emails your customers get.

You can still serve the customer at your own cost with bill_to: "self". Tell the customer yourself whenever you unlink them, because Anthropic doesn’t guarantee that an email is sent or delivered.

If the customer’s connection has ended (Unlinked), send them to approve again with their existing user profile. There’s nothing to unlink, and a new profile would split their usage history.

While the connection is active, what you do depends on whether it has a refresh token, which it has if the customer approved offline_access:

  • The connection has no refresh token: Don’t unlink. Send them to approve again with the same scope, which gives you a new access token. If an access token leaked, unlink the customer first, because approving again doesn’t revoke it.
  • The connection has a refresh token, even one that you lost: Unlink the customer, then have them approve again, as the following steps describe.

When a customer’s connection has a refresh token, link the customer again in these cases:

  • A refresh returned invalid_grant, or a failed refresh made you stop refreshing the customer. First, rule out a suspension and a cause on your side.
  • You lost a refresh token, a refresh token leaked, or you lost the code exchange’s response.
  • The refresh token is close to its 1-year expiry.
  • You changed the operator service account, and you use this customer’s OAuth tokens.

Billing through the connection stops from the unlink until your new code exchange succeeds. First, agree on a time with a person who has the Admin or Billing role in the customer’s organization. Then:

  1. If the profile shows as Linked, unlink the customer.
  2. Send the customer to approve again with their existing user profile and the same scope, which includes offline_access.
  3. Store the new connection_id and the new OAuth tokens in place of the earlier ones. The profile then shows as Linked again.

Move a customer to another organization

To bill a customer through a different Claude organization of theirs, unlink them and link them again. Until you unlink, the approval page offers only the organization that’s already linked. From the unlink until you exchange the code of an approval for the other organization, requests that bill the customer are refused.

Start when a person with the Admin or Billing role in the other organization is ready to approve. Then:

  1. Unless the customer has already unlinked your app on their Linked platforms page, unlink the customer.
  2. Send them to approve again with the same user profile and scope, and have the person approve for the other organization.
  3. Store the new connection_id in place of the earlier one, and store the new OAuth tokens if you use them. The profile then shows as Linked again, through the other organization.

The first organization’s spend cap for your app doesn’t carry over. For the cap that applies to the other organization, see Spend caps in What your customers see.

Move a customer from their API key to Linked billing

Before you move a customer off their own API key, weigh two costs:

  • You pay for what can’t bill a customer: Message Batches, Claude Managed Agents, and billable code execution.
  • The requests run in your organization: Your rate limits and data terms apply. The customer’s zero data retention, business associate agreement (BAA), customer-managed encryption keys (CMEK), and IP allowlist don’t. See Whose terms and limits apply.

To move a customer:

  1. Link the customer, and store their connection_id.
  2. Instead of their key, bill their requests as your operator service account, and set bill_to: "user_profile" in billing_policy.
  3. Delete the stored API key, and tell the customer that you did.

Their requests then add to their profile’s Requests on your User profiles page. They add nothing to Your spend.

A customer can unlink your app at any time on their Linked platforms page, and Anthropic doesn’t tell you. Decide when your product finds out:

Checking more often shows an unlink sooner, at the cost of more requests.

Implementation details, rules, and special cases

The rest of this page covers the API details behind these tasks. It also covers special cases, such as a failed unlink.

You can unlink through the Claude API’s unlink endpoint instead: send your app’s client ID in oauth_app_id to POST /v1/user_profiles/{id}/unlink. It ends the same connections as a revocation request with user_profile_id.

DetailRevocation requestUnlink endpoint
Hostauth.claude.comapi.anthropic.com
AuthenticationYour app’s client authenticationYour operator service account
Beta headerNoneuser-profiles-search-2026-08-30
What it endsOne connection or every connection of your app on a profileEvery connection of your app on a profile

In this sample, ANTHROPIC_AUTH_TOKEN holds your operator service account’s access token, as in Check whether a customer is linked.

cURL
curl https://api.anthropic.com/v1/user_profiles/uprof_01HV9Z/unlink \
  -H "authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2026-10-21" \
  -H "anthropic-beta: user-profiles-search-2026-08-30" \
  -H "content-type: application/json" \
  -d '{"oauth_app_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV"}'

The response has revoked_connection_ids, which is empty if no connection was active.

A 503 from the unlink endpoint means that it might have ended only some of the connections. Send a revocation request for each connection_id that you had stored before the request that failed. That works at any time. It ends what’s left and doesn’t touch a connection the customer made since.

Repeating the unlink with backoff also works within a day of the first request, but it ends a connection the customer made since, too. After a day, a repeat can return a 200 with an empty list. That later repeat also doesn’t revoke what’s left of the connections that the failed request ended, so they can keep OAuth tokens or billing access.

StatusStatus checkUnlink endpoint
400oauth_app_id isn’t in the form of a client ID, or the beta header is missingoauth_app_id is missing or isn’t in the form of a client ID
401The credential is missing or invalid, or its federation rule doesn’t grant workspace:developerThe same
403The caller isn’t the operator service account of the app in oauth_app_id, or it uses a token of that account that’s limited to one sessionThe same
404The user profile doesn’t existThe user profile doesn’t exist, or the beta header is missing
503Retry with backoffSee If the unlink endpoint returns a 503

The revocation request’s own errors are in Errors from the revocation endpoint.

If you read usage from your back end

The Usage and Cost Analytics API reports usage for each user profile. Like the Console, it counts both the requests that you pay for and those that your customer pays for.

Call it with an Admin API credential, such as an OAuth access token with the org:admin scope or an Admin API key. Don’t use your operator service account: its federation rule grants workspace:developer by default, not org:admin. Don’t add org:admin to it, because that scope covers the whole Admin API.

To get one row for each user profile, call the usage endpoint or the cost endpoint. Group by user_profile_id alone, and leave out time_bucket_width. Only a profile with usage in the time range gets a row. A row with a null user_profile_id holds usage that named no profile, and usage that’s metered outside requests, such as code execution container time.

On the cost endpoint, you can tell who paid from two fields:

FieldA request you pay forA request your customer pays for
amountIts cost, the same measure as Your spend0
list_amountIts list priceIts list price

The API has no field or filter for who paid. A row whose amount is 0 and whose list_amount is above 0 usually means that the customer paid for all of it. For how late the data can be, see Data freshness.

For agents

  • Treat a connection_status of null or a type that you don’t recognize as unknown.
  • Treat a last_revoked_reason.type that you don’t recognize as other.

Next steps

Add test users, publish your app, and change or delete it

Was this page helpful?