Skip to main content

Connect Claude Code using the Admin API

Connect Claude Code to LinearB using an Anthropic Admin API key to collect detailed usage, token, model, and estimated-consumption data.

Steven Silverstone
Updated by Steven Silverstone

Overview

Connect Claude Code to LinearB using the Admin API to collect detailed Claude Code usage across your organization.

This connection is intended for organizations that use Claude Code through an Anthropic API organization and can provide an admin-level Anthropic API key.

Connection limit: Only one active Claude Code Admin API integration can be connected at a time. A failing Admin API integration still counts as active.

Data Provided by the Admin API

Depending on the data returned by Anthropic, the Admin API integration can provide:

  • User-level daily usage
  • Session counts
  • Commit and pull request counts
  • Accepted and rejected tool actions
  • Accepted lines added and deleted
  • Token usage by model
  • Estimated consumption by model

Adoption and accepted-lines data appears in AI Analytics.

Model, token, and estimated-consumption data is available through Metrics Builder.

Estimated consumption is not a billing total. Vendor plans, discounts, credits, negotiated pricing, and pricing changes can cause the estimate to differ from the provider’s invoice.

Historical Data and Collection Cadence

  • Up to 90 days of historical data can be backfilled during the initial connection.
  • Activity outside the available initial backfill window does not appear in LinearB.
  • After the initial connection, Admin API data is updated daily.

Before You Begin

Verify that you have:

  • Access to AI Tools settings in LinearB.
  • Organization Admin access in Anthropic.
  • An admin-level Anthropic API key.
Security: Store the API key securely. You may not be able to view it again after it is created.

Create an Anthropic Admin API Key

  1. Sign in to the Anthropic administration console.
  2. Open the API Keys section.
  3. Create a new Admin API key.
  4. Confirm that the key has organization-level Admin API access.
  5. Copy and securely store the key.

Connect Claude Code in LinearB

  1. Go to Settings → Company Settings → AI Tools → Integrations.
  2. Click Add New.
  3. Select Claude Code.
  4. Click Continue.
  5. Select Admin API.
  6. Click Continue.
  7. Paste the Anthropic Admin API key into the Token field.
  8. Click Connect.

LinearB validates the API key and configuration. When validation succeeds, Claude Code — Admin API appears in the Connected list.

Duplicate integrations: If another active Admin API integration already exists, disconnect it before connecting another one.

Verify the Connection

  1. Open Settings → Company Settings → AI Tools → Integrations.
  2. Select Connected.
  3. Select Claude Code — Admin API.
  4. Confirm that the integration status is Connected.
  5. Allow time for the initial historical import and daily processing.
  6. Open AI Analytics or Metrics Builder and confirm that Claude Code data appears.

Edit the Admin API Integration

Use Edit mode to replace the Anthropic Admin API key without disconnecting the integration.

  1. Open Settings → Company Settings → AI Tools → Integrations.
  2. Select Connected.
  3. Select Claude Code — Admin API.
  4. Under Main Settings, click Edit.
  5. Update the Anthropic API key in the Token field.
  6. Click Save changes to apply the update or Cancel to discard it.
Permissions: Anyone who has access to AI Tools settings can edit the integration. No additional LinearB permission is required specifically for the Edit action.

What happens to historical data?

Editing the Admin API integration does not delete previously collected Claude Code metrics.

  • Saving an API-key change triggers a new collection.
  • LinearB recollects up to 90 days of recent Claude Code data.
  • Recollected records are updated in place and are not counted twice.
  • Data older than the recollection window remains unchanged.

Disconnect or Reconnect

Disconnecting the integration stops new Admin API data collection and moves it to the Disconnected list. Previously collected data is preserved.

Disconnect the integration

  1. Open Settings → Company Settings → AI Tools → Integrations.
  2. Select Connected.
  3. Select Claude Code — Admin API.
  4. Click Disconnect.
  5. Confirm the action.

Reconnect the integration

  1. Open Settings → Company Settings → AI Tools → Integrations.
  2. Select Disconnected.
  3. Select Claude Code — Admin API.
  4. Click Reconnect.
  5. Enter a replacement Anthropic Admin API key if the saved key has expired or been revoked.
  6. Complete validation to restore the integration.

LinearB validates the API key and saved configuration before restoring the integration.

Note: If the saved API key is no longer valid, create a replacement Admin API key and enter it during the reconnect flow. You do not need to create another Admin API integration.

Learn more:


Troubleshooting

Connection Error

If the integration displays a connection error:

  • Confirm that the API key is still valid.
  • Verify that the key has Admin API access.
  • Confirm that the key belongs to the correct Anthropic organization.
  • Create a new key if the existing key has expired or been revoked.
  • Select the integration, click Edit, enter the replacement key, and click Save changes.

No Claude Code Data Appears

  • Allow time for the initial import and daily processing.
  • Confirm that users are actively using Claude Code in the connected organization.
  • Verify that Anthropic is returning usage data for the expected users and dates.
  • Confirm that the integration appears under Connected without an error indicator.

Recent Activity Is Missing

Admin API data is updated daily and should not be treated as real-time telemetry. For more immediate collection, review the OpenTelemetry connection method.


Known Limitations

  • Admin API data is updated daily, not in real time.
  • Historical data outside the available initial backfill window is not imported during the first connection.
  • AWS Bedrock Claude environments are not supported through the Admin API connection.
  • Available metrics depend on the data returned by Anthropic.

How did we do?

Connect Claude Code using OpenTelemetry

Connect Claude Code using the Analytics API

Contact