KRIN API: introduction
How the KRIN REST API works: base URL, API keys, versions, organizations, idempotency, dry runs, pagination, errors, rate limits, IDs and money units.
Not live on production yet. This guide follows the published API contract. Its steps work once these parts answer in production: API keys for the public API. See what's live
Everything in KRIN, from campaigns to walls to reports, runs on this API. The console uses it too. Your servers can do the day-to-day work in code, and a few steps stay in the console (see below).
Answer. The KRIN API is one REST API at
https://api.krin.iofor advertisers, publishers and AI agents. Authenticate with a secret API key, send theKrin-Versionheader, and useIdempotency-Keyon writes. Money is integer micro-USD, errors are problem+json with stable codes, and every write can be previewed withdry_run=true.
Base URL
Section titled “Base URL”https://api.krin.ioThere is no separate sandbox host. Sandbox is a mode of your organization: test keys and test placements work against the same URL.
The full machine-readable description is OpenAPI 3.1 at docs.krin.io/openapi.json (public operations only).
Authentication
Section titled “Authentication”| who | how |
|---|---|
| Your server | Secret API key: Authorization: Bearer krin_sk_live_... (or krin_sk_test_... for sandbox). One key belongs to one organization and one side (advertiser or publisher), with the scopes you chose |
| The console | a session on app.krin.io. Session cookies never work on api.krin.io |
| The wall | a short-lived wall session token, created from a signed launch |
Create keys in Settings → API keys (owners and admins, signed in with a passkey). The secret is shown once; KRIN stores only a keyed hash of it. You can limit a key to IP addresses and give it an expiry. Revoke a key at any time; it stops on the next request.
API keys do what your servers need. Steps that move money or need a person signed in with a passkey (team members, keys, secrets, webhook endpoints, payout method, tax forms) and KRIN AI conversations stay in the console.
Never put a secret key in an app, a web page or a repository.
Versions
Section titled “Versions”Send the API version on every request:
Krin-Version: 2026-12-04Versions are dates. A change that could break your code ships only under a new date.
Organizations
Section titled “Organizations”An API key already names its organization. A console session can belong to several organizations, so console calls name one in the Krin-Org: org_... header.
Writes: idempotency and dry runs
Section titled “Writes: idempotency and dry runs”Idempotency-Key. Send a unique key (a UUID works) on every write. If the network drops and you retry with the same key and the same body, KRIN returns the first result instead of doing it twice. Keys are kept for 24 hours. The same key with a different body is refused (idempotency_key_reused). Money-moving writes require a key.
?dry_run=true. Every write that supports it returns what it would do and a diff, and changes nothing. Use it to check a request before you run it, or to show your user what will change.
curl -X PUT "https://api.krin.io/v1/advertiser/offers/ofr_.../caps?dry_run=true" \ -H "Authorization: Bearer $KRIN_SECRET_KEY" \ -H "Krin-Version: 2026-12-04" \ -H "Idempotency-Key: 6f1c2b7e-3a1d-4c55-9e7a-2d9f0c1b8a44" \ -H "Content-Type: application/json" \ -d '{"daily_conversions": 500}'Lists and pagination
Section titled “Lists and pagination”Lists return newest first, 25 items by default (limit 1 to 100). Pass the next_cursor from one page as cursor to get the next; it is null on the last page.
Errors
Section titled “Errors”Errors follow RFC 9457 (application/problem+json) with a stable code you can branch on:
{ "type": "https://docs.krin.io/errors/validation_failed", "title": "Validation failed", "status": 400, "code": "validation_failed", "detail": "2 fields need fixing.", "request_id": "req_01kbp...", "errors": [ {"path": "/events/0/cost_micros", "message": "must be 0 or more"}, {"path": "/reversal_window_days", "message": "must be between 14 and 30"} ]}Codes you are likely to meet:
| code | meaning |
|---|---|
validation_failed |
a field is missing or out of shape; errors lists each one |
org_required |
a console call without Krin-Org |
not_signed_in |
no valid key, token or session |
role_not_allowed |
your role can’t do this |
passkey_session_required |
sign in with your passkey, then retry (console only) |
human_member_required |
only a person can do this, never an agent or KRIN AI |
not_found |
the object doesn’t exist in your organization |
idempotency_key_reused |
the same Idempotency-Key with a different request |
invalid_transition |
the object’s state doesn’t allow this (for example, pausing an ended offer) |
reversal_window_closed |
the conversion is final |
reversal_money_off |
reversals aren’t open for this conversion yet |
agent_limit_reached |
an agent hit a limit your owner set; a person must approve |
rate_limited |
slow down; see Retry-After |
The full list, with what each code means for you, is in Error codes. Always log request_id: KRIN support can find any request by it.
Rate limits
Section titled “Rate limits”Limits apply per key and per kind of operation (reads, writes, heavy reports, AI). Every answer carries:
RateLimit-Limit: ...RateLimit-Remaining: ...RateLimit-Reset: ...Over the limit you get 429 with Retry-After. Back off and retry; the SDKs do it for you.
Every object has a typed ID: a prefix, an underscore and 26 characters, for example ofr_01kbmy9x8w7v6t5s4r3q2p1n0m. The prefix tells you what it is:
org_ organization · prd_ product · cmp_ campaign · ofr_ offer · prop_ property · plc_ placement · sub_ a placement’s public id (the sub-source advertisers see) · clk_ click · cnv_ conversion · rev_ reversal · dlv_ delivery · whk_ webhook · stm_ statement · top_ top-up · case_ review case.
Treat IDs as opaque strings.
- Amounts are integer micro-USD: 1 USD = 1,000,000.
412500is $0.4125. - End-user rewards are decimal strings in the placement’s currency, such as
"412"or"12.50". - There are no floating-point money fields. Don’t convert amounts to floats in your code.
- Derived amounts (EPC, eCPM, cost per install) round half away from zero to whole micros.
What each side sees
Section titled “What each side sees”Publisher endpoints, postbacks and webhooks return only the publisher’s own net earnings and the user’s reward. They never contain advertiser prices. Advertiser endpoints return your own costs, spend and per-source facts, and never a publisher’s identity beyond the placement’s public id.
Webhooks
Section titled “Webhooks”Webhooks open soon. Add an https endpoint in the console under Settings, Webhooks. Adding or changing one needs a person signed in with a passkey, so API keys can list, delete and replay endpoints but can’t add or change them. Each delivery is signed like a POST reward postback (Krin-Signature: t=...,v1=... over "<t>.<raw body>" with the endpoint’s signing secret) and carries a Krin-Event-Id header. Deliveries are retried for 72 hours and can be replayed. Dedupe on the event id; order isn’t guaranteed. See Webhooks.
TypeScript (@krin/sdk) and PHP (krin/krin-php) clients are generated from the same OpenAPI file, with retries, idempotency keys and signature helpers built in. See SDKs.
Is there a separate test environment? No. Sandbox is a mode of your organization on the same API, with test keys, test offers and test conversions that never move money.
Can one key work for both my advertiser and publisher sides? No. Each key belongs to one side. Create one key per side.
How do I know which fields a publisher sees? Publisher responses use their own schemas, and KRIN’s build fails if one of them ever contains an advertiser price.
Do you have GraphQL or gRPC? No. One REST API, described in OpenAPI 3.1.