Claude Usage & Compliance APIs
This integration is available for Anthropic Enterprise organizations only. If you are on the Claude Team plan or using Claude on a third-party platform, use the Claude Code or Claude Cowork client-side integrations instead.
Overview
This integration polls your Anthropic organization's Admin, Compliance, and Analytics APIs and pulls Claude usage, cost, Claude Code activity, per-user engagement, seat, and governance telemetry into Coralogix as metrics and logs. Use it to track Claude spend and adoption, attribute cost and usage to users and products, and retain a governance trail of organization activity.
The initial version of this integration produces metrics only, with log collection planned for a future release. This page documents the log streams so you can plan ahead.
You configure up to 3 Anthropic API keys, and each key independently unlocks its own data group:
- Admin API key: API usage and token consumption per API key, Claude Code activity, organization rate limits, and the API key inventory.
- Compliance API key: the organization activity feed, the user directory, organization settings, chats, and projects.
- Analytics API key: daily cost and usage reports (organization-wide and per-user), engagement summaries, seats, skills, and connectors.
Install the integration once per Anthropic organization. Coverage extends only to the organization the keys belong to: a user's activity under a different organization requires a separate installation with that organization's keys.
Poll intervals
| Data | Interval |
|---|---|
| API usage report (Admin) | Every 10 minutes |
| Activity feed (Compliance) | Every 10 minutes |
| Claude Code usage (Admin) | Every 4 hours |
| Rate limits and API key inventory (Admin) | Daily |
| Organization directory, settings, chats, and projects (Compliance) | Daily |
| Cost and usage reports (Analytics) | Daily |
| Engagement reports: summaries, users, skills, connectors (Analytics) | Daily |
The integration does not backfill history. It collects activity events, chats, and chat messages from the moment you turn on the integration (or the relevant opt-in), and analytics reports start from the latest day Anthropic has published.
What you need
- Admin access to your Anthropic organization, to create organization API keys in the Anthropic Console.
- At least 1 of the 3 API keys. Compliance API access is a separate entitlement on the Anthropic side; if your organization doesn't have it, contact Anthropic.
- Permission to create integrations in your Coralogix account. See Permissions.
Create API keys in the Anthropic Console
- Log in to the Anthropic Console as an organization admin.
- In your organization settings, create a key for each data group you plan to collect: an Admin API key (
sk-ant-admin...), a Compliance API key, or an Analytics API key. For the exact steps, see the Anthropic Admin API documentation. - Copy each key and store it securely. Anthropic shows a key only once, at creation time.
Set up
- From your Coralogix toolbar, navigate to Data Flow, then Integrations. Select Anthropic (Claude) Usage & Cost, then select Connect.
- Select Add New.
- Define the integration settings:
- Integration name: a meaningful name for this integration.
- Application name: the Coralogix application name for all data from this integration. Defaults to
anthropic. - Subsystem name: optional. When set, all log streams ingest under this single subsystem instead of their per-stream defaults. Each log body still names its stream; see Log streams.
- Admin API key, Compliance API key, Analytics API key: the keys you created in the Anthropic Console. Provide at least 1; each key unlocks its own data group, and an absent key skips that group.
- Collect chat message content: off by default. When turned on, the integration ingests the raw text of Claude chat messages into the
anthropic.chat_messageslog stream. Turn it on only if capturing conversation content is acceptable for your compliance posture; see Chat message content. - Include view activity events: off by default. When turned on, the activity feed also includes the high-volume view events (file, chat, project, artifact, and user-settings views) and the
compliance_api_accessedevents that the integration otherwise filters out of the logs.
- Select Create. The integration tests each supplied key against Anthropic before saving, and reports which key failed if Anthropic rejects any of them.
Collected data
Log streams
The initial version does not yet produce log streams. The following reference describes the streams planned for a future release.
All logs ingest under the application name you configured (default anthropic). Each stream is its own subsystem by default, and every log body ships inside an envelope that names its stream and carries dataset-routing attributes:
{
"stream": "anthropic.activity",
"data": {
"organization": "org-1",
"type": "sso_login_succeeded"
},
"resource": {
"attributes": {
"cx.integration.source.type": "anthropic_api_integration",
"cx.integration.source.version": "1.0.0"
}
}
}
The record itself sits under data, so query a stream's fields as $d.data.*. The stream key survives a Subsystem name override, so streams stay distinguishable even when they share a single subsystem. The cx.integration.source.type attribute is anthropic_api_integration for every stream except the 2 conversation-content streams (anthropic.chats and anthropic.chat_messages), which carry anthropic_api_integration_sessions and route to the more restricted Claude sessions dataset.
Query a single stream with DataPrime:
source logs | filter $l.applicationname == 'anthropic' && $d.stream == 'anthropic.activity' | limit 50
Log timestamps: anthropic.activity entries take the event's created_at as their timestamp, and anthropic.api_keys_usage takes the start of its usage bucket. Every other stream takes the collection time, with the source times preserved in the record fields (created_at, report_date, and similar). Monetary fields in logs carry Anthropic's decimal cent values verbatim as strings, under keys ending in _cents.
Streams collected with the Admin API key:
| Stream | One record per | Fields |
|---|---|---|
anthropic.api_keys | API key in the organization inventory | organization, id, name, workspace_id, status, partial_hint, created_by, user_type, created_at, expires_at |
anthropic.api_keys_usage | Usage-report row (1-minute bucket) | organization, api_key_id, workspace_id, account_id, model, service_tier, context_window, uncached_input_tokens, cache_read_input_tokens, output_tokens, cache_creation_1h_input_tokens, cache_creation_5m_input_tokens, web_search_requests |
anthropic.claude_code | Claude Code actor per day | organization, date, user, actor_type, terminal_type, customer_type, subscription_type, num_sessions, commits, pull_requests, lines_added, lines_removed, tool_actions (per-tool accepted and rejected counts), model_breakdown (per-model tokens and cost_cents) |
Streams collected with the Analytics API key. Every record carries report_date (the data day, YYYY-MM-DD), and the cost and usage streams also carry report_starting_at and report_ending_at:
| Stream | One record per | Fields |
|---|---|---|
anthropic.models.cost | Cost-report row | product, model, context_window, speed, cost_type, token_type, currency, amount_cents, list_amount_cents, requests |
anthropic.user_cost | Per-user cost row | user_id, user_type, user_name, user_email, product, model, currency, amount_cents, list_amount_cents, requests |
anthropic.org.usage | Organization usage row | product, model, uncached_input_tokens, cache_read_input_tokens, output_tokens, cache_creation_1h_input_tokens, cache_creation_5m_input_tokens, web_search_requests, requests |
anthropic.user.usage | Per-user usage row | user_id, user_type, user_name, user_email, product, model, token counts including total_tokens, requests |
anthropic.user_activity | User per day | user_id, user_email, last_activity_date, chat_message_count, chat_distinct_conversation_count, distinct_session_count, commit_count, pull_request_count, lines_added, lines_removed |
anthropic.skills | Skill per day | skill_name, skill_display_name, distinct_user_count, invocation_count, enable_count, share_status, currency, attributed_list_price_cents, estimated_overage_spend_cents |
anthropic.connectors | Connector per day | connector_name, distinct_user_count, read_call_count, write_call_count, unclassified_call_count |
anthropic.summary.active_users | Day | assigned_seat_count, pending_invite_count, daily, weekly, and monthly active-user counts (overall and per product), and daily, weekly, and monthly adoption rates |
Streams collected with the Compliance API key:
| Stream | One record per | Fields |
|---|---|---|
anthropic.activity | Activity event, stamped at event time | organization, id, type, resource_id, claude_chat_id, claude_project_id, auth_method, mfa_method, api_key_id, user_agent, user_id, user_email, user_ip, user_type, created_at |
anthropic.users | Directory user | organization, id, email, name, role, type, created_at |
anthropic.chats | Chat (metadata only) | organization, id, name, model, user_id, user_email, project_id, created_at |
anthropic.chat_messages | Chat message (opt-in only) | organization, chat_id, project_id, user_email, message_id, role, created_at, chat_created_at, content (the raw content-block array, including thinking_redacted and truncated markers) |
anthropic.projects | Project | organization, id, name, user_id, user_email, created_at |
anthropic.org_settings | Daily settings snapshot | organization, settings (the full settings document) |
anthropic.organizations | Organization | organization, uuid, name, type |
Chat message content
The integration always collects chat metadata (anthropic.chats) when a Compliance API key is present. It collects the message text itself (anthropic.chat_messages) only while Collect chat message content is on:
- Turning it on starts message collection from that moment. The integration never collects messages sent before the opt-in.
- Turning it off stops message collection immediately, including any fetches already queued.
- Turning it back on starts a new collection floor at that moment. The integration does not backfill the interval it spent off.
Both conversation-content streams route to the restricted Claude sessions dataset through their cx.integration.source.type attribute.
A long conversation can exceed the maximum size of a single log entry. The integration then splits the message losslessly across several entries instead of truncating it:
- Each part repeats the full message metadata and adds
part(1-based) andparts(the total). Messages that fit in a single entry carry no part fields. - When a message has no
message_id, each part also carriespart_group, a stable grouping hash. - A content block too large for a single part becomes several segment blocks: copies of the block with its largest string split in place, each carrying
cx_segmentwithindex,total, andptr(the JSON Pointer of the sliced string). A text block stays a text block, and atool_useblock keeps itsidandname, so free-text search matches every segment without reassembly. To reconstruct the original string exactly, concatenate the slices atptrinindexorder. - A block with no dominant string ships whole, serialized as text segments marked
cx_segment.encoding: "json". Concatenate thetextslices inindexorder, then parse the result as JSON.
To reassemble a split message, group entries by $d.data.chat_id and $d.data.message_id (falling back to $d.data.part_group) and order them by $d.data.part. All parts share the same envelope timestamp, so ingestion order is not authoritative.
Metrics reference
All metrics appear in Metrics Explorer under the anthropic_ prefix. Every series carries an organization label and a source label naming the API key group that produced it (admin, compliance, or analytics). All series are gauges except anthropic_compliance_activity_events, which is a counter. Monetary metrics report USD, with the denomination in a currency label. The integration skips absent source fields rather than reporting them as 0, so a gap is distinguishable from a real zero.
Admin metrics. The Claude Code series carry user, actor_type, terminal_type, and customer_type labels:
| Metric | What it tracks | Additional labels |
|---|---|---|
anthropic_admin_rate_limit_value | Configured organization rate-limit values. | model or group_type, limit_type |
anthropic_admin_api_key_usage | Tokens consumed per API key in 1-minute buckets, stamped at the bucket start. | api_key_id, workspace_id, account_id, model, service_tier, context_window, token_type |
anthropic_claude_code_sessions | Claude Code sessions per actor. | None |
anthropic_claude_code_lines_added | Lines of code added. | None |
anthropic_claude_code_lines_removed | Lines of code removed. | None |
anthropic_claude_code_commits | Commits created. | None |
anthropic_claude_code_pull_requests | Pull requests created. | None |
anthropic_claude_code_tool_actions | Tool suggestions by outcome. | tool, decision |
anthropic_claude_code_tokens | Tokens consumed per model. | model, token_type |
anthropic_claude_code_cost | Estimated cost per model, in USD. | model, currency |
Compliance metrics, stamped at the source event time:
| Metric | What it tracks | Additional labels |
|---|---|---|
anthropic_compliance_org_users_total | Directory user count per role. | role |
anthropic_compliance_activity_events | Counter of activity events by type and actor. Counts every event type, including those filtered out of the activity log stream. | type, api_key_id, user_id, user_email, user_type |
anthropic_compliance_login_method | Successful logins by authentication method. | type, auth_method, mfa_method, user_id, user_ip, user_type, user_email |
anthropic_compliance_ip_events | Security-relevant events with a source IP: failed and initiated logins, access failures, logouts, and session revocations and shares. | type, user_ip, user_email, user_id |
anthropic_compliance_chats_created | Chats created. | model, user_id, user_email, project_id |
Analytics metrics. Every series carries a date label with the report day (YYYY-MM-DD, UTC); samples carry the end of that day as their timestamp. Cost series carry an amount_type label distinguishing actual, list, and overage amounts:
| Metric | What it tracks | Additional labels |
|---|---|---|
anthropic_analytics_cost | Organization cost, in USD. | product, model, cost_type, token_type, context_window, speed, currency, amount_type |
anthropic_analytics_user_cost | Per-user cost, in USD. | user_id, user_email, user_name, product, model, currency, amount_type |
anthropic_analytics_user_requests | Per-user request count. | user_id, user_email, user_name, product, model, currency |
anthropic_analytics_tokens | Organization token counts by type. | product, model, context_window, speed, token_type |
anthropic_organization_usage | Total tokens across all token types. | product, model, context_window, speed |
anthropic_org_cache_creation | Cache-creation tokens by cache lifetime. | product, model, context_window, speed, token_type |
anthropic_org_requests_total | Organization request count. | product, model, context_window, speed |
anthropic_analytics_user_tokens | Per-user token counts by type. | user_id, user_email, user_name, product, model, token_type |
| Metric | What it tracks | Additional labels |
|---|---|---|
anthropic_analytics_seats_assigned | Assigned seats. | None |
anthropic_analytics_pending_invites | Pending seat invites. | None |
anthropic_analytics_active_users | Active users per product and window. | product, window |
anthropic_analytics_adoption_rate | Adoption rate per window. | window |
| Metric | What it tracks | Additional labels |
|---|---|---|
anthropic_analytics_skill_users | Distinct users per skill. | skill_name, skill_display_name, share_status |
anthropic_analytics_skill_invocations | Skill invocations. | skill_name, skill_display_name, share_status |
anthropic_analytics_skill_sessions | Skill sessions per surface. | skill_name, skill_display_name, share_status, surface |
anthropic_analytics_skill_cost | Attributed skill cost, in USD. | skill_name, skill_display_name, share_status, currency, amount_type |
anthropic_analytics_connector_users | Distinct users per connector. | connector_name |
anthropic_analytics_connector_calls | Connector calls by type (read, write, unclassified). | connector_name, call_type |
anthropic_analytics_connector_sessions | Connector sessions per surface. | connector_name, surface |
Per-user activity metrics, with user_id, user_email, and product labels on every series:
| Metric | What it tracks | Additional labels |
|---|---|---|
anthropic_analytics_user_sessions | Sessions per user and product. | None |
anthropic_analytics_user_lines_added | Lines of code added. | None |
anthropic_analytics_user_lines_removed | Lines of code removed. | None |
anthropic_analytics_user_commits | Commits created. | None |
anthropic_analytics_user_pull_requests | Pull requests created. | None |
anthropic_analytics_user_tool_decisions | Tool suggestions by outcome. | tool, decision |
anthropic_analytics_user_chat_activity | Chat activity. | None |
anthropic_analytics_user_skills_used | Skill uses. | None |
anthropic_analytics_user_distinct_skills_used | Distinct skills used. | None |
anthropic_analytics_user_connectors_used | Connector uses. | None |
anthropic_analytics_user_distinct_connectors_used | Distinct connectors used. | None |
anthropic_analytics_user_office_distinct_connectors_used | Distinct connectors used from office products. | None |
The per-surface session metrics (anthropic_analytics_skill_sessions and anthropic_analytics_connector_sessions) appear only once Anthropic populates their source fields; Anthropic reports them as null.
Labels
| Label | On | Meaning |
|---|---|---|
organization | Every series | The Anthropic organization ID. |
source | Every series | The API key group that produced the series: admin, compliance, or analytics. |
date | Analytics series | The report day the value describes (YYYY-MM-DD, UTC). |
currency | Cost series | The denomination of the reported value. |
product | Usage, cost, and engagement series | The Claude product, for example claude_code, chat, or cowork. |
window | Active-user and adoption series | The aggregation window: daily, weekly, or monthly. |
token_type | Token series | The token category, for example uncached_input_tokens, cache_read_input_tokens, or output_tokens. |
user_id, user_email, user_name | Per-user series | The Anthropic user the value belongs to. |
Limits and behavior
- Anthropic rate limits. Anthropic allows 60 analytics requests per minute per organization and 600 compliance requests per minute per parent organization. The integration paces itself within these budgets, and when Anthropic returns a rate-limit response it reschedules the poll to the advertised reset time, keeping any data already collected.
- Report availability lag. Anthropic publishes cost and usage reports a few hours after the UTC day ends, and engagement reports about 2 days later. When a day isn't published yet, the integration retries every 30 minutes without skipping the day, then accepts it as empty after a bounded grace period. A missing day right after setup is normal; it fills in on its own.
- Metrics ingest window. The metrics pipeline accepts samples up to 48 hours old. Chats older than that appear in the
anthropic.chatslog stream but not inanthropic_compliance_chats_created. After extended downtime, the integration moves catch-up analytics samples forward into the window, with thedatelabel preserving the true report day. - Activity feed filtering. By default the
anthropic.activitylog stream excludes the high-volume view events (claude_file_viewed,claude_chat_viewed,claude_project_viewed,claude_artifact_viewed,claude_user_settings_updated) andcompliance_api_accessed, which the integration's own polling generates. Turn on Include view activity events to log them. Theanthropic_compliance_activity_eventsmetric counts every event type regardless of this setting, so overall access volume, including compliance API access with any key, stays queryable. - Subsystem name override. Setting Subsystem name collapses all log streams onto that single subsystem. Filter by
$d.streamin that case;$l.subsystemnameno longer distinguishes streams. - Organization settings snapshots. The
anthropic.org_settingsstream receives a full settings document per daily poll, whether or not the settings changed.
Validate the integration
Open Metrics Explorer or Grafana and query a series from a data group you collect, for example anthropic_analytics_seats_assigned or anthropic_admin_api_key_usage.
Once your version collects logs, query them in Explore with DataPrime:
source logs | filter $l.applicationname == 'anthropic' | groupby $d.stream aggregate count() as entries
With an Admin API key, the first anthropic.api_keys_usage entries typically appear within about 10 minutes of setup, and the daily snapshots (API keys, rate limits, compliance directory) within a day. Analytics streams appear after the next scheduled report poll and cover the most recent day Anthropic has published.
Permissions
To set up this integration, your Coralogix account must have the following permissions:
| Resource | Action | Description |
|---|---|---|
integrations | ReadConfig | View deployed integrations. |
integrations | Manage | Add, remove, or update integrations. |
For details, see Roles and permissions.