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.
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.
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.
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.
Create an Anthropic Admin API Key
- Sign in to the Anthropic administration console.
- Open the API Keys section.
- Create a new Admin API key.
- Confirm that the key has organization-level Admin API access.
- Copy and securely store the key.
Connect Claude Code in LinearB
- Go to Settings → Company Settings → AI Tools → Integrations.
- Click Add New.
- Select Claude Code.
- Click Continue.
- Select Admin API.
- Click Continue.
- Paste the Anthropic Admin API key into the Token field.
- Click Connect.
LinearB validates the API key and configuration. When validation succeeds, Claude Code — Admin API appears in the Connected list.
Verify the Connection
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Connected.
- Select Claude Code — Admin API.
- Confirm that the integration status is Connected.
- Allow time for the initial historical import and daily processing.
- 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.
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Connected.
- Select Claude Code — Admin API.
- Under Main Settings, click Edit.
- Update the Anthropic API key in the Token field.
- Click Save changes to apply the update or Cancel to discard it.
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
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Connected.
- Select Claude Code — Admin API.
- Click Disconnect.
- Confirm the action.
Reconnect the integration
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Disconnected.
- Select Claude Code — Admin API.
- Click Reconnect.
- Enter a replacement Anthropic Admin API key if the saved key has expired or been revoked.
- Complete validation to restore the integration.
LinearB validates the API key and saved configuration before restoring the 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.
Related Articles
How did we do?
Connect Claude Code using OpenTelemetry
Connect Claude Code using the Analytics API