This page describes how the API meters and charges requests. It applies when your Organization has an active subscription and uses anDocumentation Index
Fetch the complete documentation index at: https://code4source.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
atk_*
API key.
What counts as a billable request
| Counts | Does not count |
|---|---|
POST /v1/evaluate | GET /v1/sources |
POST /v1/intersections | GET /v1/rulesets (list/get) |
POST /v1/distance | POST /v1/rulesets (create) |
POST /v1/subjects | ?explain=true (metadata only) |
?explain=true calls never consume
quota and are never charged.
Per-request gates
Every billable request passes three gates, in order:- Authentication — the bearer token must be a valid
atk_*key issued to your Organization. - Subscription — your subscription must be active. An expired or
suspended subscription returns
402 SUBSCRIPTION_INACTIVEand the request is not executed. - Quota — you must be within your contracted monthly cap for the
current billing period. Over the cap returns
429 QUOTA_EXCEEDEDand the request is not executed.
Billing period
Quota is counted against your Stripe billing period, not against the calendar month. The boundaries come from your subscription — typically the day of the month you signed up — and are returned in theperiod_started_at / period_ends_at fields on a 429
response. See Quotas & rate limits.
Idempotency
Send anIdempotency-Key header on every billable request:
[A-Za-z0-9_:.-]{8,128}. Anything else returns
422 IDEMPOTENCY_KEY_INVALID.
Keys are scoped per Organization. The contract:
| Outcome | HTTP | Meaning |
|---|---|---|
| Same key, same body, charged | 200 | Replay — original response snapshot is returned. |
| Same key, different body | 422 | IDEMPOTENCY_KEY_CONFLICT — pick a new key. |
| Same key, too many retries | 429 | IDEMPOTENCY_KEY_EXHAUSTED — pick a new key. |
| Same key, snapshot expired | 410 | IDEMPOTENCY_REPLAY_EXPIRED — key reusable for a fresh charge. |
Replay returns the original response without re-running the
evaluation and without charging again. This is the safe way to retry
on network errors: the second request either replays the prior result
(no extra charge) or runs fresh (one charge total).
DEGRADED responses are not charged
A response withstatus: "degraded" means at least one source could
not be evaluated for an infrastructure reason (upstream provider
timeout, transient error). The response is incomplete, not wrong.
By default, DEGRADED responses do not consume quota and are not
charged. The Idempotency-Key stays reusable, so you can retry the
same request once the upstream source recovers and the retry will
either succeed (one charge total) or come back DEGRADED again (still
zero charges).
For the wrappers /v1/intersections, /v1/distance, and
/v1/subjects, a single source that fails is reported with
status: "failed" on its SourceOutcome. The overall response can
still be useful — the other sources returned data — but the request
is not charged.
See Verdicts for the full status/outcome
semantics.
Recommended retry strategy
- Generate a fresh
Idempotency-Keyper logical job (a UUID, or your own job id). - On
5xx, network error, orstatus: "degraded": retry with the same key. You will either replay a charged result, or run fresh. - On
429 QUOTA_EXCEEDED: stop untilperiod_ends_ator contact us to bump the cap. - On
429 RATE_LIMIT_EXCEEDED: back off forRetry-Afterseconds with exponential backoff + jitter. - On
422 IDEMPOTENCY_KEY_CONFLICTor429 IDEMPOTENCY_KEY_EXHAUSTED: pick a new key (the original key is locked to a different payload).
Errors
All billing-related errors follow the standard envelope. Match against thecode field, not against title or detail. See
Errors for the complete code list.