Claude Code API Integration
Last updated: October 29, 2026
The Claude Code API integration connects Span to your Anthropic organization with an Admin API key and pulls Anthropic's daily Claude Code usage report, so Claude Code usage and cost on Anthropic's API plan appear in Tool utilization and AI Spend.
Why it matters
If your developers use Claude Code on Anthropic's API plan, billed by usage with no per-seat license, this connection is how Span sees who uses Claude Code, how much, and what it costs, next to your other AI tools. Span pulls the data server-side from Anthropic, so nothing needs to be configured on developer machines.
How it works
Span reads Anthropic's Claude Code usage report for each user or API key and day:
Sessions
Lines of code added and removed
Commits and pull requests created by Claude Code
Estimated cost per model
Span uses that data for these metrics:
Metric | How this connection feeds it |
|---|---|
Weekly / Monthly active users, AI days / week | A person is active on any day with a Claude Code session, line, commit, or pull request. |
Accepted lines of code | Lines added plus lines removed. |
Overage spend | Anthropic's estimated cost, by model. |
Base spend | None. API-plan usage has no seat price, so all cost lands in overage. |
Span matches usage to people by email address, or by API key name for usage made with an API key.
Setup
In the Claude Console, have an organization admin create an Admin API key (it starts with
sk-ant-admin). See Anthropic's Admin API documentation.In Span, go to Settings → Integrations.
Find Claude Code API and click Connect.
Paste the key into Admin API Key and save.
If developers use API keys with Claude Code, add each API key name to the developer's Span person record, the same way you add VCS usernames. Usage through that key and usage under the person's email then combine.
Span backfills history back to your organization's integration sync start date, and no earlier than February 24, 2025, when Claude Code launched.
Things to know
API users only. This connection covers usage billed on Anthropic's API plan. Users on a subscription plan (Pro, Max, Team, or Enterprise) don't appear in its data.
Enterprise accounts use a different connection. For Claude Code Enterprise, connect Claude Code Enterprise instead. See Choosing the right Claude Code Integration.
No double counting. If you connect both Claude Code API and Claude Code Enterprise, Enterprise data wins for any person and day it covers.
Personal accounts aren't covered. Individual Claude accounts aren't part of your Anthropic organization's usage report. Agent traces can capture Claude Code sessions on developer machines instead.
Unmatched keys drop out. Usage from an API key whose name isn't on any Span person record doesn't appear in per-person metrics or spend totals.
Cost is Anthropic's estimate. Overage uses the estimated cost from Anthropic's usage report, so it can differ from your Anthropic invoice.
Span measures lines. Span counts lines added and removed, rather than accepts as a share of suggestions.
Worked example. A developer runs Claude Code with an API key named
ci-danaand also signs in with their work email. On Tuesday the usage report shows 120 lines added, 30 removed, and $4.20 of estimated cost under the key, plus $1.80 under the email. Onceci-danais on their Span record, Span shows 150 accepted lines and $6.00 of Claude Code overage for them that day. Without the key name, only the $1.80 appears.
Related articles
Choosing the right Claude Code Integration
Why AI tool or Spend data might be missing for a person
Understanding Agent Traces in Span (auspex)
Need help?
Contact your Span account team or reach out to support@span.app.