Reference

API Reference

The Bear Lumen REST API ingests AI usage events and reads cost, attribution, and margin data back. It has 39 endpoints across 10 resource groups, all authenticated with a restricted API key over HTTPS at api.bearlumen.com/v1. Each endpoint below has its own reference page with parameters, request and response examples, and error codes.

Prefer to try requests interactively? Open the interactive API explorer. The raw OpenAPI specification is available at /openapi.json.

Connectivity

Connectivity check to verify your API key is valid and confirm the organization it is scoped to before you integrate.

Usage Events

AI usage event ingestion (single and batch) for cost tracking and attribution.

Usage Tracking

Usage event recording plus historical query and aggregation endpoints.

  • GET Get usage aggregationReturns aggregated usage quantities by metric (total quantity, event count, first and last event timestamps) for volume reporting.
  • GET Get usage eventsRetrieves individual usage events recorded for the account your API key belongs to, within a date range.
  • GET Get usage summaryReturns a high-level usage summary for a period: total event count plus per-metric totals.

Cost Data

Organization-level cost summaries, breakdowns, and trend data across all AI providers.

End User Costs

Per-user cost analysis scoped by your external user ID. Understand spend concentration and per-customer unit economics.

Margin Data

Margin and profitability analysis comparing AI costs against revenue.

  • GET Get margin by end userReturns margin data for each of your end users (the customers you attribute usage and revenue to), sorted by profitability with the least profitable first so unprofitable end users surface at the top.
  • GET Get margin summaryReturns total revenue, cost, and margin for the organization with warnings about unattributed data and profitability classification.
  • GET Get margin trendReturns time-series margin data (revenue - cost) with adaptive granularity: - <= 30 days: daily - 31-90 days: weekly - > 90 days: monthly Periods with no revenue and no cost activity are omitted from data_points rather than returned as zero values.

Attribution Data

Dimensional cost analysis grouped by model, provider, feature, agent, or workflow.

  • GET List unique agent IDsReturns every distinct agent_id value from usage event metadata for the given date range, sorted alphabetically.
  • GET Get cost breakdown by agentReturns cost aggregation grouped by agent_id from usage event metadata.
  • GET Get cost breakdown by dimensionReturns cost aggregation grouped by any metadata dimension key.
  • GET Get cost per declared outcomeReturns the true cost per unit of value: for every outcome your spans declare (see the tracing guide), completed, failed, and unresolved units side by side.
  • GET Get cost breakdown by workflowReturns cost aggregation grouped by workflow_id from usage event metadata.
  • GET List distinct dimension keysReturns every distinct metadata dimension key from usage events within a date range, sorted alphabetically.
  • GET List unique dimension valuesReturns every distinct value of a metadata dimension key in the date range, sorted alphabetically.
  • GET Compare session typesReturns a per-session-type cost comparison with a cost efficiency ratio.
  • GET Get session cost breakdownReturns per-session cost totals, ordered by total cost descending.
  • GET Get session detailReturns a per-feature cost breakdown for one session.
  • GET Get session call treeReconstructs one session's span call tree: one node per span with its own cost, its subtree cost (the span plus every descendant), and its nested children, so you can see which branch of a multi-agent run spent the money.
  • GET Get attribution time-seriesReturns time-bucketed multi-series cost data grouped by any metadata dimension key.
  • GET List unique workflow IDsReturns every distinct workflow_id value from usage event metadata for the given date range, sorted alphabetically.

Dimension Data

Custom dimension definitions and cost breakdowns by user-defined categories.

Rate Cards

Effective per-model rates for client-side cost estimation. The SDK budget feature refreshes its local price table from here; the server-side ledger is the record.

  • GET Get the rate estimation tableReturns your organization's effective per-model rates in USD per million tokens, for client-side budget estimation; the server-side ledger is the record.

Insights

AI-optimized statistical summary: period-over-period totals, distributions, top movers, and correlations.

  • GET Get insights summaryReturns period-over-period totals, population distributions, top movers with z-scores, margin outliers, and cross-metric correlations.