← Back

Home · Guides · Attribution Ingest API

How does the attribution ingest API turn AI spend into per-client records?

By the Ingenious AI team · Published 2026-11-14 · Reviewed 2026-11-14

Short answer: Your workflows POST one event per unit of work to /api/events, authenticated by session or by license key (X-License-Key), carrying the attribution fields: client, task, provider, model, cost and a success-or-fail outcome, plus an idempotency key. Valid events are recorded and immediately feed per-client sums, cost per successful outcome, budgets and waste findings. Duplicate deliveries are recognized by their key and never count twice; invalid events are rejected and write nothing — so the record the reports are built from stays clean at the door.

Try the free demo measurement See pricing Start free — one provider key

What is the attribution ingest API?

The attribution ingest API is OutcomeMeter's endpoint (POST /api/events) by which applications report AI cost events with their attribution fields. It accepts session or X-License-Key authentication, enforces idempotency so a duplicate delivery never charges twice, and rejects invalid events without writing, making it the admission door for all per-client metering on Pro and Agency plans.

One event per unit of work

The API's unit of thought is the event: one workflow run's spend, attributed and judged. Client and task say whose work it was; provider and model say what produced it; cost says what it charged; outcome says whether it succeeded under the task's definition. Emitted at the spend point — from the same code path that made the provider call — events keep perfect step with reality, including the failures, which are events too and must be emitted with the same fidelity as successes.

Emission design matters more than endpoint mechanics. Wrap the provider call once, in the code every workflow shares, and emission becomes automatic and uniform; scatter emission across workflows and coverage will quietly vary with each team's diligence. The API cannot fix under-emission — that is what reconciliation against the provider pull is for — but a wrapper makes under-emission a single bug instead of a culture.

Authentication: session or license key

Two credentials open the door, for two kinds of sender. Browser-side, an account session serves the product's own interfaces. Machine-side, the X-License-Key header carries the account's license key — the same credential family that gates the paid features — so a headless worker needs no interactive login to report its spend. The key identifies the account; the events' client field identifies whose work it was. Keep the two concepts separate in your integration: one account (yours, the agency) reports events for many clients (theirs).

Treat the license key as what it is — a credential that can write to your metering record and unlock paid features. Store it in the sender's secret management, scope the systems that hold it, and rotate it like any production secret. The ingest door's other defences (validation, idempotency) assume the caller is authenticated; the key is what makes that assumption safe.

Idempotency: the property your invoices stand on

Every event should carry an idempotency key — generated once per logical event, stored in the sender's outbox, resent unchanged on retries. The API honours it absolutely: a duplicate delivery never charges twice. This is not a performance detail; it is the integrity property that separates a metering record from a pile of maybes, because production networks redeliver as a matter of design and an ingest that counts redeliveries bills clients for your transport layer's weather.

The sender's half of the contract is the outbox pattern: persist the event with its key before attempting delivery, deliver, and retry with the stored key until acknowledged. Implemented once in the shared wrapper, it protects every workflow the wrapper touches, forever, including the 3 a.m. retry storm nobody will ever know happened — the ledger will simply, correctly, show nothing unusual.

Validation: the strict door

Events that fail validation — missing fields, malformed cost, an outcome outside success/fail — are rejected and write nothing. There is no partial record, no 'accepted with warnings', no guessing a plausible client. Strictness at admission is what allows every downstream number to be trusted without per-report auditing: the ledger contains only events that were well-formed when they arrived, attributed by senders who knew the answers.

Senders should treat rejections as instrumentation bugs with alarms attached. A rising rejection rate means a workflow changed its emission shape; caught by monitoring, it is an afternoon fix — uncaught, it is a coverage gap that reconciliation will find at month-end, priced in awkward conversations. The API's refusal to improvise is the feature; wire your side to listen to it.

What the events immediately power

A recorded event is not warehoused for later batch glory; it joins the live record at once. Per-client and per-task sums include it; cost per successful outcome recomputes from it; the client's budget trajectory absorbs it (and the 80%/100% Slack alerts evaluate against it); the waste report's failure patterns group it. That immediacy is what makes mid-month management possible — the meter is a live instrument, not a month-end reconstruction — and it raises the value of emission quality, because a malformed integration shows its symptoms in dashboards the same day.

The same events, joined later to outcome records in the verified ledger, gain their second life: verification can confirm or correct what the events claimed, and dispute packs can exhibit both layers together. Admission discipline at this door is therefore also dispute-readiness, purchased in advance at the cheapest possible price.

Integrate the ingest API correctly: the 5-action checklist

One shared wrapper, outbox keys, rejection alarms, and reconciliation — the four habits that make the stream trustworthy.

  1. Emit from one shared wrapper: the code path that calls the provider emits the event — successes and failures with equal fidelity.
  2. Implement the outbox: persist each event with its idempotency key before delivery; retries resend the stored key.
  3. Authenticate as a machine: X-License-Key from secret storage; the key identifies your account, the client field identifies the work's owner.
  4. Alarm on rejections: invalid events write nothing by design — a rising rejection rate is an instrumentation bug paging you.
  5. Reconcile weekly: attributed totals versus the provider pull; close coverage gaps while they are still small and cheap.

Worked example: a fictional agency's first integration week

A fictional agency, Wexford Lane, integrates the ingest API behind a shared wrapper used by its four production workflows. Day one surfaces two gifts from the strict door: a rejection cluster reveals one workflow emitting cost in cents rather than dollars (fixed in the wrapper, once, for all four), and reconciliation shows a fifth, older workflow spending untagged — found in a day instead of at quarter-end. The team adds the outbox pattern after a staging test demonstrates duplicate deliveries being correctly absorbed.

By week's end the agency's per-client page is live and already arguing with the account team's intuitions — one client's events run 30% above their assumed level. Because the door was strict and the reconciliation was done, the argument is about the client's scope, where it belongs, and not about whether the numbers can be trusted. That is the entire return on integration discipline: every later conversation gets to be about the business.

OutcomeMeter runs this measurement on your own provider spend: connect a key on the free tier, watch the demo measurement first if you want to see the shape of the output, and read accepted-outcome economics when you are ready to value accepted work. The guides index collects every guide in this series.

Frequently asked questions

What does an event sent to the ingest API contain?

The attribution fields: client, task, provider, model, cost and a success-or-fail outcome — plus an idempotency key. Authentication is by session or by the X-License-Key header for machine senders.

What happens if the same event is delivered twice?

The idempotency key is recognized and the event is not counted again: a duplicate delivery never charges twice. Senders support this with the outbox pattern — the key is stored with the event and resent unchanged on retries.

What happens if an event is malformed?

It is rejected and nothing is written — no partial record, no guessed fields. Strict admission is what makes the ledger trustworthy. Senders should alarm on rejections: they signal an instrumentation bug, and the fix belongs in the emitting wrapper.

Which plans include the ingest API?

Attribution ingest is a Pro ($29/mo) and Agency ($79/mo) capability, alongside multi-provider connections, per-client budgets and branded reports. The free tier covers the provider pull and waste report.

How do ingested events relate to verified outcomes?

Events carry the workflow's own success/fail judgment; outcome records from systems of record can later verify the same work in the ledger. Dispute packs exhibit both layers — what was claimed as it ran, and what the system of record confirmed.

Keep reading

← Back