Skip to content

Send conversions to KRIN (server to server)

Report installs and in-app events to KRIN from your server or tracker: the click URL macros, the signed postback to t.krin.io, answers, dedupe and test vectors.

Not live on production yet. This guide follows the published API contract. Its steps work once these parts answer in production: Products, campaigns and offers from a store link, Tracking test for an offer, Signed click chain, and Server-to-server conversion receiver. This guide follows the published API contract. Its steps work once these parts answer in production: Products, campaigns and offers from a store link, Tracking test for an offer and 2 more. See what's live

Open .md

KRIN counts a conversion only when your server, or your tracker, reports it and the report is tied to a real KRIN click. Nothing is billed on a browser pixel.

Answer. KRIN sends each user to your tracking link with a click_id. When the user completes an event, your server or tracker calls https://t.krin.io/pb/{offer_key} with that click_id, the event name and a timestamp, authenticated by an HMAC-SHA256 signature, optionally also limited to your server’s IP addresses. KRIN binds every conversion to a real click before anything is billed.

On the offer, set Tracking → Click URL (tracking.click_url_template). It must be https. KRIN fills these macros when a user taps the offer:

macro value
{click_id} KRIN’s click token. Required: store it and send it back with every event
{sub_source} the placement’s public id (sub_...), so you can see each source in your own reports
{country} the user’s country (ISO 3166-1 alpha-2)
{platform} android, ios, web, windows or macos
{gaid}, {idfa} the advertising id, when the user’s device shares one

Example:

https://track.example.com/click?network=krin&cid={click_id}&sub={sub_source}&geo={country}

The click token is signed by KRIN. A changed or invented token is refused before it reaches your offer’s counters.

A URL key alone never authenticates a postback. Pick one of these on the offer (tracking.inbound_auth):

method what you do
hmac (recommended) sign each postback with the offer’s inbound secret (below)
hmac_and_ip sign each postback (as above) and send it only from fixed IP addresses that you list on the offer

AppsFlyer, Adjust and Singular offers can use the MMP’s own postbacks instead; see the MMP pages. KRIN shows the inbound secret once when you create it.

GET https://t.krin.io/pb/{offer_key}?click_id=...&event=...&txn_id=...&ts=...&sig=...
parameter required notes
click_id yes the value KRIN put in {click_id}
event yes the event key exactly as declared on the offer, for example install or level_10
txn_id no your own unique id for this event. Recommended: it makes retries safe
ts yes unix seconds. Must be within 900 seconds of KRIN’s clock
sig yes see below

Extra parameters are ignored, but they are part of what you sign.

The signature is HMAC-SHA256 with the offer’s inbound secret. It covers the request exactly as you send it: build the query string first, without sig, then sign these five lines joined with \n:

krin-in-v2
GET
t.krin.io
/pb/{offer_key}
{query}
  • {query} is the query string exactly as you send it, without sig: the same order and the same encoding. KRIN signs the bytes it receives, so don’t sort or re-encode anything after signing.
  • Then add &sig= and the signature at the end of the query.
  • The host is lowercase, with no port.
Node
// Node 18+ (from docs code/krin.mjs)
import { createHmac } from "node:crypto";
export function signInbound(secret, { offerKey, clickId, event, txnId = "" }, ts = Math.floor(Date.now() / 1000)) {
const host = "t.krin.io";
const path = `/pb/${encodeURIComponent(offerKey)}`;
const params = new URLSearchParams({ click_id: clickId, event });
if (txnId) params.set("txn_id", txnId);
params.set("ts", String(ts));
const query = params.toString();
const sig = createHmac("sha256", secret).update(["krin-in-v2", "GET", host, path, query].join("\n")).digest("hex");
return { url: `https://${host}${path}?${query}&sig=${sig}`, sig };
}
PHP
<?php
// PHP 8.1+ (from docs code/krin.php)
function krin_sign_inbound(string $secret, string $offerKey, string $clickId, string $event,
string $txnId = '', ?int $ts = null): string {
$host = 't.krin.io';
$path = '/pb/' . rawurlencode($offerKey);
$params = ['click_id' => $clickId, 'event' => $event];
if ($txnId !== '') {
$params['txn_id'] = $txnId;
}
$params['ts'] = (string) ($ts ?? time());
$query = http_build_query($params, '', '&', PHP_QUERY_RFC3986);
$sig = hash_hmac('sha256', implode("\n", ['krin-in-v2', 'GET', $host, $path, $query]), $secret);
return "https://{$host}{$path}?{$query}&sig={$sig}";
}
Python
# Python 3.9+ (from docs code/krin.py)
import hashlib, hmac, time
from urllib.parse import quote, urlencode
def sign_inbound(secret, offer_key, click_id, event, txn_id="", ts=None):
host = "t.krin.io"
path = "/pb/" + quote(offer_key, safe="")
params = [("click_id", click_id), ("event", event)]
if txn_id:
params.append(("txn_id", txn_id))
params.append(("ts", str(int(time.time()) if ts is None else ts)))
query = urlencode(params, quote_via=quote)
message = "\n".join(["krin-in-v2", "GET", host, path, query])
sig = hmac.new(secret.encode(), message.encode(), hashlib.sha256).hexdigest()
return f"https://{host}{path}?{query}&sig={sig}"

