manage-customers changedmanage-claude/oauth-apps/linked-billing/manage-customers
Nearest release: v2.1.332, published under an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
## Before you begin ## 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
The whole hunk
476 lines, new pageA 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.
No line in this hunk matches that.