One read of Claude Developer Platformapi-20261124T223417Z
22 pages moved out of 964 read.
What this read moved
1-22 of 22about-claude/model-deprecations Changed · +1 / -7 lines
manage-claude/oauth-apps/app-review Page removed · 175 lines, page removed
## Before you begin ## Manage test users ### Add test users ### Link a test user’s organization ### Remove a test user ## Publish the app ### If you can’t prove the domain ### Domain rules ## The review ### If the app isn’t approved ## Change a live app ### When the Console asks you to prove a domain ### Until Anthropic approves the change ### When the review of the change ends ## Change an app that isn’t live ## Invoiced billing
The page is gone upstream. What it last said is kept here.
manage-claude/oauth-apps/branding-samples Page removed · 168 lines, page removed
## Copy the button’s HTML and CSS ## Colors ## Download the logo
The page is gone upstream. What it last said is kept here.
manage-claude/oauth-apps/endpoints-and-parameters New page · 297 lines, new page
## Endpoints ## Client authentication ### Client assertion claims ## Authorization requests ### Authorization request parameters ### Scopes ### Redirect URI rules ## OAuth tokens ### Token request and response ### OAuth tokens for a billing connection ### Lifetimes ### Revocation ## Protocol errors ### Errors on the redirect ### Errors from the PAR and token endpoints ### Errors from the revocation endpoint ### Billing errors ## Standards ## Terms used on these pages
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: OAuth endpoints and parameters
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters
description: The endpoints, parameters, scopes, OAuth tokens, lifetimes, and errors of Claude Platform OAuth, in the order a request uses them.
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
In request order, this page lists the values that [Claude Platform OAuth](https://platform.claude.com/docs/en/manage-claude/oauth-apps/overview) requests use and then the [terms used on these pages](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#terms).
## Endpoints
| Endpoint | URL |
| ----- | ----- |
| Authorization endpoint (the approval page) | `https://auth.claude.com/oauth/authorize` |
| Pushed authorization request (PAR) endpoint | `https://auth.claude.com/v1/oauth/par` |
| Token endpoint | `https://auth.claude.com/v1/oauth/token` |
| Revocation endpoint | `https://auth.claude.com/v1/oauth/revoke` |
| Claude API ([user profiles](https://platform.claude.com/docs/en/manage-claude/user-profiles) and requests that bill a customer) | `https://api.anthropic.com` |
## Client authentication
`auth.claude.com` authenticates your app with a variation of the `private_key_jwt` method ([RFC 7523](https://www.rfc-editor.org/rfc/rfc7523)). Your identity provider, not your app, issues and signs the client assertion. Its `iss` is your identity provider’s issuer. Its `aud` is your app’s configured audience, not your client ID or the full URL of the endpoint. `auth.claude.com` checks it against the keys registered for that issuer and your app’s settings.
Send these parameters in the body of every `POST` request to the PAR, token, and revocation endpoints.
| Parameter | Value |
| ----- | ----- |
| `client_id` | Your OAuth app’s client ID, required even with a client assertion |
| `client_assertion_type` | `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` |
| `client_assertion` | A JWT from your identity provider with the claims in [Client assertion claims](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-assertion-claims) |
These rules apply to each request:
* **Body:** It can be JSON or form-encoded (`application/x-www-form-urlencoded`). Set the `Content-Type` header to match.
* **Query string:** `auth.claude.com` rejects credentials in a URL query string.
* **HTTP Basic:** Don’t send an HTTP Basic `Authorization` header. `auth.claude.com` doesn’t read credentials from it, and the PAR endpoint can refuse a request that has one.
### Client assertion claims
A client assertion must contain these claims. The values to match are in your app’s [client authentication settings](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication).
| Claim | Requirement |
| ----- | ----- |
| `iss` | Your identity provider’s issuer URL, exactly as registered through [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation) |
| `sub` | Your back end’s subject. If your app’s settings have a subject pattern, the subject must match it. |
| `aud` | Exactly one audience: the value in your app’s settings, not the full URL of the endpoint you call |
| `iat` | The time your identity provider issued the JWT |
| `exp` | The expiry time, no more than your issuer’s [maximum lifetime](https://platform.claude.com/docs/en/manage-claude/wif-reference#jwt-verification) after `iat` (1 hour by default) |
A client assertion’s header and signature must also meet these rules:
* **Algorithm:** `RS256`, `RS384`, `RS512`, `ES256`, `ES384`, `ES512`, `PS256`, `PS384`, or `PS512`, the same list as in the [WIF reference](https://platform.claude.com/docs/en/manage-claude/wif-reference#jwt-verification). `auth.claude.com` rejects any other, including the HMAC algorithms (`HS256`, `HS384`, `HS512`) and `none`.
* **Key ID:** The header’s `kid` must name a key in your JWKS. If that key declares an `alg`, it must be the algorithm that signed the assertion.
* **Your JWKS:** Every signing key must have a `kid`. A key without one makes the whole set unusable.
An assertion’s payload looks like this. Its `aud` is your app’s own **Expected audience**, from the app’s **Client authentication** tab:
```json
{
"iss": "https://idp.example.com",
"sub": "workload:prod:claude-integration-backend",
"aud": "https://auth.claude.com",
"iat": 1791230000,
"exp": 1791230300
}
```
`auth.claude.com` accepts any JWT from your identity provider that matches your app’s subject pattern and claim conditions. To narrow them, see [Set up client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication).
## Authorization requests
To build the approval flow that uses these values, see [Send the customer to approve](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#send-them-to-approve).
### Authorization request parameters
Send these parameters and the ones in [Client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-authentication) to the PAR endpoint.
| Parameter | Description |
| ----- | ----- |
| `response_type` | The value `code` |
| `client_id` | Your OAuth app’s client ID |
| `redirect_uri` | A URI that exactly matches a registered redirect URI, up to 2,048 characters |
| `scope` | `billing:attribution` or `billing:attribution offline_access`. See [what each scope allows](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#scopes). |
| `state` | A random, single-use value, up to 2,048 characters, that you check on the callback |
| `code_challenge` | `BASE64URL(SHA256(code_verifier))` without padding, where the `code_verifier` is 43 to 128 characters |
| `code_challenge_method` | The value `S256` |
| `connection_type` | The value `organization_shared`. An administrator approves the connection for a whole organization. |
| `connection_auth_target` | The value `platform`. The connection’s requests route to the owner of the OAuth app. |
| `user_profile_id` | The ID of a user profile in your organization that represents the customer and that isn’t archived |
The PAR endpoint returns HTTP 201 with `request_uri` and `expires_in`. Then, send the person’s browser to the authorization endpoint with only these two parameters:
| Parameter | Value |
| ----- | ----- |
| `client_id` | Your OAuth app’s client ID |
| `request_uri` | The value that the PAR endpoint returned |
After the person approves, `auth.claude.com` redirects the browser to your `redirect_uri` with these query parameters:
| Parameter | Value |
| ----- | ----- |
| `code` | The authorization code to exchange at the token endpoint |
| `state` | The `state` value that you sent. Check that it matches. |
| `iss` | `https://identity.anthropic.com/users`, which differs from the endpoints’ host. Check that it’s present and matches. |
### Scopes
| Scope | Description |
| ----- | ----- |
| `billing:attribution` | A connection that lets you bill a customer’s Claude organization for the Claude API requests that the customer directs you to make. Send it alone or with `offline_access`. |
| `offline_access` | Also gives your app a refresh token. On a billing connection, send it only together with `billing:attribution`. |
| `org:billing_attribution` | Deprecated: use `billing:attribution`. See [If you still use the deprecated scope](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-still-use-the-deprecated-scope). |
### Redirect URI rules
* Each `redirect_uri` must exactly match a URI registered on your app. There’s no wildcard or prefix matching. The one exception is a local-development URI registered with an asterisk as the port, such as `http://localhost:*/callback`, which matches any port.
* Every redirect URI must use HTTPS and must not contain a fragment. Local-development URIs on `localhost`, `127.0.0.1`, or `[::1]` may use HTTP.
* You can register up to 10 redirect URIs for each app.
* `auth.claude.com` sends errors to your redirect URI only when the `redirect_uri` matches a registered URI. For any other `redirect_uri`, it doesn’t redirect the browser.
## OAuth tokens
### Token request and response
To exchange a code, send these parameters to the [token endpoint](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#endpoints):
| Parameter | Value |
| ----- | ----- |
| `grant_type` | `authorization_code` |
| `code` | The code from the callback |
| `redirect_uri` | The same `redirect_uri` that you sent in the authorization request |
| `code_verifier` | The PKCE code verifier |
| `client_id`, `client_assertion_type`, `client_assertion` | As in [Client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-authentication) |
To refresh, send `grant_type` set to `refresh_token`, the `refresh_token`, and the parameters in [Client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-authentication). Each refresh token works once, and a billing connection has rules of its own: see the next section and [If a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails).
### OAuth tokens for a billing connection
For a `billing:attribution` connection, a refresh must not send a `scope` parameter. Both grants return these fields:
| Response field | Value |
| ----- | ----- |
| `access_token` | The connection’s access token |
| `token_type` | `Bearer` |
| `expires_in` | Seconds until the access token expires, at most `3600` |
| `scope` | Always `workspace:inference`, not the scope that you asked for |
| `connection_id` | The connection ID, for example `ocon_01HV9Z`. Only the `authorization_code` grant returns it. |
| `refresh_token` | Returned only when the customer approved `offline_access`. A refresh returns a new one, which replaces the one you sent. |
| `refresh_token_expires_in` | Seconds until `refresh_token` expires. Absent when there’s no `refresh_token`. |
The access token authenticates as your app’s [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#terms), in the app’s [default workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#default-workspace), which the API calls its `connection_token_workspace_id` setting. On `/v1/messages` and `/v1/chat/completions`, a request with it is billed to that connection’s customer. It works only on the endpoints listed in [Call Claude with a customer’s access token](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#call-claude-with-a-token), and any other endpoint refuses it. How to use, refresh, and recover these tokens is in [Use a separate credential for each customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer).
Each of these events revokes a `billing:attribution` connection’s tokens, the current access token included:
* The customer or you unlink.
* The customer approves a new authorization request with different scopes for the same user profile, and you exchange its code. The new connection replaces the earlier one.
* The workspace that the tokens run in is archived.
* A refresh token that a refresh replaced is sent again more than 30 seconds later.
* You revoke one of the connection’s tokens at the [revocation endpoint](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#revocation).
### Lifetimes
| Item | Lifetime |
| ----- | ----- |
| `request_uri` from the PAR endpoint | 10 minutes, single use |
| Authorization code | 5 minutes, single use |
| `access_token` | Up to 1 hour |
| `refresh_token` | Up to 1 year from the code exchange. A refresh doesn’t extend it. |
Where a response gives `expires_in` or `refresh_token_expires_in`, read the lifetime from it rather than from this table.
### Revocation
Send revocation requests to the revocation endpoint, `https://auth.claude.com/v1/oauth/revoke`. Besides tokens, it accepts connection and user profile IDs. To unlink a customer or link them again, see [Manage linked customers](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers). Send the parameters in [Client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-authentication) and exactly one of these:
| Parameter | What it ends |
| ----- | ----- |
| `connection_id` | One of your app’s connections, given as an `ocon_` ID |
| `user_profile_id` | All of your app’s connections on one user profile, given as a `uprof_` ID |
| `token` | The connection that an access token or refresh token belongs to, and all of that connection’s tokens |
An access token from a connection approved with the deprecated `org:billing_attribution` scope is an exception: sending it ends only that token. To end that connection, send `connection_id` or `user_profile_id`.
`auth.claude.com` accepts `token_type_hint` and ignores it.
The endpoint returns HTTP 200 and the IDs of the connections that the request ended:
```json
{
"revoked_connection_ids": ["ocon_01HV9Z"]
}
```
The list is empty in any of these cases, and the response doesn’t say which:
* The token or ID is unknown or belongs to another app.
* The connection has already ended.
* The request ended a token but no connection.
After a connection ends, the Claude API refuses requests that bill that customer with `user_profile_billing_not_authorized`, and the connection’s tokens stop working. An access token from a connection approved with the deprecated scope might instead work until it expires.
## Protocol errors
### Errors on the redirect
`auth.claude.com` returns errors as `error`, `error_description`, `state`, and `iss` query parameters on your redirect URI. They are standard OAuth 2.0 errors ([RFC 6749](https://www.rfc-editor.org/rfc/rfc6749)), except `user_profile_already_linked`.
| Error | When |
| ----- | ----- |
| `access_denied` | The person declined or can’t approve this request. See [`access_denied`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#access-denied). |
| `server_error` | `auth.claude.com` failed to process the request. Ask the person to try again. |
| `user_profile_already_linked` | The customer’s organization is already linked to your app through a different user profile, or the user profile is already linked to your app through a different organization. See [`user_profile_already_linked`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-already-linked). |
If the `request_uri` has expired or was already used, `auth.claude.com` displays an error page and doesn’t redirect the browser. Start again with a new pushed authorization request.
### Errors from the PAR and token endpoints
These endpoints return a JSON body with `error` and `error_description`.
| Error | When |
| ----- | ----- |
| `invalid_request` | A required parameter is missing or invalid, such as a missing `state`, a missing PKCE challenge, or a `user_profile_id` that isn’t an active user profile in your organization |
| `invalid_client` | The client ID is unknown, or the client assertion failed a check in [Client assertion claims](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-assertion-claims). Your app’s **Client authentication history** in the Claude Console says which check failed. |
| `invalid_scope` | The scope isn’t allowed for this app, a refresh of a billing connection sent a `scope` parameter, or `billing:attribution` was removed from your app. In the last case, a code exchange also uses up the code. |
| `invalid_grant` | At the code exchange: the code expired or was already used, the person who approved has signed out, or the code doesn’t match the `redirect_uri` or `code_verifier`. A mismatch uses up the code. |
| `invalid_grant` | At the code exchange: the customer approved again with the same scopes while their connection has a refresh token. See [If a customer approves again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-a-customer-approves-again). |
| `invalid_grant` | On a refresh: see [If a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails) |
| `unauthorized_client` | Your app isn’t set up for this request. It uses up no code and revokes no refresh token. See [`unauthorized_client`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#code-exchange-unauthorized-client) or, for a refresh, [If a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails). |
| `user_profile_already_linked` | From the token endpoint: between the approval and the exchange, the profile or the organization was linked another way |
Some responses come in another format, which might not be JSON. That happens when `auth.claude.com` rate-limits a request or has an outage. It also happens for an unknown `grant_type` or a parameter that’s too long. Handle a response without a string `error` by its status, using the first row that fits:
| Status | What to do |
| ----- | ----- |
| Any status, on a refresh | Follow [If a refresh fails](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails). |
| `501` | Anthropic has turned the endpoint off. Don’t retry. |
| `429` or `5xx` | Retry with backoff, and wait at least as long as any `retry-after` header says. Send each retry from your own code: an HTTP client’s automatic retries might not run for such a response. |
| Any other status | Treat it as a fault in the request. |
### Errors from the revocation endpoint
For most refusals, the revocation endpoint returns HTTP 400 and a JSON body with `error` and `error_description`.
| Error | When |
| ----- | ----- |
| `invalid_request` | A parameter is missing or invalid: none or more than one of `token`, `connection_id`, and `user_profile_id`, a malformed ID, or a credential in the URL query string |
| `invalid_request` | The user profile has too many connections for one request. It might have ended some, so end the rest with each `connection_id`. |
| `invalid_client` | `auth.claude.com` couldn’t authenticate your app. Check your client assertion against [Client assertion claims](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-assertion-claims). Your app’s **Client authentication history** doesn’t record this endpoint. |
| `unauthorized_client` | Your app isn’t set up for this request. Contact [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support) or your Anthropic account team if you have one. |
Other refusals carry only a status, and their body might not be JSON. When such a body is JSON, its `error` is an object, not a string:
| Status | When | What to do |
| ----- | ----- | ----- |
| `400` | A parameter is longer than its limit | Correct the request. Don’t retry. |
| `429` | Too many failed requests came from your IP address | Retry with backoff. |
| `500` | `auth.claude.com` failed to process the request | Retry with backoff. If it keeps happening, contact support or your account team. |
| `501` | Anthropic has turned the endpoint off | Don’t retry. Contact support or your account team. |
| `503` | The request didn’t finish, and anything it ended stays ended | Retry with backoff. Use the same parameters and a new client assertion. |
A retry after a `503` finishes the rest, and its list leaves out connections that the earlier request ended. With `connection_id`, retry at any time. With `user_profile_id`, retry within a day. After a day, a retry still ends active connections. It doesn’t revoke what’s left of the connections that the failed request ended, such as their OAuth tokens. To revoke that, send each stored `connection_id`.
### Billing errors
The Claude API’s errors for requests that bill a customer or that use a customer’s access token are in [Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#while-billing).
## Standards
| Standard | Where it applies |
| ----- | ----- |
| [OAuth 2.0 (RFC 6749)](https://www.rfc-editor.org/rfc/rfc6749) | The authorization code flow, the token endpoint, and error responses |
| [PKCE (RFC 7636)](https://www.rfc-editor.org/rfc/rfc7636) | Required with `S256` on every authorization request |
| [Pushed authorization requests (RFC 9126)](https://www.rfc-editor.org/rfc/rfc9126) | Required for Linked billing |
| [Authorization server issuer identification (RFC 9207)](https://www.rfc-editor.org/rfc/rfc9207) | The `iss` parameter on every redirect to your app |
| [Token revocation (RFC 7009)](https://www.rfc-editor.org/rfc/rfc7009) | The revocation endpoint, which also takes connection and user profile IDs |
| [JWT client authentication (RFC 7523)](https://www.rfc-editor.org/rfc/rfc7523) | Client authentication at the PAR, token, and revocation endpoints |
## Terms used on these pages
These meanings apply only to Claude Platform OAuth.
| Term | Meaning |
| ----- | ----- |
| Claude organization | An organization account with Anthropic. Your company has one, and so does each customer that links its organization for billing. |
| Administrator | A member of a Claude organization with the Admin or Billing role |
| OAuth app | The registration in your Claude organization that identifies your product to `auth.claude.com`. It has a client ID, name, logo, homepage, and redirect URIs. |
| Identity provider | The service in your own infrastructure that signs short-lived JWTs for your back end and publishes its public keys as a JSON Web Key Set (JWKS). It’s never Anthropic. |
| Client assertion | A short-lived JWT that your identity provider signs and that your back end sends to authenticate your OAuth app |
| Pushed authorization request (PAR) | A request in which your back end sends the authorization parameters to `auth.claude.com` and gets a `request_uri` to use in the browser redirect |
| Workload Identity Federation | The Claude Console feature where your organization registers your identity provider so that Anthropic accepts JWTs signed with your keys |
| User profile | A record in your own Claude organization that stands for one of your customers |
| Connection | The record that ties a customer’s Claude organization to one of your user profiles, created when the customer links your app. Its ID starts with `ocon_`. |
| Service account | A non-human account in your Claude organization. Your app’s operator service account is the one your back end authenticates as to bill a customer. |
| Connection’s OAuth tokens | The access token that `auth.claude.com` returns for a connection and the refresh token it returns with `offline_access`. The access token can bill only that connection’s customer. |
manage-claude/oauth-apps/linked-billing New page · 182 lines, new page
## How it works ### How a connection starts and ends ### Choose who pays on each request ### When a request is refused ## When to use it ### Eligible customers ### Which credits can pay ### Which endpoints can bill a customer ## Whose terms and limits apply ## What you may bill ## Who supports the customer ## Rules and special cases ### If you use Message Batches ### If you use code execution ### If you count tokens ## Availability ### API support #### [Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) ### Required beta headers
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: Linked billing
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing
description: Learn who pays, which customers are eligible, and whose terms apply so that you can decide whether Linked billing fits your business.
featureMetadata:
status: beta
betaHeader: user-profiles-billing-2026-10-01
supportedModels:
- claude-fable-5-2
- claude-mythos-5-2
- claude-fable-5-1
- claude-mythos-5-1
- claude-fable-5
- claude-mythos-5
- claude-mythos-preview
- claude-opus-5-5
- claude-opus-5
- claude-sonnet-5-5
- claude-sonnet-5
- claude-haiku-5-5
- claude-haiku-4-5-20251001
- claude-opus-4-8
- claude-opus-4-7
- claude-opus-4-6
- claude-sonnet-4-6
- claude-opus-4-5-20251101
- claude-sonnet-4-5-20250929
supportedPlatforms:
Claude API:
availability: beta
note: Only requests that send `billing_policy` need the beta header.
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
Linked billing lets your customers pay for the Claude usage in your product through their own Claude organization. It’s a feature of [Claude Platform OAuth](https://platform.claude.com/docs/en/manage-claude/oauth-apps/overview), so it works through an [OAuth app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/overview#your-oauth-app) that you register for your product. A customer links their organization to your app once. After that, you choose on each Claude API request whether you or the customer pays.
## How it works
Suppose Acme uses your product and already pays Anthropic for its own Claude usage. You create a [user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles) for Acme: a record in your organization that stands for that customer. Someone at Acme clicks the [Link your Claude organization button](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button) in your product. On Claude’s approval page, they approve your app. Approving needs the Admin or Billing role in Acme’s Claude organization. They can also set a monthly [spend cap](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#spend-caps) for it.
From then on, your back end sends Acme’s Claude API requests as your app’s [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account), a non-human account in your Claude organization. Only that account can bill linked customers. A customer’s own OAuth access token counts as that account, so a request with it can bill that customer and no other. Your back end marks the requests that Acme pays for, and Anthropic bills those to Acme’s organization, not to yours, at Acme’s own rates. The [Linked Billing Beta Terms](https://www.anthropic.com/legal/linked-billing-terms) set out how customers are charged.
### How a connection starts and ends
Linking creates a connection, which ties the customer’s Claude organization to their user profile. The connection belongs to the customer’s organization, not to the person who approved it, so it stays if that person leaves. These are the usual ways a connection ends:
* The customer unlinks your app.
* An Admin of your organization unlinks the customer in the Claude Console.
* Your back end ends the connection through the API.
There are also [less common ways a connection ends](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#after-linking). Anthropic doesn’t tell you when a customer unlinks, so [check whether customers are still linked](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#check-a-links-status).
### Choose who pays on each request
Each request that your operator service account sends for a linked customer names their user profile in the `anthropic-user-profile-id` header. What’s in the request’s body decides who pays:
* **The customer pays** when the body’s [`billing_policy`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#bill-a-request) field sets `bill_to` to `user_profile`.
* **You pay** when `bill_to` is `self` or when the body has no `billing_policy`.
You can therefore bill some of a customer’s usage to them and pay for the rest yourself. A request sent with the customer’s own access token instead bills only that customer: see [Use a separate credential for each customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer).
### When a request is refused
If Anthropic can’t bill the customer for a request, the Claude API refuses the request. It never bills you instead. These are the usual causes:
* The customer reached the spend cap that they set for your app, or their organization reached its monthly spend limit.
* No credit on the customer’s account can pay for the request.
* The connection has ended.
You can send a refused request again as one that you pay for. For each refusal and its fix, see [Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors).
## When to use it
Linked billing fits a product whose users are mostly Claude Platform customers with their own Claude organization. To offer it, your own organization must pay Anthropic directly, through prepaid credits or invoiced billing.
Some requests can’t be billed to a customer. To serve them, send them as requests that you pay for:
* Requests for a customer whose organization [can’t be billed this way](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#eligible-customers)
* Requests to an [endpoint that can’t bill a customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#which-endpoints-can-bill-a-customer)
### Eligible customers
A customer can be billed this way only if their Claude organization pays Anthropic directly for its API usage, through prepaid credits or invoiced billing. These organizations can’t be billed this way:
* Organizations billed through a cloud marketplace (AWS, Google Cloud, or Azure)
* Organizations that have only a Claude subscription with no Claude API access of their own
An organization that has only a Claude subscription can’t link your app. An organization billed through a cloud marketplace is refused either when it tries to link or on every request that you bill to it. So a completed link doesn’t show that such an organization can be billed.
### Which credits can pay
Not all credit can pay for a request that an app bills to a customer. What can pay depends on the organization that’s billed:
* **When your app bills a customer:** the customer’s organization
* **When another company’s app bills you:** your own organization
Credit bought in the Claude Console for that organization can pay for these requests. If that organization has invoiced billing, it’s invoiced for these requests.
Some promotional credits from Anthropic can’t pay for these requests. These include the monthly API credits that come with Claude Max, Ultra, and Team plans. Credits from Anthropic’s partner, VC, and startup programs aren’t eligible to pay for these requests.
When nothing on that organization’s account can pay for a request, the Claude API can refuse it with a 402. The response doesn’t say whether a lack of credit or a spend limit caused the refusal. See [`linked_organization_spend_limit_reached`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#linked-organization-spend-limit-reached).
### Which endpoints can bill a customer
| Endpoint | Can bill a customer |
| ----- | ----- |
| The Messages API (`/v1/messages`) | Yes, except with [billable code execution](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#if-you-use-code-execution) |
| OpenAI SDK compatibility (`/v1/chat/completions`) | Yes |
| [Message Batches](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#if-you-use-message-batches) | No |
| Claude Managed Agents | No |
To ask for another endpoint, contact [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support).
## Whose terms and limits apply
<Warning>
Don’t offer Linked billing to a customer that needs HIPAA, FERPA, or customer-managed encryption key coverage for this usage.
</Warning>
Requests that you bill to a customer still run in your organization:
| Setting | Applies to these requests |
| ----- | ----- |
| Your rate limits, usage tier, model access, and [service tier](https://platform.claude.com/docs/en/api/service-tiers) | Yes |
| Your usage tier’s [monthly spend cap](https://platform.claude.com/docs/en/api/rate-limits#spend-limits) | Yes |
| Your data retention and encryption keys | Yes |
| The customer’s [zero data retention (ZDR)](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#zero-data-retention-zdr-scope), business associate agreement (BAA), customer-managed encryption keys (CMEK), and IP allowlist | No |
| The customer’s spend cap for your app and their organization’s monthly spend limit | Yes |
| The spend limits you set for your organization and its workspaces | No |
Once your organization reaches your usage tier’s monthly spend cap, the Claude API refuses all its requests, including ones that bill a customer: see [`enforced_spend_limit_reached`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#enforced-spend-limit-reached). Usage that you bill to a customer doesn’t count toward that cap.
## What you may bill
Bill a customer only for the usage that they direct you to make. That’s the Claude usage that the customer and their users cause in your product. Don’t bill them for your own usage, such as testing, evaluations, or work for other customers. The Claude API can’t check this for you, so it’s your responsibility. You accept the [Linked Billing Beta Terms](https://www.anthropic.com/legal/linked-billing-terms) when you create your app.
## Who supports the customer
You support your customers for everything about your app, including the Claude usage that you bill to them. Anthropic gives them only [the approval page and the Linked platforms page](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see) in their Claude Console. All other questions about your app come to you, so tell your customers how to reach you.
## Rules and special cases
Some features can’t bill a customer, and some treat `billing_policy` in their own way.
### If you use Message Batches
Send the requests in a [message batch](https://platform.claude.com/docs/en/build-with-claude/batch-processing) as ones that you pay for: with `bill_to` set to `self` or without `billing_policy`. They’re billed to you as usual. A request in a batch that’s marked for the customer is refused. Its result is `errored` with an `invalid_request_error`, and nobody is billed for it. The batch’s other requests run as usual.
### If you use code execution
A request that bills a customer can’t use [billable code execution features](https://platform.claude.com/docs/en/about-claude/pricing#code-execution-tool): the API refuses it with a 400. Send such requests as ones that you pay for.
### If you count tokens
The token counting endpoint (`/v1/messages/count_tokens`) accepts the `billing_policy` field when the request has the `user-profiles-billing-2026-10-01` beta header, and ignores the field. You don’t need to remove it before you count tokens.
## Availability
Linked billing is in beta on every model.
### API support
#### [Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages)
* Availability: Available
| Status | Cloud platforms |
| ----- | ----- |
| Beta<sup>1</sup> | Claude API |
1. Only requests that send `billing_policy` need the beta header.
### Required beta headers
[Beta headers overview](https://platform.claude.com/docs/en/api/beta-headers)
Beta headers allow you to access experimental features and new model capabilities before they become part of the standard API.
* `user-profiles-billing-2026-10-01`
manage-claude/oauth-apps/linked-billing/credential-for-each-customer New page · 2285 lines, new page
## Before you begin ## Keep the OAuth tokens secret ## Call Claude with a customer’s access token ## Refresh the OAuth tokens ## Run an agent in a sandbox ## Check the result ## Decide whether to turn off operator-only authentication ## Implementation details, rules, and special cases ### If a refresh fails ### Full refresh sample ### If an API key can reach the process ### When you write each new access token to a sandbox ### For agents ## Next steps
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: Use a separate credential for each customer
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer
description: Call Claude with each customer's own OAuth access token, so that code you don't fully control can bill only that customer.
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
Each customer you link with [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing) comes with their own credential: an OAuth access token that can bill only that customer. Use it when code that you don’t fully control calls Claude for one customer, for example in an agent’s sandbox or a single-tenant deployment. A bug or a leak in that code can then bill only that customer.
If every request that bills a customer comes from your own back end, you don’t need these credentials. [Bill customers as your operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#bill-a-request), and skip this page.
## Before you begin
* **The customer’s OAuth tokens and connection ID:** The code exchange returned them when you [linked the customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#save-the-connection-and-its-tokens). A connection is the record that ties the customer’s Claude organization to one of your [user profiles](https://platform.claude.com/docs/en/manage-claude/user-profiles).
* **A refresh token:** [**Offline access**](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#choose-whether-to-get-refresh-tokens) is on for your app, and the customer approved `billing:attribution offline_access`. A customer who approved without `offline_access` gets a refresh token by [approving again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-a-customer-approves-again), which replaces their connection without an unlink.
* **For the refresh samples:** A client assertion: a JWT from your identity provider for your app’s **Expected audience**, set up as your app’s [client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication). The samples read it from the file that the `CLIENT_ASSERTION_FILE` environment variable names or from the `CLIENT_ASSERTION` shell variable.
## Keep the OAuth tokens secret
Store each customer’s access token, refresh token, and their expiry times in a secret store that only the refreshing service can read. Anyone who holds an access token can bill that customer until the token expires. If a token leaks, [unlink the customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#unlink-a-customer) first, then link them again. If you lose a refresh token, [link the customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again).
## Call Claude with a customer’s access token
Send the customer’s access token in place of your operator service account’s credential:
* **In the Anthropic SDK:** Pass the customer’s access token as the client’s authentication token when you build the client.
* **In the `ant` CLI:** Set `ANTHROPIC_AUTH_TOKEN` to the token for the command.
* **In an HTTP request:** Send it as a bearer token in the `Authorization` header. Don’t send an `x-api-key` header.
<Warning>
Unset `ANTHROPIC_API_KEY` wherever you use a customer’s access token: some clients send the key instead, and Anthropic can bill you.
</Warning>
Those clients are the `ant` CLI and an SDK client that reads the token from `ANTHROPIC_AUTH_TOKEN`. For the reason and a guard against it, see [If an API key can reach the process](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-an-api-key-can-reach-the-process). If your lookup finds no token for the customer, stop before you build the client. Given a null token, the SDK might fall back to your own credential and bill you.
<CodeGroup>
```bash cURL
curl https://api.anthropic.com/v1/messages \
-H "authorization: Bearer $CUSTOMER_ACCESS_TOKEN" \
-H "anthropic-version: 2026-10-21" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, Claude"}]
}'
```
```bash CLI
ANTHROPIC_AUTH_TOKEN="$CUSTOMER_ACCESS_TOKEN" ant messages create \
--model claude-opus-5-5 \
--max-tokens 1024 \
--message '{role: user, content: "Hello, Claude"}'
```
```python Python
client = anthropic.Anthropic(auth_token=customer_access_token)
message = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude"}],
)
for block in message.content:
if block.type == "text":
print(block.text)
```
```typescript TypeScript
const client = new Anthropic({ authToken: customerAccessToken });
const message = await client.messages.create({
model: "claude-opus-5-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Claude" }]
});
for (const block of message.content) {
if (block.type === "text") {
console.log(block.text);
}
}
```
```csharp C#
AnthropicClient client = new() { AuthToken = customerAccessToken };
var message = await client.Messages.Create(
new MessageCreateParams
{
Model = Model.ClaudeOpus5_5,
MaxTokens = 1024,
Messages = [new UserMessageParam { Content = "Hello, Claude" }],
}
);
foreach (var block in message.Content)
{
if (block.TryPickText(out var textBlock))
{
Console.WriteLine(textBlock.Text);
}
}
```
```go Go
client := anthropic.NewClient(option.WithAuthToken(customerAccessToken))
message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
Model: anthropic.ModelClaudeOpus5_5,
MaxTokens: 1024,
Messages: []anthropic.MessageParam{
anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, Claude")),
},
})
if err != nil {
log.Fatal(err)
}
for _, block := range message.Content {
if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok {
fmt.Println(textBlock.Text)
}
}
```
```java Java
AnthropicClient client = AnthropicOkHttpClient.builder()
.authToken(customerAccessToken)
.build();
// ...
var params = MessageCreateParams.builder()
.model(Model.CLAUDE_OPUS_5_5)
.maxTokens(1024)
.addUserMessage("Hello, Claude")
.build();
var message = client.messages().create(params);
for (var block : message.content()) {
block.text().ifPresent(textBlock -> IO.println(textBlock.text()));
}
```
```php PHP
$client = new Client(authToken: $customerAccessToken);
$message = $client->messages->create(
maxTokens: 1024,
messages: [['role' => 'user', 'content' => 'Hello, Claude']],
model: Model::CLAUDE_OPUS_5_5,
);
foreach ($message->content as $block) {
if ($block instanceof \Anthropic\Messages\TextBlock) {
echo $block->text, PHP_EOL;
}
}
```
```ruby Ruby
client = Anthropic::Client.new(auth_token: customer_access_token)
message = client.messages.create(
model: Anthropic::Model::CLAUDE_OPUS_5_5,
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Claude" }]
)
message.content.each do |block|
puts(block.text) if block.is_a?(Anthropic::Models::TextBlock)
end
```
</CodeGroup>
A customer’s access token works on these endpoints only:
* `/v1/messages` and `/v1/chat/completions`
* `/v1/messages/count_tokens`
* the Models endpoints
On `/v1/messages` and `/v1/chat/completions`, the access token alone bills the customer. You don’t need the `anthropic-user-profile-id` header or [`billing_policy`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#bill-a-request).
Send every other request and every request that you pay for as your operator service account. That includes requests that use billable code execution, which [can’t bill a customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#if-you-use-code-execution).
Requests with the token run in the workspace that you set as your app’s default. Archiving it revokes every token in it: see [If you move to another workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-move-to-another-workspace). If a request with the token is refused, see [Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors).
## Refresh the OAuth tokens
A customer’s access token lasts at most 1 hour. Before it expires, send the customer’s refresh token to the token endpoint for a new pair of tokens. Each refresh token works once, apart from a single repeat within 30 seconds to recover an answer that you lost.
<Warning>
A refresh token sent again more than 30 seconds after its first use ends the customer’s connection, and you have to link them again.
</Warning>
To make sure that you never send a used token late:
* Turn off automatic retries for the refresh request in your HTTP client and in any proxy.
* Refresh each customer’s OAuth tokens from one service, one refresh at a time for each customer. If the service has replicas, give them a shared lock. Hold it from reading a customer’s stored tokens until the new ones are stored.
* Store the new refresh token before you use the new access token.
The request is a `refresh_token` grant to `auth.claude.com`. It carries the refresh token and your app’s [client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication): `client_id` and a client assertion. No SDK covers `auth.claude.com`, so the samples call it over HTTP. They show the plain call with no failure handling:
<CodeGroup exclude="shell:CLI">
```bash cURL
curl https://auth.claude.com/v1/oauth/token \
-H "content-type: application/json" \
-d @- <<JSON
{
"grant_type": "refresh_token",
"refresh_token": "$CUSTOMER_REFRESH_TOKEN",
"client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV",
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"client_assertion": "$CLIENT_ASSERTION"
}
JSON
```
<CodeGroupItem language="CLI">
The `ant` CLI has no command for `auth.claude.com`. Send the refresh with cURL or in your application’s language.
</CodeGroupItem>
```python Python
import os
from pathlib import Path
import httpx2 # comes with the Anthropic SDK
def refresh_tokens(refresh_token: str) -> dict:
assertion_file = Path(os.environ["CLIENT_ASSERTION_FILE"])
response = httpx2.post(
"https://auth.claude.com/v1/oauth/token",
json={
"grant_type": "refresh_token",
"refresh_token": refresh_token,
"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"Refresh failed: {response.status_code} {response.text}")
return response.json() # the new access_token and refresh_token
```
```typescript TypeScript
import { readFile } from "node:fs/promises";
async function refreshTokens(refreshToken: string) {
const jwt = await readFile(process.env.CLIENT_ASSERTION_FILE!, "utf8");
const response = await fetch("https://auth.claude.com/v1/oauth/token", {
method: "POST",
redirect: "error",
signal: AbortSignal.timeout(10_000),
headers: { "content-type": "application/json" },
body: JSON.stringify({
grant_type: "refresh_token",
refresh_token: refreshToken,
client_id: "clid_01ABcDeFgHiJkLmNoPqRsTuV",
client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
client_assertion: jwt.trim()
})
});
if (!response.ok) {
throw new Error(`Refresh failed: ${response.status} ${await response.text()}`);
}
return response.json(); // the new access_token and refresh_token
}
```
```csharp C#
using System.Net.Http.Json;
using System.Text.Json;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(10) };
async Task<JsonElement> RefreshTokens(string refreshToken)
{
var assertionFile = Environment.GetEnvironmentVariable("CLIENT_ASSERTION_FILE")!;
var jwt = await File.ReadAllTextAsync(assertionFile);
using var response = await http.PostAsJsonAsync(
"https://auth.claude.com/v1/oauth/token",
new Dictionary<string, string>
{
["grant_type"] = "refresh_token",
["refresh_token"] = refreshToken,
["client_id"] = "clid_01ABcDeFgHiJkLmNoPqRsTuV",
["client_assertion_type"] = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
["client_assertion"] = jwt.Trim(),
}
);
Cut at 300 lines. The page has the rest.
manage-claude/oauth-apps/linked-billing/errors New page · 252 lines, new page
## While linking ### `access_denied` ### `user_profile_already_linked` ### No redirect ### `unauthorized_client` from the code exchange ## While billing ### 403 `user_profile_billing_not_authorized` ### 403 `user_profile_not_billable` ### 402 `linked_organization_spend_limit_reached` ### 402 `linked_organization_billing_unavailable` ### 400 `user_profile_required` ### 401 `authentication_error` ### 429 `enforced_spend_limit_reached` ### 503 `overloaded_error` ### Other errors with no code
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: Linked billing errors
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors
description: Find what to do about each error that linking or billing a customer can return, with its causes in the order to check them.
featureMetadata:
status: beta
betaHeader: user-profiles-billing-2026-10-01
supportedModels:
- claude-fable-5-2
- claude-mythos-5-2
- claude-fable-5-1
- claude-mythos-5-1
- claude-fable-5
- claude-mythos-5
- claude-mythos-preview
- claude-opus-5-5
- claude-opus-5
- claude-sonnet-5-5
- claude-sonnet-5
- claude-haiku-5-5
- claude-haiku-4-5-20251001
- claude-opus-4-8
- claude-opus-4-7
- claude-opus-4-6
- claude-sonnet-4-6
- claude-opus-4-5-20251101
- claude-sonnet-4-5-20250929
supportedPlatforms:
Claude API:
availability: beta
note: Only requests that send `billing_policy` need the beta header.
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
These are the errors that `auth.claude.com` returns while linking and the Claude API returns while billing, apart from a [failed refresh](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails).
## While linking
These errors arrive on your redirect URI or from the code exchange. A connection is the record that ties a customer’s Claude organization to one of your [user profiles](https://platform.claude.com/docs/en/manage-claude/user-profiles). In each case, no connection is made. For the standard OAuth errors, see [OAuth endpoints and parameters](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#errors).
### `access_denied`
First, check your app: causes 3 and 4 are yours to fix.
Otherwise, tell the person that linking didn’t complete, and don’t assume that they declined. Ask them to check which Claude account they signed in with and their role in the organization they want to link. To let them try again, [send them to approve](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#send-them-to-approve) with a new pushed authorization request.
For these causes, your redirect URI receives `error=access_denied` with your `state` value:
1. The person clicked **Cancel** on an approval screen.
2. The approval page had no organization to offer, and the person clicked the button that returns to your app. That happens when:
* the person doesn’t have the Admin or Billing role in any Claude organization
* the person’s only organization is the one that owns your app
* the user profile that you sent is already linked to another organization, where the person doesn’t have the Admin or Billing role
* the person’s only organizations are of a kind that can’t link: see [eligible customers](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#eligible-customers)
3. Your app’s **Who can link** setting reads “only” after your organization’s name. Nobody can link such an app. On its **Settings** tab, select **Any Claude user** and click **Save changes**.
4. Your app isn’t live, the person isn’t on its **Test users** list, and they clicked the button that returns to your app. [Add them as a test user](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#add-test-users), or [publish the app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#publish-the-app).
For these causes, `error_description` reads `the user declined the request`, so it can’t tell you which one happened. If it reads `the request cannot be approved for this organization` instead, the organization that the person selected can’t approve your app. Ask them to select another.
### `user_profile_already_linked`
Each customer’s organization can have only one connection to your app at a time, and so can each of your profiles. `error_description` says which of these two causes applies:
1. **The organization already has a connection**, through another of your profiles. This is the usual cause, and `error_description` starts `This organization already has an active connection`. On your [User profiles page](https://platform.claude.com/user-profiles), look for another profile of this customer that shows as **Linked**. Anthropic doesn’t show which organization a profile is linked to, so confirm with the customer that it’s theirs.
* **You find it:** Bill the customer through that profile, or [unlink that profile](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#unlink-a-customer) and send the customer to approve again with the profile that was refused.
* **None of this customer’s profiles is linked:** The person might have selected an organization that belongs to another of your customers. Send them to approve again, and ask them to check which organization they select.
2. **The profile you sent already has a connection**, to another organization. Its `error_description` starts `This user profile already has an active connection`. End that connection first: see [Move a customer to another organization](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#move-a-customer-to-another-organization).
You can’t catch this error early: the pushed authorization request succeeds.
The error arrives in one of two places:
* **On your redirect URI:** If the person returns to your app, the redirect carries `error=user_profile_already_linked` with your `state` value. `auth.claude.com` has already asked them to contact you with this code.
* **From the token endpoint:** The code exchange returns it if the connection was made after the approval.
The error doesn’t name the profile that holds the connection.
### No redirect
If the person comes back to your product without a callback, send them to approve again with a new pushed authorization request. You get no callback and can’t tell these cases apart:
* The person closed the approval page.
* The `request_uri` had expired. It expires 10 minutes after you create it.
* The `request_uri` was already used. Each one works once.
In the last two cases, the approval page displays an error and doesn’t send the browser back to your app.
### `unauthorized_client` from the code exchange
Check your app’s setup in the Claude Console, fix what’s missing, and exchange the same code again. This refusal doesn’t use up the code, which lasts 5 minutes.
| Check | `error_description` | Fix |
| ----- | ----- | ----- |
| The app has an operator service account | `the client is not registered for this grant` | [Choose an operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account) |
| The app has a default workspace that isn’t archived | Names the workspace problem | [Choose a default workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#default-workspace) |
| The operator service account is a member of that workspace | Names the workspace problem | [Choose a workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#default-workspace) that the account is a member of, such as the built-in workspace named **Default** |
A saved change can take a few minutes to reach `auth.claude.com`, so if the exchange is refused again, wait and retry. If the code expires first, send the customer to approve again.
If the Console says that the service account no longer exists, see [If you change the service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-change-the-service-account). For any other cause, contact [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support) or your Anthropic account team if you have one.
## While billing
A request that the Claude API refuses before Claude starts a reply bills no one. Where the error’s details are depends on the endpoint:
| Endpoint | Where the error code is | Request ID header |
| ----- | ----- | ----- |
| `/v1/messages` | `error.details.error_code` | `request-id` |
| `/v1/chat/completions` | Not sent | `x-request-id` |
On `/v1/chat/completions`, the error takes another form:
* `error.type` is `invalid_request_error`.
* `error.code` holds the error type, such as `billing_error`, not one of the error codes in this page’s headings.
Match on the HTTP status and `error.code`. The two `402` errors look alike there, and so do the `403` errors, so follow every entry that fits. A `401` for an access token has the `/v1/messages` form and the `request-id` header on both endpoints.
A refusal on `/v1/messages` has this form:
```json
{
"type": "error",
"error": {
"type": "billing_error",
"message": "...",
"details": {
"error_code": "linked_organization_spend_limit_reached"
}
}
}
```
The `401` and `503` errors later on this page have no error code. On `/v1/messages`, match them on the status and `error.type`.
In the Anthropic SDK, catch the error class for the HTTP status, then read the error code from its `error_code` (typescript: `errorCode`; csharp: `ErrorCode`; go: `ErrorCode()`; java: `errorCode()`; php: `getErrorCode()`). The class for a `402` is `PaymentRequiredError` (ruby: `Anthropic::Errors::PaymentRequiredError`; java, php: `PaymentRequiredException`; csharp: `AnthropicPaymentRequiredException`; go: `*anthropic.Error`), and the class for a `403` is `PermissionDeniedError` (ruby: `Anthropic::Errors::PermissionDeniedError`; java, php: `PermissionDeniedException`; csharp: `AnthropicForbiddenException`; go: `*anthropic.Error`).
Outside Go, each class covers every error with its status. Go has one type, `*anthropic.Error`, for every status: check its `StatusCode`. One code can also arrive inside a streamed reply: see [`linked_organization_billing_unavailable`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#linked-organization-billing-unavailable).
Log the whole `error.message` and the request ID of each refused request. To serve a refused customer at your own cost, send the request again [as one that you pay for](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#you-pay), with `bill_to: "self"` in `billing_policy`. Send it as your [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account), not with a customer’s access token.
For a `402` or `403`, sending the same request again doesn’t help while the cause lasts. A new connection’s first seconds are an exception: see [`user_profile_billing_not_authorized`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-billing-not-authorized).
A request that fits causes of both `403` codes can get either code, for example the wrong credential for a customer who also isn’t linked. Handle the two codes together, and if one entry’s causes don’t explain a refusal, check the other’s.
### 403 `user_profile_billing_not_authorized`
No connection lets your request bill the user profile it names. The response doesn’t say why. To tell causes 2 to 4 apart, [check whether the customer is linked](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#check-a-links-status) through the app you expect.
Check these causes in order:
1. **Your request.** The request must name the user profile that this customer linked. It must also authenticate as the operator service account of the app that they linked through, or with that connection’s access token. The service account of another of your apps gets this error if the customer hasn’t linked through that app. Correct the request: a new connection doesn’t help.
2. **The customer hasn’t linked through this app.** The [connection status](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#check-a-links-status) reads `not_connected`. A profile linked only through another of your apps, such as a [separate test app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-run-several-apps), isn’t linked to this one. Until the customer [links through this app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#send-them-to-approve), a request can bill only you, with `bill_to: "self"`.
3. **The connection has ended.** The connection status reads `disconnected`, and the profile shows as **Unlinked** on your [User profiles page](https://platform.claude.com/user-profiles). The status’s `last_revoked_reason.type` says why. Until the customer [links again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again), a request can bill only you, with `bill_to: "self"`.
4. **The connection status reads `connected`, and the request is still refused.**
* **A new connection:** A new connection usually works at once, but it can take about 10 seconds after the code exchange. If the connection is that new, wait until about 10 seconds have passed since the exchange and then send the request once more.
* **An earlier connection’s access token:** A customer’s access token works only for the connection that issued it. After that connection ends, a request with its token can get this error or a [`401 authentication_error`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#authentication-error), even if the customer has linked again. Use the new connection’s access token.
* **Neither:** Send a refused request’s ID to [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support) or to your Anthropic account team if you have one.
### 403 `user_profile_not_billable`
Find the cause before you ask the customer to link again, because linking the same organization again can fix only cause 2.
Check these causes in order:
1. **Your request’s credential.** The request must authenticate as your app’s [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account) or with a customer’s access token. Any other credential is refused, such as an API key that isn’t bound to a service account. So is a service account that operates no OAuth app, such as an [operator that you replaced](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-change-the-service-account). Correct the request.
2. **Operator-only authentication.** If you [turned off operator-only authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#turn-off-operator-only-authentication), only a customer’s own access token can bill them. A request from your service account alone is refused, even though the customer shows as **Linked**.
* **You hold the customer’s access token:** Send the request with it. If it has expired, [refresh the OAuth tokens](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#refresh-the-tokens) first.
* **You hold no refresh token, or the refresh returns `invalid_grant`:** [Link the customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again).
3. **The customer’s organization.** You can’t see its status from your side, so ask the customer how their organization pays for its Claude API usage.
* **It isn’t eligible:** It must [pay Anthropic directly](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#eligible-customers). Some organizations billed through a cloud marketplace can link, and then every request that you bill to them gets this error.
* **It has no billing set up:** A new organization can link before it has billing set up. Until then, it gets this error, not the out-of-credit `402`. Ask the customer to buy credits on their [Billing page](https://platform.claude.com/settings/billing) and then send the request again. A purchase can take some time to apply, so if you still get this error or [`linked_organization_spend_limit_reached`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#linked-organization-spend-limit-reached), try again later.
4. **Something only Anthropic can see.** The customer shows as **Linked**, and your request is correct. Send a refused request’s ID to [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support) or to your Anthropic account team if you have one.
### 402 `linked_organization_spend_limit_reached`
Ask a person with the Admin or Billing role at the customer to check these in the Claude Console. The response doesn’t say which one applies:
* **Their spend cap for your app:** On the page for your app under [Linked platforms](https://platform.claude.com/linked-platforms), they can set or raise it. A cap set there replaces the default cap that they set for all linked platforms.
* **Their organization’s monthly spend limit:** Under [Spend limits](https://platform.claude.com/settings/billing#spend-limits), they can raise it.
* **Their credit balance:** On their [Billing page](https://platform.claude.com/settings/billing), they can buy credits. A purchase can take some time to apply, so a request soon after it can still get this error. If so, try again later. Some credits can’t pay for these requests: see [Which credits can pay](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#which-credits-can-pay). A balance above $0 USD can therefore still get this error.
While your app isn’t live, a cap can’t go above $50 USD. A refusal at $50 USD then lasts until the next month begins (UTC): see [Caps while testing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#caps-while-testing).
An organization that has billing set up but no credit gets this code. One whose billing isn’t set up yet gets [`user_profile_not_billable`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-not-billable).
### 402 `linked_organization_billing_unavailable`
What to do depends on when the error arrives:
* **Before a reply starts:** Anthropic can’t bill the customer’s organization, for example because it’s suspended. The response doesn’t say why. Ask the customer to check their Claude account and their billing status with Anthropic.
* **After Claude has started a reply:** Usually, the organization’s credit ran out, though a suspension can also cut a reply. Ask the customer to buy credits on their [Billing page](https://platform.claude.com/settings/billing) or to check their account.
A request that isn’t streamed gets an HTTP `402` in both cases, so follow both. A customer who has no credit when the request arrives gets [`linked_organization_spend_limit_reached`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#linked-organization-spend-limit-reached) instead.
On a streamed reply, the HTTP status is already `200` when the reply is cut, and the error arrives in the stream:
* **On `/v1/messages`:** As an `error` event whose `error.type` is `billing_error` and whose `error.details.error_code` is this code. The SDK’s class for a `402` doesn’t catch it.
* **On `/v1/chat/completions`:** As a last `data:` line that holds an OpenAI error object, with `billing_error` in `error.code` and no `[DONE]` after it.
No one pays for the reply that was cut. If the request had already finished a step, such as Claude’s turn before a web search, the customer pays for that step.
### 400 `user_profile_required`
Send the customer’s user profile ID in the `anthropic-user-profile-id` header. The request set `bill_to: "user_profile"` without it. A request with a [customer’s access token](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#call-claude-with-a-token) doesn’t need the header.
### 401 `authentication_error`
Send the request again with the customer’s newest access token, or [refresh the OAuth tokens](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#refresh-the-tokens). [Link the customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again) only if their profile shows as **Unlinked**, you hold no refresh token for them, or the refresh returns `invalid_grant`.
This entry covers requests with a customer’s access token, which no longer works: it expired, a refresh replaced it, or it was revoked. A refresh revokes the earlier token too, so “revoked” in `error.message` doesn’t alone mean that the connection ended. After a connection ends, each request with its token can get this error or a [`403 user_profile_billing_not_authorized`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-billing-not-authorized), in no fixed order.
### 429 `enforced_spend_limit_reached`
[Request a higher monthly spend cap](https://platform.claude.com/docs/en/api/rate-limits#requesting-higher-limits) for your organization, or wait until the next month begins (UTC). Sending the request again doesn’t help, even as one that you pay for.
Your organization reached your usage tier’s monthly spend cap. The customer’s spend cap for your app isn’t the cause, so the customer can’t fix it. See [Reaching your spend cap](https://platform.claude.com/docs/en/api/rate-limits#reaching-your-spend-cap).
### 503 `overloaded_error`
Retry with backoff. If the response has a `retry-after` header, wait at least that long. The Claude API couldn’t confirm whether it can bill the customer, so it didn’t serve or bill the request.
### Other errors with no code
| Status and type | Cause | Fix |
| ----- | ----- | ----- |
| `400 invalid_request_error` | The `anthropic-user-profile-id` header holds an ID that is malformed or isn’t one of your organization’s user profiles | Send the customer’s user profile ID |
| `400 invalid_request_error` | The request sends `billing_policy` without the `user-profiles-billing-2026-10-01` beta header | Add the beta header |
| `400 invalid_request_error` | `billing_policy` has a missing or invalid field | Correct `billing_policy` |
| `400 invalid_request_error` | The request bills a customer and uses [billable code execution features](https://platform.claude.com/docs/en/about-claude/pricing#code-execution-tool) | Send it as your operator service account, billed to you |
| `invalid_request_error` in an `errored` batch result | A request in a batch bills a customer: see [If you use Message Batches](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#if-you-use-message-batches) | Send it billed to you |
| `400 invalid_request_error` | The request uses a customer’s access token and sets `bill_to: "self"` | Send requests that you pay for as your operator service account |
| `400 invalid_request_error` | The request uses a customer’s access token and names another user profile | Name only that customer’s profile |
| `403 permission_error` | The request uses a customer’s access token on an endpoint that doesn’t take it, such as [Message Batches](https://platform.claude.com/docs/en/build-with-claude/batch-processing) | Send it as your operator service account |
| `403 permission_error` | Anthropic doesn’t bill your organization directly, so it can’t bill customers on your behalf | Bill customers from an organization that pays Anthropic directly |
manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer New page · 1623 lines, new page
## Before you begin ### Sample setup ## Choose the user profile ## Link the customer ### Create the user profile ### Send the customer to approve ### Save the connection and its OAuth tokens ## Bill a request ### Your customer pays ### You pay ## Check the result ## What to tell your customers ## Rules and special cases ### If your federation rule and client authentication expect different audiences ### If the code exchange times out ### If you have a profile for each person ### If you resell API access ### If a customer approves again ### For agents ## Next steps
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: Link and bill a customer
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer
description: Send a customer to approve your OAuth app, save the connection, and bill Claude API requests to their Claude organization.
featureMetadata:
status: beta
betaHeader: user-profiles-billing-2026-10-01
supportedModels:
- claude-fable-5-2
- claude-mythos-5-2
- claude-fable-5-1
- claude-mythos-5-1
- claude-fable-5
- claude-mythos-5
- claude-mythos-preview
- claude-opus-5-5
- claude-opus-5
- claude-sonnet-5-5
- claude-sonnet-5
- claude-haiku-5-5
- claude-haiku-4-5-20251001
- claude-opus-4-8
- claude-opus-4-7
- claude-opus-4-6
- claude-sonnet-4-6
- claude-opus-4-5-20251101
- claude-sonnet-4-5-20250929
supportedPlatforms:
Claude API:
availability: beta
note: Only requests that send `billing_policy` need the beta header.
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
This page shows how to build Linked billing into your product. A customer approves your app once, which creates a connection between their Claude organization and one of your user profiles. After that, your back end bills the customer by sending requests as your own [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account), naming the customer’s [user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles). You try the flow first on a test customer, a second organization of your own. For how the feature works and whether it fits your product, see [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing).
## Before you begin
You need these:
* **An app set up for Linked billing:** It needs client authentication, an operator service account, and a default workspace: see [Set up your app for Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app).
* **A test customer:** A second Claude organization of yours, because the organization that owns your app can’t link to it. It must pay Anthropic directly, through invoiced billing or [credit that can pay for these requests](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#which-credits-can-pay).
* **A test user:** A person with the Admin or Billing role in the test customer’s organization, who approves for it. Until your app is live, only people on its **Test users** list can link it. [Add this person’s Claude email address](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#add-test-users) to that list.
### Sample setup
The samples read these values:
| Samples | What they need | Where it comes from |
| ----- | ----- | ----- |
| SDK and CLI | Your operator service account’s federation settings, in environment variables, including the federation JWT’s file in `ANTHROPIC_IDENTITY_TOKEN_FILE` | [Construct the SDK client](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#construct-the-sdk-client) |
| cURL requests to the Claude API | Your service account’s access token, in `ANTHROPIC_AUTH_TOKEN` | [Authenticate from your workload](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#authenticate-from-your-workload) |
| Requests to `auth.claude.com` | A client assertion: a JWT for your app’s **Expected audience**, in the file that `CLIENT_ASSERTION_FILE` names or in place of `YOUR_CLIENT_ASSERTION_JWT` | Your identity provider |
| All | Your app’s client ID and redirect URI, in place of the sample’s client ID and redirect URI | Your app’s page in the Claude Console |
Set `ANTHROPIC_AUTH_TOKEN` only where the cURL samples run. Where the SDK and CLI samples run, unset it and `ANTHROPIC_API_KEY`, because [each one takes priority over federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#credential-precedence).
The client assertion and the federation JWT usually need different audiences, so keep them in separate files: see [when the two audiences differ](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-the-audiences-differ). The samples that use `CLIENT_ASSERTION_FILE` read it for each request, because the JWT in it rotates.
## Choose the user profile
A [user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles) is a record in your own organization that stands for one of your customers. A request that bills the customer carries the profile’s ID, which tells Anthropic whom to bill. You can link a profile that you already have, unless it’s archived, and linking doesn’t change its ID or usage history.
Within one app, a customer’s Claude organization can link to only one of your profiles, and a profile can link to only one organization. Decide which profile stands for which organization before you link your first customer. The organization is the one that your customer selects when they approve, so ask them how their teams use Claude organizations:
* **Several teams share one Claude organization:** Use one profile for all of the teams.
* **Each team has its own Claude organization:** Use one profile for each organization.
If the customer selects an organization that’s already linked to another of your profiles, the approval is refused: see [`user_profile_already_linked` in Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-already-linked).
Two cases change the profile that you create: [If you have a profile for each person](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-you-have-a-profile-for-each-person) and [If you resell API access](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-you-resell-api-access).
## Link the customer
<Frame>

</Frame>
### Create the user profile
Create one user profile for each Claude organization that will link, as you mapped them in [Choose the user profile](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#choose-the-user-profile). Skip this step for a profile that you already have. Send a name and your own ID for the customer (`reference_id`). Create the profile once, and store its ID with the customer’s record: each create request makes a new profile, even with the same `reference_id`.
<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": "Example Customer Inc.",
"external_user_details": {"reference_id": "cust_2abc3def"}
}'
```
```bash CLI
ant user-profiles create \
--name "Example Customer Inc." \
--external-user-details.reference-id cust_2abc3def
```
```python Python
client = anthropic.Anthropic()
profile = client.user_profiles.create(
name="Example Customer Inc.",
external_user_details={"reference_id": "cust_2abc3def"},
)
print(profile.id)
```
```typescript TypeScript
const client = new Anthropic();
const profile = await client.userProfiles.create({
name: "Example Customer Inc.",
external_user_details: { reference_id: "cust_2abc3def" }
});
console.log(profile.id);
```
```csharp C#
AnthropicClient client = new();
var profile = await client.UserProfiles.Create(
new()
{
Name = "Example Customer Inc.",
ExternalUserDetails = new() { ReferenceID = "cust_2abc3def" },
}
);
Console.WriteLine(profile.ID);
```
```go Go
client := anthropic.NewClient()
profile, err := client.UserProfiles.New(context.Background(), anthropic.UserProfileNewParams{
Name: anthropic.String("Example Customer Inc."),
ExternalUserDetails: anthropic.UserProfileExternalUserDetailsParams{
ReferenceID: anthropic.String("cust_2abc3def"),
},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(profile.ID)
```
```java Java
import com.anthropic.models.userprofiles.UserProfileCreateParams;
import com.anthropic.models.userprofiles.UserProfileExternalUserDetailsParams;
void main() {
AnthropicClient client = AnthropicOkHttpClient.fromEnv();
var params = UserProfileCreateParams.builder()
.name("Example Customer Inc.")
.externalUserDetails(UserProfileExternalUserDetailsParams.builder()
.referenceId("cust_2abc3def")
.build())
.build();
var profile = client.userProfiles().create(params);
IO.println(profile.id());
}
```
```php PHP
$client = new Client();
$profile = $client->userProfiles->create(
name: 'Example Customer Inc.',
externalUserDetails: ['referenceID' => 'cust_2abc3def'],
);
echo $profile->id, PHP_EOL;
```
```ruby Ruby
client = Anthropic::Client.new
profile = client.user_profiles.create(
name: "Example Customer Inc.",
external_user_details: { reference_id: "cust_2abc3def" }
)
puts(profile.id)
```
</CodeGroup>
The response holds the profile’s `id`, such as `uprof_01HV9Z`.
### Send the customer to approve
Add a [Link your Claude organization button](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button) to your product, where your customers manage billing or integrations. Its HTML, colors, and logo are ready to copy.
The approval page offers only the organizations of the signed-in Claude account, and the organization that the customer selects pays. For what to show beside the button, see [What to tell your customers](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#what-to-tell-your-customers).
When the customer clicks the button, do these three things in your back end:
1. **Create a `state` value and a PKCE code verifier,** a random secret that proves your back end started this approval. Store both on your back end, tied to the browser session and the customer’s record.
2. **Send a pushed authorization request** to `auth.claude.com`, which passes the approval’s details from your back end instead of through the browser.
3. **Redirect the browser** to `https://auth.claude.com/oauth/authorize` with your `client_id` and the `request_uri` from the response. A `request_uri` works once and expires after 10 minutes, so send a new pushed authorization request for each click.
No SDK covers `auth.claude.com`, so the samples for these steps call it over HTTP:
<CodeGroup exclude="shell:CLI">
```bash cURL
curl https://auth.claude.com/v1/oauth/par \
-H "content-type: application/json" \
-d @- <<'JSON'
{
"response_type": "code",
"client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV",
"redirect_uri": "https://app.example.com/claude/billing/callback",
"scope": "billing:attribution",
"connection_type": "organization_shared",
"connection_auth_target": "platform",
"user_profile_id": "uprof_01HV9Z",
"state": "RANDOM_STATE",
"code_challenge": "BASE64URL_SHA256_OF_VERIFIER",
"code_challenge_method": "S256",
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"client_assertion": "YOUR_CLIENT_ASSERTION_JWT"
}
JSON
```
<CodeGroupItem language="CLI">
The `ant` CLI has no command for `auth.claude.com`. Send the request with cURL or in your application’s language.
</CodeGroupItem>
```python Python
import base64
import hashlib
import os
import secrets
from pathlib import Path
from urllib.parse import urlencode
import httpx2 # comes with the Anthropic SDK
CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV"
def push_authorization_request(user_profile_id: str) -> dict[str, str]:
state = secrets.token_urlsafe(32)
code_verifier = secrets.token_urlsafe(64)
digest = hashlib.sha256(code_verifier.encode()).digest()
assertion_file = Path(os.environ["CLIENT_ASSERTION_FILE"])
response = httpx2.post(
"https://auth.claude.com/v1/oauth/par",
json={
"response_type": "code",
"client_id": CLIENT_ID,
"redirect_uri": "https://app.example.com/claude/billing/callback",
"scope": "billing:attribution",
"connection_type": "organization_shared",
"connection_auth_target": "platform",
"user_profile_id": user_profile_id,
"state": state,
"code_challenge": base64.urlsafe_b64encode(digest).rstrip(b"=").decode(),
"code_challenge_method": "S256",
"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"Request failed: {response.status_code} {response.text}")
query = {"client_id": CLIENT_ID, "request_uri": response.json()["request_uri"]}
return {
"approval_url": f"https://auth.claude.com/oauth/authorize?{urlencode(query)}",
"state": state,
"code_verifier": code_verifier,
}
```
```typescript TypeScript
import { createHash, randomBytes } from "node:crypto";
import { readFile } from "node:fs/promises";
const CLIENT_ID = "clid_01ABcDeFgHiJkLmNoPqRsTuV";
async function pushAuthorizationRequest(userProfileId: string) {
const state = randomBytes(32).toString("base64url");
const codeVerifier = randomBytes(64).toString("base64url");
const jwt = await readFile(process.env.CLIENT_ASSERTION_FILE!, "utf8");
const response = await fetch("https://auth.claude.com/v1/oauth/par", {
method: "POST",
Cut at 300 lines. The page has the rest.
manage-claude/oauth-apps/linked-billing/link-button New page · 230 lines, new page
## HTML and CSS ## Colors and sizes ## Logo file ## Next steps
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: Link your Claude organization button
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button
description: Add the button that sends a customer from your product to Claude's approval page to start Linked billing.
featureMetadata:
status: beta
betaHeader: user-profiles-billing-2026-10-01
supportedModels:
- claude-fable-5-2
- claude-mythos-5-2
- claude-fable-5-1
- claude-mythos-5-1
- claude-fable-5
- claude-mythos-5
- claude-mythos-preview
- claude-opus-5-5
- claude-opus-5
- claude-sonnet-5-5
- claude-sonnet-5
- claude-haiku-5-5
- claude-haiku-4-5-20251001
- claude-opus-4-8
- claude-opus-4-7
- claude-opus-4-6
- claude-sonnet-4-6
- claude-opus-4-5-20251101
- claude-sonnet-4-5-20250929
supportedPlatforms:
Claude API:
availability: beta
note: Only requests that send `billing_policy` need the beta header.
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
This page lists the HTML, CSS, colors, sizes, and logo of the **Link your Claude organization** button for [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing).
<Frame caption="The button in light and dark">

</Frame>
## HTML and CSS
The only parts of the button’s look that you may change are its size and whether you use the light or the dark button. The font, the colors, and the logo’s size compared with the words stay as [Colors and sizes](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button#colors) shows them.
The button’s CSS and HTML fit into your page like this:
* **CSS:** The `<style>` block from **Button CSS** goes in your page’s `<head>`. If your Content Security Policy doesn’t allow inline styles, its rules go in your style sheet instead.
* **HTML:** The `<a>` element from **Sample HTML** goes where the button appears. It holds the logo, so the button needs no Anthropic host in your Content Security Policy.
* **Route:** The element’s `href`, `/claude/billing/link` in the sample, points to your back end’s [route that starts the approval](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#send-them-to-approve).
* **Dark button:** The `claude-button-dark` class, added beside `claude-button` on the element, gives the dark button.
* **Size:** To resize the button, change only the `font-size` line in **Button CSS**, not the size inside the `font` line.
For how you may use the Claude name and logo, see the [Linked Billing Beta Terms](https://www.anthropic.com/legal/linked-billing-terms).
<Accordion title="Button CSS">
```html claude-button.html
<style>
/* Each size is written as calc(Nem / 14), where N is its size in pixels
when the text is 14 pixels. To make the button larger, change only font-size. */
.claude-button {
--claude-button-fill: #FFFFFF;
--claude-button-fill-hover: #F5F4ED;
--claude-button-text: #141413;
--claude-button-border: #87867F;
display: inline-flex;
align-items: center;
justify-content: center;
gap: calc(10em / 14);
box-sizing: border-box;
min-height: calc(40em / 14);
padding: calc(8em / 14) calc(12em / 14);
border: 1px solid var(--claude-button-border);
border-radius: calc(8em / 14);
background: var(--claude-button-fill);
font: 500 0.875rem/1.4286 ui-sans-serif, system-ui, -apple-system, "Segoe UI",
Roboto, "Helvetica Neue", Arial, sans-serif;
font-size: 0.875rem;
letter-spacing: normal;
text-transform: none;
cursor: pointer;
}
.claude-button-dark {
--claude-button-fill: #141413;
--claude-button-fill-hover: #262624;
--claude-button-text: #FAF9F5;
--claude-button-border: #73726C;
}
.claude-button,
.claude-button:link,
.claude-button:visited,
.claude-button:hover,
.claude-button:focus,
.claude-button:active {
color: var(--claude-button-text);
text-decoration: none;
}
.claude-button:hover {
background: var(--claude-button-fill-hover);
}
.claude-button:focus-visible {
outline: 2px solid var(--claude-button-text);
outline-offset: 2px;
box-shadow: 0 0 0 2px var(--claude-button-fill);
}
.claude-button svg {
flex: none;
width: calc(20em / 14);
height: calc(20em / 14);
}
.claude-button path {
fill: #D97757;
stroke: none;
}
</style>
```
</Accordion>
<Accordion title="Sample HTML">
```html link-your-claude-organization.html
<a class="claude-button" href="/claude/billing/link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true">
<path fill="#D97757" d="M11.376 24L10.776 23.544L10.44 22.8L10.776 21.312L11.16 19.392L11.472 17.856L11.76 15.96
L11.928 15.336L11.904 15.288L11.784 15.312L10.344 17.28L8.16 20.232L6.432 22.056
L6.024 22.224L5.304 21.864L5.376 21.192L5.784 20.616L8.16 17.568L9.6 15.672L10.536 14.592
L10.512 14.448H10.464L4.128 18.576L3 18.72L2.496 18.264L2.568 17.52L2.808 17.28L4.704 15.96
L9.432 13.32L9.504 13.08L9.432 12.96H9.192L8.4 12.912L5.712 12.84L3.384 12.744L1.104 12.624
L0.528 12.504L0 11.784L0.048 11.424L0.528 11.112L1.224 11.16L2.736 11.28L5.016 11.424
L6.672 11.52L9.12 11.784H9.504L9.552 11.616L9.432 11.52L9.336 11.424L6.96 9.84L4.416 8.16
L3.072 7.176L2.352 6.672L1.992 6.216L1.848 5.208L2.496 4.488L3.384 4.56L3.6 4.608
L4.488 5.304L6.384 6.768L8.88 8.616L9.24 8.904L9.408 8.808V8.736L9.24 8.472L7.896 6.024
L6.456 3.528L5.808 2.496L5.64 1.872C5.576 1.656 5.544 1.416 5.544 1.152L6.288 0.144001
L6.696 0L7.704 0.144001L8.112 0.504001L8.736 1.92L9.72 4.152L11.28 7.176L11.736 8.088
L11.976 8.904L12.072 9.168H12.24V9.024L12.36 7.296L12.6 5.208L12.84 2.52L12.912 1.752
L13.296 0.840001L14.04 0.360001L14.616 0.624001L15.096 1.32L15.024 1.752L14.76 3.6
L14.184 6.504L13.824 8.472H14.04L14.28 8.208L15.264 6.912L16.92 4.848L17.64 4.032
L18.504 3.12L19.056 2.688H20.088L20.832 3.816L20.496 4.992L19.44 6.336L18.552 7.464
L17.28 9.168L16.512 10.536L16.584 10.632H16.752L19.608 10.008L21.168 9.744L22.992 9.432
L23.832 9.816L23.928 10.2L23.592 11.016L21.624 11.496L19.32 11.952L15.888 12.768
L15.84 12.792L15.888 12.864L17.424 13.008L18.096 13.056H19.728L22.752 13.272L23.544 13.8
L24 14.424L23.928 14.928L22.704 15.528L21.072 15.144L17.232 14.232L15.936 13.92H15.744
V14.016L16.848 15.096L18.84 16.896L21.36 19.224L21.48 19.8L21.168 20.28L20.832 20.232
L18.624 18.552L17.76 17.808L15.84 16.2H15.72V16.368L16.152 17.016L18.504 20.544
L18.624 21.624L18.456 21.96L17.832 22.176L17.184 22.056L15.792 20.136L14.376 17.952
L13.224 16.008L13.104 16.104L12.408 23.352L12.096 23.712L11.376 24Z"/>
</svg>
Link your Claude organization
</a>
```
</Accordion>
If your route needs a form submission, such as a `POST`, use a `<button type="submit" class="claude-button">` inside a form in place of the `<a>` element. It holds the same logo and words. The form’s action is your route, and the same styles apply.
A rule in your own style sheet, such as one for `.nav a`, can override the button’s styles. The button then doesn’t match the picture and the tables in [Colors and sizes](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button#colors). To keep its design, write such a rule so that it skips elements with the `claude-button` class.
## Colors and sizes
| Part | Light button | Dark button |
| ----- | ----- | ----- |
| Background | `#FFFFFF` | `#141413` |
| Text | `#141413` | `#FAF9F5` |
| Border | `#87867F` | `#73726C` |
| Background on hover | `#F5F4ED` | `#262624` |
| Logo | `#D97757` | `#D97757` |
At the default font size of 14 pixels, on a page whose root font size is 16 pixels, the button has these sizes:
| Part | Size |
| ----- | ----- |
| Height | 40 pixels |
| Padding | 8 pixels above and below, 12 pixels at the sides |
| Corner radius | 8 pixels |
| Border | 1 pixel |
| Logo | 20 by 20 pixels |
| Gap between the logo and the words | 10 pixels |
| Text | 14 pixels, weight 500, in the system’s sans-serif font |
| Focus outline | 2 pixels in the text color, 2 pixels out from the button, with a 2-pixel ring in the fill color around the button |
Every size except the border and the focus outline scales with the button’s font size.
## Logo file
For a button built without HTML, such as in a mobile or desktop app, the logo is the following file, `claude-logo.svg`. That button takes the colors and sizes in [Colors and sizes](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button#colors), scaled together as that section describes if you change its size. As in the sample HTML, hide the logo from screen readers in that button too, because the words already name it.
<Accordion title="claude-logo.svg">
<File filename="claude-logo.svg" size="sm">
```xml
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<path fill="#D97757"
d="M11.376 24L10.776 23.544L10.44 22.8L10.776 21.312L11.16 19.392L11.472 17.856L11.76 15.96
L11.928 15.336L11.904 15.288L11.784 15.312L10.344 17.28L8.16 20.232L6.432 22.056
L6.024 22.224L5.304 21.864L5.376 21.192L5.784 20.616L8.16 17.568L9.6 15.672L10.536 14.592
L10.512 14.448H10.464L4.128 18.576L3 18.72L2.496 18.264L2.568 17.52L2.808 17.28L4.704 15.96
L9.432 13.32L9.504 13.08L9.432 12.96H9.192L8.4 12.912L5.712 12.84L3.384 12.744L1.104 12.624
L0.528 12.504L0 11.784L0.048 11.424L0.528 11.112L1.224 11.16L2.736 11.28L5.016 11.424
L6.672 11.52L9.12 11.784H9.504L9.552 11.616L9.432 11.52L9.336 11.424L6.96 9.84L4.416 8.16
L3.072 7.176L2.352 6.672L1.992 6.216L1.848 5.208L2.496 4.488L3.384 4.56L3.6 4.608
L4.488 5.304L6.384 6.768L8.88 8.616L9.24 8.904L9.408 8.808V8.736L9.24 8.472L7.896 6.024
L6.456 3.528L5.808 2.496L5.64 1.872C5.576 1.656 5.544 1.416 5.544 1.152L6.288 0.144001
L6.696 0L7.704 0.144001L8.112 0.504001L8.736 1.92L9.72 4.152L11.28 7.176L11.736 8.088
L11.976 8.904L12.072 9.168H12.24V9.024L12.36 7.296L12.6 5.208L12.84 2.52L12.912 1.752
L13.296 0.840001L14.04 0.360001L14.616 0.624001L15.096 1.32L15.024 1.752L14.76 3.6
L14.184 6.504L13.824 8.472H14.04L14.28 8.208L15.264 6.912L16.92 4.848L17.64 4.032
L18.504 3.12L19.056 2.688H20.088L20.832 3.816L20.496 4.992L19.44 6.336L18.552 7.464
L17.28 9.168L16.512 10.536L16.584 10.632H16.752L19.608 10.008L21.168 9.744L22.992 9.432
L23.832 9.816L23.928 10.2L23.592 11.016L21.624 11.496L19.32 11.952L15.888 12.768
L15.84 12.792L15.888 12.864L17.424 13.008L18.096 13.056H19.728L22.752 13.272L23.544 13.8
L24 14.424L23.928 14.928L22.704 15.528L21.072 15.144L17.232 14.232L15.936 13.92H15.744
V14.016L16.848 15.096L18.84 16.896L21.36 19.224L21.48 19.8L21.168 20.28L20.832 20.232
L18.624 18.552L17.76 17.808L15.84 16.2H15.72V16.368L16.152 17.016L18.504 20.544
L18.624 21.624L18.456 21.96L17.832 22.176L17.184 22.056L15.792 20.136L14.376 17.952
L13.224 16.008L13.104 16.104L12.408 23.352L12.096 23.712L11.376 24Z"/>
</svg>
```
</File>
</Accordion>
## Next steps
<CardGroup cols={2}>
<Card title="What your customers see" icon="browser" href="https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see">
The approval page, spend caps, and emails that your customers see, so that you can support them
</Card>
<Card title="Test and publish your app" icon="rocket" href="https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish">
Add test users, publish your app, and change or delete it
</Card>
</CardGroup>
manage-claude/oauth-apps/linked-billing/manage-customers New page · 476 lines, new page
## Before you begin ## View customers and usage ## Check whether a customer is linked ## Unlink a customer ## Link a customer again ## Move a customer to another organization ## Move a customer from their API key to Linked billing ## Decide how often to check whether customers are linked ## Implementation details, rules, and special cases ### If you unlink through the Claude API ### If the unlink endpoint returns a 503 ### If a status check or the unlink endpoint refuses a request ### If you read usage from your back end ### For agents ## Next steps
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: Manage linked customers
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers
description: "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."
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
After customers link, you manage them from the Claude Console and from your back end. Each customer has a [user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles) 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](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#save-the-connection-and-its-tokens).
* **To check a customer’s status or use the unlink endpoint:** your app’s [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account) with an access token from [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/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](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-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](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#if-you-read-usage-from-your-back-end).
## View customers and usage
Open the [User profiles](https://platform.claude.com/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](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#spend-caps) do that.
## Check whether a customer is linked
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](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#authenticate-from-your-workload). Set the variable only where you run cURL: the SDK and CLI would use it in place of federation.
<CodeGroup exclude="shell:CLI, python, typescript, csharp, go, java, php, ruby">
```bash 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"
```
</CodeGroup>
In the response, `connection_status.type` describes the profile’s connection to your app:
| `connection_status.type` | In the Console | Meaning |
| ----- | ----- | ----- |
| `connected` | **Linked** | A connection to your app is active |
| `disconnected` | **Unlinked** | The profile was linked, and its connections have ended |
| `not_connected` | **Not linked** | The 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](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#while-billing).
For a `disconnected` profile, these fields say more. The reasons listed are examples:
| Field | What it says |
| ----- | ----- |
| `last_revoked_at` | When the last connection ended |
| `last_revoked_reason.type` | Why. `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.
## Unlink a customer
<Warning>
Unlinking stops new requests that bill the customer until you exchange the code of a new approval.
</Warning>
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.
<CodeGroup exclude="shell:CLI">
```bash cURL
curl https://auth.claude.com/v1/oauth/revoke \
-H "content-type: application/json" \
-d @- <<'JSON'
{
"connection_id": "ocon_01HV9Z",
"client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV",
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"client_assertion": "YOUR_CLIENT_ASSERTION_JWT"
}
JSON
```
<CodeGroupItem language="CLI">
The `ant` CLI has no command for `auth.claude.com`. Send the request with cURL or in your application’s language.
</CodeGroupItem>
```python Python
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"])
```
```typescript TypeScript
import { readFile } from "node:fs/promises";
// The connection ID that you stored when you linked the customer
const connectionId = "ocon_01HV9Z";
const jwt = await readFile(process.env.CLIENT_ASSERTION_FILE!, "utf8");
const response = await fetch("https://auth.claude.com/v1/oauth/revoke", {
method: "POST",
redirect: "error",
signal: AbortSignal.timeout(10_000),
headers: { "content-type": "application/json" },
body: JSON.stringify({
connection_id: connectionId,
client_id: "clid_01ABcDeFgHiJkLmNoPqRsTuV",
client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
client_assertion: jwt.trim()
})
});
if (!response.ok) {
throw new Error(`Revoke failed: ${response.status} ${await response.text()}`);
}
const result = (await response.json()) as { revoked_connection_ids: string[] };
console.log(result.revoked_connection_ids);
```
```csharp C#
using System.Net.Http.Json;
using System.Text.Json;
// The connection ID that you stored when you linked the customer
var connectionId = "ocon_01HV9Z";
var assertionFile = Environment.GetEnvironmentVariable("CLIENT_ASSERTION_FILE")!;
var jwt = await File.ReadAllTextAsync(assertionFile);
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(10) };
using var response = await http.PostAsJsonAsync(
"https://auth.claude.com/v1/oauth/revoke",
new Dictionary<string, string>
{
["connection_id"] = connectionId,
["client_id"] = "clid_01ABcDeFgHiJkLmNoPqRsTuV",
["client_assertion_type"] = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
["client_assertion"] = jwt.Trim(),
}
);
if (!response.IsSuccessStatusCode)
{
var details = await response.Content.ReadAsStringAsync();
throw new HttpRequestException($"Revoke failed: {(int)response.StatusCode} {details}");
}
var result = await response.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine(result.GetProperty("revoked_connection_ids"));
```
```go Go
import (
"bytes"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
"time"
)
func main() {
// The connection ID that you stored when you linked the customer
connectionID := "ocon_01HV9Z"
jwt, err := os.ReadFile(os.Getenv("CLIENT_ASSERTION_FILE"))
if err != nil {
log.Fatal(err)
}
body, err := json.Marshal(map[string]string{
"connection_id": connectionID,
"client_id": "clid_01ABcDeFgHiJkLmNoPqRsTuV",
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"client_assertion": strings.TrimSpace(string(jwt)),
})
if err != nil {
log.Fatal(err)
}
httpClient := &http.Client{Timeout: 10 * time.Second}
endpoint := "https://auth.claude.com/v1/oauth/revoke"
response, err := httpClient.Post(endpoint, "application/json", bytes.NewReader(body))
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
if response.StatusCode/100 != 2 {
details, _ := io.ReadAll(response.Body)
log.Fatalf("revoke failed: %d %s", response.StatusCode, details)
}
var result struct {
RevokedConnectionIDs []string `json:"revoked_connection_ids"`
}
if err := json.NewDecoder(response.Body).Decode(&result); err != nil {
log.Fatal(err)
}
fmt.Println(result.RevokedConnectionIDs)
}
```
```java Java
import module java.base;
import module java.net.http;
import com.fasterxml.jackson.databind.ObjectMapper; // Jackson comes with the Anthropic SDK
void main() throws Exception {
// The connection ID that you stored when you linked the customer
var connectionId = "ocon_01HV9Z";
var jwt = Files.readString(Path.of(System.getenv("CLIENT_ASSERTION_FILE")));
var mapper = new ObjectMapper();
var body = mapper.createObjectNode()
.put("connection_id", connectionId)
.put("client_id", "clid_01ABcDeFgHiJkLmNoPqRsTuV")
.put("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer")
.put("client_assertion", jwt.strip());
var request = HttpRequest.newBuilder(URI.create("https://auth.claude.com/v1/oauth/revoke"))
.header("content-type", "application/json")
.timeout(Duration.ofSeconds(10))
.POST(HttpRequest.BodyPublishers.ofString(body.toString()))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() / 100 != 2) {
throw new IOException("Revoke failed: " + response.statusCode() + " " + response.body());
}
IO.println(mapper.readTree(response.body()).get("revoked_connection_ids"));
}
```
```php PHP
// The connection ID that you stored when you linked the customer
$connectionId = 'ocon_01HV9Z';
$jwt = file_get_contents((string) getenv('CLIENT_ASSERTION_FILE'))
?: throw new \RuntimeException('Cannot read the client assertion file');
$body = json_encode([
'connection_id' => $connectionId,
'client_id' => 'clid_01ABcDeFgHiJkLmNoPqRsTuV',
'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
'client_assertion' => trim($jwt),
], JSON_THROW_ON_ERROR);
$context = stream_context_create(['http' => [
'method' => 'POST',
'header' => 'content-type: application/json',
'content' => $body,
'timeout' => 10,
'ignore_errors' => true, // keep the body of an error response
]]);
$response = file_get_contents('https://auth.claude.com/v1/oauth/revoke', context: $context);
$status = http_get_last_response_headers()[0] ?? '';
if ($response === false || !preg_match('{^HTTP/\S+ 2}', $status)) {
throw new \RuntimeException("Revoke failed: {$status} {$response}");
}
/** @var array{revoked_connection_ids: list<string>} $result */
Cut at 300 lines. The page has the rest.
manage-claude/oauth-apps/linked-billing/set-up-your-app New page · 241 lines, new page
## Before you begin ## Create the app ## Set up client authentication ## Give your back end an identity ### Choose the operator service account ### Choose the default workspace ## Choose whether to get refresh tokens ## Check the result ## Decide whether to use a separate test app ## Rules and special cases ### If you change scopes ### If you change the service account ### If you move to another workspace ### If you still use the deprecated scope ## Next steps
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: Set up your app for Linked billing
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app
description: Register your product as an OAuth app in the Claude Console and give your back end an identity that can bill your customers with Linked billing.
featureMetadata:
status: beta
betaHeader: user-profiles-billing-2026-10-01
supportedModels:
- claude-fable-5-2
- claude-mythos-5-2
- claude-fable-5-1
- claude-mythos-5-1
- claude-fable-5
- claude-mythos-5
- claude-mythos-preview
- claude-opus-5-5
- claude-opus-5
- claude-sonnet-5-5
- claude-sonnet-5
- claude-haiku-5-5
- claude-haiku-4-5-20251001
- claude-opus-4-8
- claude-opus-4-7
- claude-opus-4-6
- claude-sonnet-4-6
- claude-opus-4-5-20251101
- claude-sonnet-4-5-20250929
supportedPlatforms:
Claude API:
availability: beta
note: Only requests that send `billing_policy` need the beta header.
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
With [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing), your customers pay for the Claude usage in your product through their own Claude organization. Before any customer can link, you set up your app once in the Claude Console.
When you’re done, your app has a client ID, [client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication), an [operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account), and a [default workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#default-workspace). You’ve also chosen [whether to get refresh tokens](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#choose-whether-to-get-refresh-tokens). The end of the page covers changes to an app that customers already use.
## Before you begin
* **The Admin role:** You need the Admin role in your Claude organization for every step on this page.
* **An identity provider for your back end:** Your back end proves who it is with short-lived tokens from your own identity provider, through Workload Identity Federation.
* **An organization that Anthropic bills directly:** Your organization must pay Anthropic directly for its API usage, through prepaid credits or invoiced billing. An organization billed through a cloud marketplace can’t bill customers this way.
If your identity provider isn’t among the [identity providers](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#identity-providers), you can register any OpenID Connect provider as a [federation issuer](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#federation-issuers).
## Create the app
The app is your product’s registration with Anthropic. It ties your redirect URI, the address in your product that receives the browser after a customer approves, to a client ID.
1. On the [OAuth apps](https://platform.claude.com/settings/oauth-apps) page in the Console, click **Create**.
2. Enter your app’s name and redirect URI.
* **Name:** Customers see it when they approve, so start it with your product’s name, as “Example Analytics for Claude” does. It can’t start with “Claude” or “Anthropic” or a look-alike, and it can’t put “official” next to either.
* **Redirect URI:** The address must follow the [redirect URI rules](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#redirect-uri-rules).
3. Under **What the app can do**, make sure that **Bill and link to organizations** is selected. This gives the app the `billing:attribution` scope, which lets it bill your customers.
4. Select the checkbox **I accept Linked Billing Terms on behalf of** your organization and click **Continue**. Those terms are the [Linked Billing Beta Terms](https://www.anthropic.com/legal/linked-billing-terms).
5. When the dialog box asks for client authentication, click **Skip for now**. The Console creates the app, and you set up client authentication in the next section. Until then, the app’s page warns that it can’t authenticate.
6. Copy the **Client ID** at the top of the app’s page. It starts with `clid_`. Every request to `auth.claude.com`, Anthropic’s authorization server, carries it, including the redirect that sends a customer to the approval page. The client ID is public.
7. On the **Appearance** tab, enter your homepage and click **Save changes**.
8. Upload your logo, a square PNG or JPEG file, 256 to 2,048 pixels a side and at most 2 MB. It saves at once. Without a logo, customers see your app’s initials.
A new app starts in testing. Until it’s live, only people on its **Test users** list can link it: see [Publish the app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#publish-the-app).
## Set up client authentication
Your back end proves that a request to `auth.claude.com` comes from your app with a client assertion: a short-lived JWT that your identity provider issues to your back end. Anthropic doesn’t issue client secrets for OAuth apps. To set up client authentication:
1. On the app’s **Client authentication** tab, select your **Identity provider**, the issuer that signs your back end’s tokens, such as AWS, Google Cloud, or Kubernetes. To add one, click **Register a new issuer**, fill it in, and click **Register**, or see [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation).
2. Set a **Subject pattern** that your back end’s tokens match in their `sub` claim, or set claim conditions under **Advanced match options**. `auth.claude.com` accepts any token from your identity provider that matches them, so make them as narrow as your back end allows. For the pattern’s syntax, see [Rule matching semantics](https://platform.claude.com/docs/en/manage-claude/wif-reference#rule-matching-semantics).
3. Click **Save**. The tab then displays the **Expected audience**.
4. Have your identity provider issue your back end’s client assertions with exactly that audience in their `aud` claim. Keep their lifetime short, within your issuer’s [maximum lifetime](https://platform.claude.com/docs/en/manage-claude/wif-reference#jwt-verification), 1 hour by default: anyone who intercepts a client assertion can use it until it expires.
For every claim that a client assertion must contain, see [Client assertion claims](https://platform.claude.com/docs/en/manage-claude/oauth-apps/endpoints-and-parameters#client-assertion-claims).
## Give your back end an identity
Your back end calls the Claude API as a service account, which is a non-human account in your Claude organization. The one that you choose as the app’s operator is the only account that can bill your linked customers. It bills in one of two ways:
* With its own credential, naming a customer’s [user profile](https://platform.claude.com/docs/en/manage-claude/user-profiles)
* Through a customer’s [own OAuth access token](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer), which counts as that account and can bill only that customer
### Choose the operator service account
The service account authenticates with its own federation rule, which is separate from client authentication. Client authentication proves that a request to `auth.claude.com` comes from your app. The federation rule lets your back end call the Claude API as the service account.
1. [Create a service account and its federation rule](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation#set-up-federation).
* **An account of its own:** Use a service account that isn’t the operator of another app, because each app needs its own.
* **The rule’s scope:** Keep the default scope, `workspace:developer`, which your back end needs to create user profiles, check whether customers are linked, and unlink them. Don’t add `org:admin`, which covers the whole Admin API.
* **The rule’s audience:** If you leave it blank, it usually differs from your app’s **Expected audience**, so you need two JWTs: see [when the two audiences differ](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#if-the-audiences-differ).
2. On the app’s **Client authentication** tab, under **Operator service account**, select the service account and click **Save**.
<Warning>
Once customers are linked, changing or archiving the operator service account can stop some or all billing as your app.
</Warning>
A change stops customers’ OAuth tokens from billing, and an archive stops all billing as your app. To recover from either, see [If you change the service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-change-the-service-account).
### Choose the default workspace
Requests that use a customer’s own access token run in one workspace of your organization, the app’s default workspace. Every new app needs one, even if you never use those tokens. In the last step of linking, your back end exchanges a one-time code for a connection to the customer’s organization. Without a default workspace, that exchange fails with `unauthorized_client`. That refusal doesn’t use up the code, so you can set the workspace and send the same code again within its 5 minutes.
The setting appears once an operator service account is saved:
1. On the app’s **Client authentication** tab, under the operator service account, find **Default workspace for platform auth mode OAuth tokens** (the app’s `connection_token_workspace_id` setting) and click **Choose workspace**.
2. Select a workspace that isn’t archived and that the service account is a member of, and click **Save**. Every service account is a member of your organization’s built-in workspace named **Default**, so you can always select that one.
<Warning>
Once a customer is linked, don’t archive the app’s default workspace: archiving revokes every OAuth token that runs in it, and it can’t be undone.
</Warning>
To use another workspace, follow [If you move to another workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-move-to-another-workspace).
## Choose whether to get refresh tokens
Each connection gives you an access token for its customer, which can bill only that customer and expires within 1 hour. A refresh token gets new access tokens without asking the customer again. What decides is how your back end bills:
* **Only with the operator service account’s own credential:** Leave **Offline access** off.
* **With customers’ own access tokens:** Turn on **Offline access**. You bill this way if code that you don’t fully control calls Claude for a customer, such as an agent in a sandbox. You also bill this way if you want every billed request to use the customer’s own access token.
To get refresh tokens, go to the app’s **Permissions** tab and turn on **Offline access**, which lets you ask for the `offline_access` scope. Then, ask for `billing:attribution offline_access` when you [send each customer to approve](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer#send-them-to-approve). Turn it on before your customers link. If you turn it on later, each linked customer must [approve again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#implementation-details) to give you a refresh token. You don’t unlink them first.
If the **Permissions** tab also lists the deprecated scope `org:billing_attribution`, removing it can’t be undone: see [If you still use the deprecated scope](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#if-you-still-use-the-deprecated-scope).
## Check the result
On the app’s page in the Console, check these:
* The page displays no warning that the app can’t authenticate.
* The **Client authentication** tab displays your identity provider and its **Expected audience**.
* The same tab displays your operator service account and the app’s default workspace.
* The **Permissions** tab displays `billing:attribution` turned on under **Billing**.
* If you chose refresh tokens, the **Permissions** tab also displays **Offline access** turned on.
A saved change can take a few minutes to reach `auth.claude.com`. Wait a few minutes after your last change before you link a customer.
## Decide whether to use a separate test app
A new app starts in testing, so you can try linking with your production app and its test users. You can also register a separate app for testing. Each app has its own connections, test users, status, and operator service account.
<Warning>
Keep Linked billing on one production app for as long as you offer it: a customer’s connection works only with the app that they linked.
</Warning>
## Rules and special cases
These cases come up when you change an app that customers already use or when your app still uses the deprecated scope. Two terms recur:
* **Approve again:** Send the customer through the same approval as when they first linked. Use their existing user profile, and don’t unlink them first.
* **Link again:** Follow [Link a customer again](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again), which covers each case.
### If you change scopes
To give a linked customer a refresh token:
1. Turn on **Offline access** on the **Permissions** tab.
2. Have the customer approve again, asking for the scopes `billing:attribution offline_access`.
3. Replace the stored connection ID with the new one that the code exchange returns.
If a pushed authorization request asks for a scope the app doesn’t have, `auth.claude.com` refuses it with `invalid_scope`. It also refuses one sent in the few minutes after you change the app’s scopes, before the change reaches it: wait and send it again.
### If you change the service account
After you change or archive the operator service account, `auth.claude.com` refuses every refresh of a working token with `unauthorized_client`. A token that was already revoked or has expired gets `invalid_grant` after a change and can get either error after an archive.
**If you changed it:**
| Request | Result |
| ----- | ----- |
| With a customer’s access token that you hold or as the earlier service account | Stops billing customers shortly after the change |
| As the new operator service account | Can still bill your linked customers unless you [turned off operator-only authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#turn-off-operator-only-authentication), which lets only customers’ own access tokens bill |
To recover, make sure that your back end authenticates as the new operator service account. The account must be a member of the app’s default workspace. Then, link again each customer whose tokens you use. Customers whom you bill only as the operator service account need nothing more.
**If you archived it:** Nothing can bill as your app, and `auth.claude.com` refuses every code exchange, until the app has a new operator service account. The Console says that the service account no longer exists and displays a **Delete app** button, but you don’t need to delete the app. If the app’s default workspace is archived too, the Console can’t select a new service account: contact [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support).
A person with the Admin or Billing role at each customer has to link again, so agree on a time with them first. Then:
1. [Unlink each linked customer in the Console](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#unlink-a-customer). The unlink endpoint can’t do this, because it needs the archived account.
2. Create [another operator service account](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#service-account) and its federation rule. It must be a member of the app’s default workspace.
3. On the app’s **Client authentication** tab, click **Change** under **Operator service account**. Select the new service account and click **Change service account**.
4. Make sure that your back end authenticates as the new service account, and wait a few minutes.
5. Have each customer link again with their existing user profile, and store the new connection ID and OAuth tokens in place of the earlier ones.
### If you move to another workspace
Requests with a customer’s own access token run in the app’s default workspace. To move to another one, follow these steps in order. Don’t archive the earlier workspace before step 6: archiving revokes its customers’ OAuth tokens.
1. Make sure that the operator service account is a member of the new workspace.
2. On the app’s **Client authentication** tab, click **Change workspace**, select the new workspace, and click **Save**.
3. Wait a few minutes for the change to reach `auth.claude.com`. A refresh during the wait can return tokens that still run in the earlier workspace.
4. Refresh the OAuth tokens of every customer who has a refresh token.
5. Have each customer without a refresh token approve again with the same scope.
6. If you no longer need the earlier workspace, archive it.
If you archived the earlier workspace too soon, stop refreshing its customers at once. What happens next:
| When | Customer with a refresh token | Customer without one |
| ----- | ----- | ----- |
| Before you choose a new default workspace | Refreshes get `invalid_grant` | The access token stops working within a few minutes |
| After you choose one | A refresh ends the connection | Stays linked |
Once you choose a new default workspace, link again each customer who had a refresh token, and have each customer without one approve again.
### If you still use the deprecated scope
An app created before `billing:attribution` existed can have the deprecated scope `org:billing_attribution`. A customer who approved only that scope gets no token of their own, so you bill them only as the operator service account:
* The code exchange returns an `access_token`, but it isn’t a customer’s own access token. Don’t use it as one.
* Billing them stops when their connection ends or when you [turn off operator-only authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#turn-off-operator-only-authentication).
Two rules apply to the deprecated scope:
* **Send it alone:** With `billing:attribution` or `offline_access`, a pushed authorization request gets `invalid_scope`.
* **Removing it is final:** If you remove `org:billing_attribution` on the **Permissions** tab, you can’t add it back.
To give such a customer their own tokens:
1. On the app’s **Permissions** tab, turn on `billing:attribution` under **Billing** and turn on **Offline access**.
2. Make sure that the app has a [default workspace](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#default-workspace).
3. Have the customer approve again, asking for `billing:attribution offline_access`.
## Next steps
<CardGroup cols={1}>
<Card title="Link your Claude organization button" icon="link" href="https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button">
The button that sends a customer from your product to approve your app
</Card>
</CardGroup>
manage-claude/oauth-apps/linked-billing/test-and-publish New page · 225 lines, new page
## Before you begin ## Manage test users ### Add test users ### Remove a test user ## Publish the app ## Change a live app ## Change an app in testing or in review ## Delete the app ## Rules and special cases ### Domain rules ### If you can’t prove the domain ### If the app isn’t approved ### While a change is in review or not approved ### Caps while testing ### If your organization has invoiced billing ## Next steps
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: Test and publish your app
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish
description: Add test users, publish your Linked billing app so that any eligible customer can link it, and change the app once customers depend on it.
featureMetadata:
status: beta
betaHeader: user-profiles-billing-2026-10-01
supportedModels:
- claude-fable-5-2
- claude-mythos-5-2
- claude-fable-5-1
- claude-mythos-5-1
- claude-fable-5
- claude-mythos-5
- claude-mythos-preview
- claude-opus-5-5
- claude-opus-5
- claude-sonnet-5-5
- claude-sonnet-5
- claude-haiku-5-5
- claude-haiku-4-5-20251001
- claude-opus-4-8
- claude-opus-4-7
- claude-opus-4-6
- claude-sonnet-4-6
- claude-opus-4-5-20251101
- claude-sonnet-4-5-20250929
supportedPlatforms:
Claude API:
availability: beta
note: Only requests that send `billing_policy` need the beta header.
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
A new [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing) app starts in testing, where only the [test users](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#manage-test-users) you name can link their organizations to it. To open it to your customers, you prove your domain and [publish the app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#publish-the-app), and Anthropic reviews it. This page also covers how the [spend cap works while you test](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#caps-while-testing) and how to change or delete the app.
The [OAuth apps](https://platform.claude.com/settings/oauth-apps) page in the Claude Console displays each app’s status:
| Status | What it means |
| ----- | ----- |
| **Testing** | You haven’t published the app |
| **In review** | Anthropic is reviewing the app or a change to it |
| **Not approved** | Anthropic reviewed the app or the change and didn’t approve it |
| **Active** | The app is live: any [eligible customer](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#eligible-customers) can link to it |
If Anthropic invoices your organization for its API usage, your app skips the review: see [If your organization has invoiced billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#with-invoiced-billing).
## Before you begin
You need the Admin role in your organization and an app that’s [set up for Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app).
## Manage test users
Until your app is live, its **Who can link** setting reads **Test users only**, and you can’t change it. Only the people on its **Test users** list can link their organizations to it, and each app has its own list. The approval page refuses anyone else, and if they go back to your app, your app receives [`access_denied`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#access-denied). Each person who links while the app isn’t live must set a monthly spend cap of $50 USD or less: see [Caps while testing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#caps-while-testing).
### Add test users
Testing uses real money: Anthropic charges each test user’s organization for the requests that you bill to it, as for any customer. A test user [links an organization](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer) where they have the Admin or Billing role. That organization can’t be the one that owns the app. To test the app yourself, add your own address and link a second Claude organization of yours.
1. Open the app from the [OAuth apps](https://platform.claude.com/settings/oauth-apps) page in the Console.
2. On the **Settings** tab, find the **Test users** list under **Who can link**.
3. Enter the email address of a test user’s Claude account and click **Add**. Repeat for each test user.
4. Click **Save changes**.
The list has these rules:
* It holds up to 10 people.
* An address must match the account’s address exactly, but letter case doesn’t matter. `[email protected]` is a different address from `[email protected]`.
### Remove a test user
<Warning>
Removing a test user ends every connection to your app that they approved.
</Warning>
During a live app’s change review, that can include a connection to a customer’s organization. New requests that bill those organizations typically stop within about 10 seconds and are refused with [`user_profile_billing_not_authorized`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-billing-not-authorized). A request with an ended connection’s access token can get a [`401 authentication_error`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#authentication-error) instead. To remove someone:
1. If the **Settings** tab has unsaved changes, click **Save changes** or **Discard**. The Console doesn’t let you remove a saved test user until you do.
2. Remove the person’s address from the **Test users** list.
3. When the Console asks, click **Remove**. You don’t need to click **Save changes**.
## Publish the app
Publishing can ask you to add a DNS record that proves you control your app’s domain. A DNS change can take up to 48 hours to take effect, so publish well before you need customers to link. Before you publish, check these things:
* [Client authentication](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/set-up-your-app#set-up-client-authentication) is set up. You can’t publish until it is.
* The app has a homepage, set on its **Appearance** tab, on a domain of your own. A hosting service’s shared domain doesn’t qualify.
* You can change the DNS records of the homepage’s domain.
* Each redirect URI is on the homepage’s hostname, without a leading `www.`, or a subdomain of it. For the exceptions, see [Domain rules](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#domain-rules).
To publish the app:
1. Save any unsaved changes on the app’s tabs, because the Console doesn’t let you publish until you do. Then, click **Publish app** on the app’s page.
2. If the dialog box displays **Prove your domain**, add the DNS TXT record that it gives you, where you manage DNS for your domain. Then, click **Check**. If the domain doesn’t read **Proven**, see [If you can’t prove the domain](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#if-you-cant-prove-the-domain). When it reads **Proven**, click **Continue**.
3. If the dialog box displays a checkbox to accept the Linked Billing Terms, select it. They’re the [Linked Billing Beta Terms](https://www.anthropic.com/legal/linked-billing-terms).
4. Click **Publish app** in the dialog box.
The app’s status is then **In review**. During the review and after a **Not approved** result, your test users keep their connections, and you can still add and remove test users. When the review ends, the app’s page displays the result, and Anthropic usually emails it to the person who published the app:
* **Approved:** The app is live, and its status on the OAuth apps page reads **Active**. **Who can link** reads **Any Claude user**, the Console hides the **Test users** list, and test users’ connections stay.
* **Not approved:** You can’t publish the app again yourself: see [If the app isn’t approved](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#if-the-app-isnt-approved).
With invoiced billing, Anthropic doesn’t review your app: see [If your organization has invoiced billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#with-invoiced-billing).
## Change a live app
<Warning>
Changing a live app’s name, logo, homepage, or redirect URIs limits new connections to test users until Anthropic approves the change.
</Warning>
Until Anthropic approves the change:
* Customers who already linked stay linked, and the requests that you bill to them keep working.
* A customer who unlinks can link again only through a person on the **Test users** list.
* A change to a cap follows [Caps while testing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#caps-while-testing).
If Anthropic rejects the change, the limit stays: see [If the app isn’t approved](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#if-the-app-isnt-approved). For the rest of the rules, see [While a change is in review or not approved](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#while-a-change-is-in-review).
A change takes effect as soon as the Console saves it, so customers see it before the review ends. Changes to the app’s permissions or client authentication don’t start a review, and with [invoiced billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#with-invoiced-billing), no change does.
To change the name, homepage, or redirect URIs:
1. Change the app on its **Appearance** tab (name and homepage) or its **Settings** tab (redirect URIs).
2. Click **Save changes**. A dialog box opens before anything is saved.
3. If the dialog box displays **Prove your domain**, prove each domain that it names, one at a time. For each, add its DNS TXT record, click **Check**, and when it reads **Proven**, click **Next domain** or **Continue**. For which domains it names, see [Domain rules](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#domain-rules).
4. Click **Save and send**, which saves the change and sends it to review.
To change the logo, upload or remove it on the **Appearance** tab, then click **Send to review** in the dialog box that opens. If you cancel, the logo doesn’t change.
While Anthropic reviews the change, the app’s status reads **In review**. When the review ends, Anthropic usually emails the result to the person who saved the change.
## Change an app in testing or in review
Follow this section while the app’s status is **Testing**, **In review**, or **Not approved**. That includes a live app whose change is in review. Change the app on its **Appearance** tab (name, logo, and homepage) or its **Settings** tab (redirect URIs), then click **Save changes**. A logo change saves when you upload or remove the logo.
No dialog box asks you to confirm, and the status doesn’t change. During a review, the change replaces what Anthropic reviews with the app as you edited it.
The Console checks an app in testing for proven domains only when you publish. While the status is **In review**, the homepage and every redirect URI that isn’t local must already be on proven domains of your organization. Otherwise, the Console refuses the change and doesn’t ask you to prove a domain. To move to a domain that isn’t proven, wait until the review ends.
## Delete the app
<Warning>
Deleting an app unlinks every customer and can’t be undone.
</Warning>
Requests that bill a customer are refused, every OAuth token is revoked, and the client ID stops working. Anthropic doesn’t email your customers, so tell them first. To delete the app:
1. On the app’s **Settings** tab, save or discard any unsaved changes.
2. Under **Danger zone**, click **Delete app** and confirm with **Delete app**. The app’s row menu on the [OAuth apps](https://platform.claude.com/settings/oauth-apps) page also has **Delete**.
To offer Linked billing again, create a new app, and have each customer link it. The new app starts in testing with a new client ID, and customers’ spend caps don’t carry over.
## Rules and special cases
The rest of this page covers the rules behind publishing and changing an app. It also covers cases such as a domain that won’t prove.
### Domain rules
A domain is a hostname without a leading `www.`, so a homepage at `https://www.example.com` has the domain `example.com`. Your domain is your homepage’s. A proven domain covers itself and its subdomains, and it stays proven.
* **Local redirect URIs:** Redirect URIs on `localhost`, `127.0.0.1`, or `[::1]` don’t have to be on the homepage’s domain.
* **Sibling subdomains:** A homepage on `app.example.com` doesn’t cover a redirect URI on `auth.example.com`. Put the homepage on `example.com` to cover both.
* **Domains your organization has already proven:** If they cover the homepage and every redirect URI that isn’t local, publishing skips **Prove your domain**. The redirect URIs then don’t have to be on the homepage’s domain.
When you change a live app, the Console asks you to prove a domain only if you changed the homepage or a redirect URI. It then checks every domain of the app, changed or not, and names each one that no proven domain of your organization covers. After such a change, redirect URIs can be on domains other than the homepage’s, if your organization proves each one. The Console doesn’t check local redirect URIs, but changing one still sends the app to review.
### If you can’t prove the domain
* **The domain still reads Not proven:** The DNS change hasn’t taken effect. Close the dialog box and come back later. If you were publishing, click **Publish app** again. If you were changing a live app, make the same edit again: the Console gives you the same record until it expires.
* **Check says that the record has expired:** A record works for 30 days from when the Console first displays it. Click **Get a new record** and add the new record.
* **The dialog box displays a message in place of a record:** The message might say, for example, that your organization already has 20 domain names. You can’t continue until that’s resolved. For help, contact [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support).
### If the app isn’t approved
You can’t publish the app again yourself, and a change doesn’t start a new review. To ask for another review, contact [Anthropic support](https://support.claude.com/en/articles/9015913-how-to-get-support). After a rejected change to a live app, the change stays in effect, and new connections stay limited to your test users.
### While a change is in review or not approved
From when you send a live app’s change to review until Anthropic approves it:
* **New connections:** **Who can link** goes back to **Test users only**. The Console displays the **Test users** list again with the people who were on it before.
* **Test users:** You can add and remove people.
* **Caps already set:** A linked organization keeps its cap setting, even above $50 USD or with no cap.
When the review ends, one of these happens:
* **Approved:** The app is live again. Any eligible customer can link, the Console hides the **Test users** list, and the testing cap rules stop.
* **Not approved:** The status changes to **Not approved**, and these rules still apply.
### Caps while testing
A customer’s spend cap for your app limits what you can bill them each month. The approval page calls it a monthly spend limit. These rules apply to the person who links and to the customer’s Admin and Billing members in the Console:
| Cap setting | While the app is in testing, in review, or not approved | While it’s live |
| ----- | ----- | ----- |
| A spend cap on the approval page | Required, $50 USD or less | Optional |
| The amount field on the approval page | Starts at $50 USD | Starts empty |
| **Continue without a limit** | Not offered | Offered |
| Removing the cap in the Console | Not possible | Possible |
| The largest cap they can set | $50 USD | No practical maximum |
Once the app is live, a cap that a customer saved while it was in testing stays in place. The customer can then raise or remove it. For the other rules on caps, see [Spend caps in What your customers see](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#spend-caps).
### If your organization has invoiced billing
With invoiced billing, Anthropic invoices your organization for its API usage, and your organization doesn’t buy prepaid credits. Your app still starts in testing, and the rules for test users and caps still apply. After that, three things differ:
* To publish, click **Publish app** and then click **Publish app** in the dialog box. Anthropic doesn’t review the app, so it’s live as soon as you publish it.
* You prove no domain, and the app needs no homepage to publish. The rule for redirect URIs doesn’t apply. Client authentication still has to be set up first.
* A change to the live app saves when you click **Save changes** or when you upload or remove a logo. No domain check, confirmation, or review follows.
## Next steps
<CardGroup cols={2}>
<Card title="Manage linked customers" icon="list" href="https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers">
See usage, check whether a customer is linked, and unlink or link them again
</Card>
<Card title="Use a separate credential for each customer" icon="lock" href="https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer">
Limit a credential to one customer, for single-tenant products and sandboxes
</Card>
</CardGroup>
manage-claude/oauth-apps/linked-billing/what-your-customers-see New page · 139 lines, new page
## How it works ### Approving your app ### After linking ### Spend caps ### Emails ## Decide how to keep customers informed ## Next steps
A whole new page. There's nothing to diff it against, so here is what it says.
---
title: What your customers see
url: https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see
description: "Explain Linked billing to your customers: the approval page, their spend cap for your app, how a connection ends, and the emails they get."
featureMetadata:
status: beta
betaHeader: user-profiles-billing-2026-10-01
supportedModels:
- claude-fable-5-2
- claude-mythos-5-2
- claude-fable-5-1
- claude-mythos-5-1
- claude-fable-5
- claude-mythos-5
- claude-mythos-preview
- claude-opus-5-5
- claude-opus-5
- claude-sonnet-5-5
- claude-sonnet-5
- claude-haiku-5-5
- claude-haiku-4-5-20251001
- claude-opus-4-8
- claude-opus-4-7
- claude-opus-4-6
- claude-sonnet-4-6
- claude-opus-4-5-20251101
- claude-sonnet-4-5-20250929
supportedPlatforms:
Claude API:
availability: beta
note: Only requests that send `billing_policy` need the beta header.
---
<Warning>
Claude Platform OAuth is a Beta Service: prerelease software provided under your agreement with Anthropic, such as the [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms), and the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Endpoints, parameters, and behavior can change during the beta. It might not be suitable for production use.
</Warning>
With [Linked billing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing), your customers approve your app, set any [spend cap](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#spend-caps) for it, and unlink it on Anthropic’s pages, not in your product. Anthropic also sends them emails. Your product and support teams can use this page to explain Linked billing to customers. Your engineers can use it to plan for what your app can’t see.
## How it works
For example, an Admin at Acme approves your app on Claude’s approval page and sets a monthly spend cap of $200 USD for it. Later, Acme can change the cap or unlink your app on its [Linked platforms](https://platform.claude.com/linked-platforms) page. Anthropic emails Acme’s Admin and Billing members when the connection is made and when Acme unlinks your app. It also emails them when spend reaches 80 percent of the cap.
### Approving your app
The approval page is on `auth.claude.com`. It uses whichever Claude account is signed in to the browser and offers only that account’s Claude organizations. The person who approves needs the Admin or Billing role in the organization that they link. Every screen displays your app’s name and has a **Cancel** button:
| Screen | What the person does |
| ----- | ----- |
| **Select an organization** | Selects the Claude organization to link (appears only if they have a choice) |
| **How billing works** | Reads that the organization pays for this usage at its own rates and clicks **Continue** |
| **Set a monthly spend limit** | Enters your app’s spend cap in whole US dollars or clicks **Continue without a limit** and confirms |
| The last screen | Reviews what your app can do, including the cap, and clicks **Link and authorize** |
On the **Set a monthly spend limit** screen, the amount field starts empty. **Continue without a limit** saves no new cap. A cap that the customer saved earlier for your app still applies. Without one, their [default cap](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#spend-caps) applies. Until your app is live, other rules apply: see [Caps while testing](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#caps-while-testing).
After **Link and authorize**, the browser goes back to your app with no confirmation screen.
In these cases, the approval goes differently:
* **The wrong account is signed in:** The person might be signed in with a personal account instead of a work account, for example. The page displays which account is signed in and lets the person switch. Your app can’t choose the account: the OpenID Connect parameters `prompt=select_account` and `login_hint` don’t change it. The page can also ask a signed-in person to sign in again.
* **The account belongs to no Claude Platform organization:** The page offers **Set up Claude Platform**, which opens the Claude Console to create an organization and then returns to the approval. Until that organization has billing set up, requests billed to it get [`user_profile_not_billable`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-not-billable).
* **The person has no organization that they can link:** They don’t have the Admin or Billing role in any Claude organization that’s [eligible to link](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#eligible-customers), so the page has no organization to offer. If they go back to your app, it receives the `access_denied` error. For its other causes, see [`access_denied` in Linked billing errors](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#access-denied).
* **The person clicks Cancel:** No connection is made. When the browser comes back, your app receives `access_denied`.
### After linking
The connection belongs to the customer’s whole Claude organization, not to the person who approved it, so it stays if that person leaves. The customer manages it on the [Linked platforms](https://platform.claude.com/linked-platforms) page in their Claude Console. There, a member with the Admin or Billing role can see what your app has cost this month. They can also set a spend cap for it. To unlink it, they click your app, then **Unlink**, and confirm in the dialog box.
A connection ends in these ways, and some of them email the customer’s Admin and Billing members:
| How the connection ends | Email to the customer |
| ----- | ----- |
| The customer unlinks your app | Yes, without naming who unlinked it |
| Your back end ends the connection through the API | Yes |
| An Admin of your organization unlinks the customer in the Console | No |
| Your back end [reuses a refresh token](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/credential-for-each-customer#if-a-refresh-fails) more than 30 seconds after its first use | No |
| You remove the test user who approved it from your app’s **Test users** list | No |
| The customer approves again with other scopes, which replaces the connection with a new one, so the customer stays linked | No |
| You [delete your app](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/test-and-publish#delete-the-app), which ends every connection at once | No |
If your app still exists and no new connection replaces the ended one, requests billed to that customer are typically refused within about 10 seconds. The error is [`user_profile_billing_not_authorized`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#user-profile-billing-not-authorized). A request with the ended connection’s access token can get a [`401 authentication_error`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#authentication-error) instead. Their profile reads **Unlinked** on your User profiles page, and you can [link them again with the same profile](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#link-a-customer-again).
### Spend caps
Your app’s spend cap is an amount in US dollars that limits what your app can bill a customer each month. The approval page labels it a monthly spend limit. Two other settings are easy to confuse with it:
* **The organization’s Monthly spend limit:** It limits all of the organization’s usage and is set under [Spend limits](https://platform.claude.com/settings/billing#spend-limits). Your app’s cap can be higher than it.
* **The customer’s default cap:** It applies in full to each linked app that has no cap of its own.
Your app’s cap or the organization’s limit can refuse the requests that you bill to the customer, with the [`linked_organization_spend_limit_reached`](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/errors#linked-organization-spend-limit-reached) error. So can a lack of [credit that can pay](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing#which-credits-can-pay). The error doesn’t say which. Your app’s cap works this way:
* Refusals last until 00:00 UTC on the first day of the next month or until the customer raises or removes the cap.
* The cap counts token costs and web search fees at list prices, before any negotiated discount. The customer’s bill can therefore differ from what the cap counts, and a customer with a discount can reach the cap before their bill does.
* The request that crosses the cap is still served, and requests already running finish. The total can therefore end above the cap, by more when many requests run at once.
* A change to the cap takes about a minute to apply. The smallest cap is $0 USD, which refuses every request. The Console takes whole dollars and has no practical maximum once your app is live.
* Anthropic emails the customer’s Admin and Billing members at 80 percent of the cap and again at the cap, except for a $0 USD cap.
On the Linked platforms page, a member with the Admin or Billing role manages caps:
* **Set or change your app’s cap:** Click your app, then **Set spend cap** or **Edit spend cap**.
* **Set a default cap:** Under **Default spend cap**, click **Set default** or **Edit**.
* **Remove your app’s cap:** Click your app, **Edit spend cap**, and then **Remove cap**. Your app then uses the default cap or has no cap.
### Emails
Anthropic emails the customer at these times:
* When linking completes
* When a connection ends in one of the [ways that send email](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#after-linking)
* At [80 percent of a cap and at the cap](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/what-your-customers-see#spend-caps)
Emails about linking and unlinking link to the customer’s Linked platforms page. Some organizations get no emails at all. Whether linking sends an email depends on the code exchange:
| Event | Email to the customer |
| ----- | ----- |
| Your back end exchanges the code after the customer approves | Yes |
| The customer approves, but your back end never exchanges the code | No |
| The customer approves again while still linked | No |
## Decide how to keep customers informed
Your app can’t see some of what the customer sees, so plan what your product tells them:
* **Unlinks:** Anthropic doesn’t tell you when a customer unlinks: you get no webhook event and no email. [Decide how often to check](https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/manage-customers#decide-how-often-to-check-link-status) whether customers are still linked.
* **Caps:** You can’t see a customer’s cap or how much of it they’ve used. When requests are refused with `linked_organization_spend_limit_reached`, ask the customer to check their cap for your app, their organization’s **Monthly spend limit**, and their credit.
* **Emails:** Anthropic doesn’t guarantee that an email is sent or delivered. Tell the customer yourself whenever you unlink them, and don’t rely on email to tell them that they’re linked.
## Next steps
<CardGroup cols={2}>
<Card title="Link your Claude organization button" icon="code" href="https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-button">
The button’s HTML, CSS, colors, and logo
</Card>
<Card title="Link and bill a customer" icon="link" href="https://platform.claude.com/docs/en/manage-claude/oauth-apps/linked-billing/link-and-bill-a-customer">
Link a customer and bill requests to them, starting with a test customer
</Card>
</CardGroup>
manage-claude/oauth-apps/oauth-reference Page removed · 274 lines, page removed
## Endpoints ## Client authentication ### Client assertion claims ## Authorization request parameters ## Scopes ## Token request ## OAuth tokens for a billing connection ## Revocation ## Lifetimes ## Redirect URI rules ## Errors ### Errors on the redirect ### Errors from the PAR and token endpoints ### Errors from the revocation endpoint ### Billing errors ## Standards ## Terms used on these pages
The page is gone upstream. What it last said is kept here.
manage-claude/oauth-apps/organization-billing-connections Page removed · 1884 lines, page removed
## Eligible customers and endpoints ### Which credits can pay ## Setup process ### Step 1: Create the app ### Step 2: Set up client authentication ### Step 3: Set up your back end’s identity ### Which user profile to link #### A user profile for each person ## Link each customer ### Step 4: Create a user profile for the customer ### Step 5: Create a pushed authorization request URL ### Step 6: Send your user to the Claude approval page ### Step 7: The user approves ### Step 8: Handle the callback and save the connection ### Test as a customer ### If linking doesn’t complete #### Your redirect URI receives `error=access_denied` #### Your app receives `user_profile_already_linked` #### Your redirect URI receives nothing #### The code exchange returns `unauthorized_client` ### Publish your app ## Update calls to Claude ### Your customer pays ### You pay ## OAuth tokens for each connection ### Set up your app ### Scopes for a billing connection ### Store the tokens ### Call Claude with a connection’s access token ### Refresh the tokens ### Run an agent in a sandbox ### Link a customer again ### Turn off operator-only authentication ### OAuth token snippet initialization ## Managing your connections ### Viewing customers in Console ### Monitoring each customer’s usage ### Reading a customer’s link status ### Unlinking a customer ### Linking a customer to a different Claude organization ## Expected errors ### Causes of `user_profile_not_billable` ## Your customer’s view ### Linking ### After linking ### Emails about linking and unlinking ### Spend caps #### While your app is in testing ### Supporting your customers ## Code snippet initialization
The page is gone upstream. What it last said is kept here.
manage-claude/oauth-apps/overview Changed · +34 / -35 lines
### Your OAuth app ### An identity provider instead of a client secret ## Choose your path ## Let customers pay for their own Claude usage ## One-time OAuth app setup ## Next steps