Test vector. Inbound secret kin_test_9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d, offer key ok_7Hq2Lm9Xp4, so the path is /pb/ok_7Hq2Lm9Xp4. The query as sent, without sig:

click_id=clk_101kbnkrpg0fgz9y6hb7h6nwvvg1ra6qryj0a7w66shm3athrmsfb&event=level_10&txn_id=txn-889911&ts=1764867600
sig = 24bf769642a4ab07b0a855ab9777cdb953380e200a717e1e87e5e38773431b18
status body what it means
200 {"status":"accepted","conversion_id":"cnv_..."} recorded
200 {"status":"duplicate"} already recorded; nothing changed
400 pb_bad_parameter a value has the wrong shape, bad encoding or a control character
400 pb_duplicate_parameter a parameter appears twice
401 pb_unauthenticated the signature doesn’t match, ts is more than 900 seconds from KRIN’s clock, or the IP isn’t on the list (one answer for every authentication failure)
404 pb_unknown_click the click token is wrong, unknown, or belongs to another offer
405 only GET is accepted
414 the query is over 4 KB
422 pb_undeclared_event the event key isn’t declared on the offer
422 pb_app_mismatch the app in the postback isn’t the offer’s app
429 rate_limited too many requests; retry after the Retry-After seconds
503 unavailable retry after the Retry-After seconds

Error bodies look like {"error":"pb_unknown_click"}. A click is recorded the moment it happens, so a postback never waits for its click.

The answer never says whether a rule held or rejected the conversion. You see that in the console (Conversions, with the reason) and with GET /v1/decisions/explain.

Duplicates. KRIN keeps one conversion per click, event and txn_id (or per occurrence, for events you marked repeatable), and one install per device per app. Retrying the same postback is safe.

Offer → Test tracking (or POST /v1/advertiser/offers/{offer_id}/tracking-tests) sends a test click through your link and waits for your test postback. It shows every hop: the redirect chain, the click KRIN made, and the postback that came back.

What happens after KRIN accepts a conversion

Section titled “What happens after KRIN accepts a conversion”
  • KRIN checks timing between the click and each event with its own clocks, plus device and network facts. Anything a rule holds or rejects shows its reason in your console: the code for your own rules, or “KRIN Conversion Integrity” when one of KRIN’s checks decided.
  • You pay only for conversions that are credited. Held conversions are not charged until they’re approved.
  • You can reverse a credited conversion, with a reason and evidence, only inside the reversal window you declared on the offer (14 to 30 days). After it, the conversion is final for everyone.

Can I report conversions from the browser with a pixel? No. KRIN accepts conversions only from servers: yours, your tracker’s or your MMP’s.

My tracker can’t compute HMAC. What then? Send the conversion from your MMP instead: AppsFlyer, Adjust and Singular postbacks are checked against the MMP’s published IP ranges plus a key. A generic tracker must sign. The click token is still checked on every postback.

My signature is right in a test script but KRIN answers 401. Why? Usually the query you send differs from the one you signed: an HTTP client re-encoded a value, sorted the parameters, or added one after signing. Sign the exact string you put on the wire, and add sig last. Also check ts: it must be the current time in unix seconds.

Do publishers see what I pay per event? No. Publishers see only their own net per event. Your costs, bids and private deals are never shown to them.

Which timestamp should ts be? The time you send the postback, in unix seconds. KRIN measures the conversion time with its own clock.

llms.txt