# Quickstart: your first KRIN wall in 10 minutes

> **Not live on production yet.** This guide follows the published API contract. Its steps work once these parts answer in production: Sign-up and sign-in, Properties, placements and secrets, Postback settings and test postbacks, Placement go live, pause and resume, Offer wall page from a signed link.

> To add the KRIN offer wall, create an app or site and a placement in app.krin.io, create the placement's launch key and postback key, sign each wall link on your server, and connect a postback URL. KRIN sends a signed test postback; when your server answers 2xx and one signed link has opened the wall, you can go live.

Your users open a wall of offers, complete them, and your server credits their reward when KRIN tells it to.

> **Answer.** To add the KRIN offer wall, create an app or site and a placement in app.krin.io, create the placement's launch key and postback key, sign each wall link on your server, and connect a postback URL. KRIN sends a signed test postback; when your server answers 2xx and one signed link has opened the wall, you can go live.

What you need: a server that can compute HMAC-SHA256, and an https endpoint on that server that can receive KRIN's postback. With those ready, the steps below take about 10 minutes.

## 1. Create your account

1. Open **app.krin.io** and enter your work email. KRIN sends a 6-digit code; there is no password.
2. Create your organization. To **How will you use KRIN?** answer **Publisher**, then agree to the KRIN Platform Terms.
3. When the console offers it, choose **Add a passkey** (Face ID, Touch ID, Windows Hello or a security key). KRIN asks you to sign in with your passkey before it creates a key in step 4. You can also add one later in **Settings**.

Every new organization starts at the **Sandbox** level, so you can finish this whole guide before any real money moves.

## 2. Add your app or site, then a placement

A **placement** is one wall inside your app or site. Each placement has its own currency, look, keys and postback.

1. Open **Placements** and choose **Add app or site**: pick **App** (Android or iOS, with its package or bundle id) or **Site** (its address), give it a name and say where you promote it.
2. Choose **New placement**, pick the app or site, name the placement (only you see this name) and pick the kind **Offers**. Surveys and Mixed open when KRIN's first survey source is live.
3. **Create as draft.** Every new placement starts as **Draft**.

Then open the placement. Its tabs are **Overview**, **Look**, **Currency**, **Postback and keys** and **Go live**.

- **Currency:** the name (singular and plural) and the **Rate per $1**: how much of your currency a user gets for each $1 you earn. With 1,000 and rounding down, an offer that earns you $0.41 shows 410. You also choose the rounding and the smallest reward.
- **Look:** accent, light or dark mode (or Auto, which follows each user's device), corners and the default order of offers. The preview uses example offers, not real advertisers.

## 3. Choose how users open the wall

Open the signed link (step 5) as a page, or in an app WebView. That works for every placement.

Showing the wall inside an iframe on your own web page opens soon: it needs the list of sites allowed to embed the wall, which you'll set on the placement.

## 4. Create the launch key and the postback key

Open **Postback and keys**:

1. Under **Launch key**, choose **Create key**. Copy the key at once: it starts with `kls_live_` and **is shown only once**. Put it straight into your server's secret store. Your server signs each wall link with it.
2. Under **Postback key**, choose **Create key** the same way. It starts with `kps_live_`. KRIN signs every postback with it, and your server checks that signature.

Creating the first launch key moves the placement from **Draft** to **Testing**. Only owners and admins can create keys.

KRIN never stores a key in clear and can't show it again. If you lose one, choose **New key**: the previous key keeps working for 24 hours, so you can switch without a gap.

## 5. Sign the wall link on your server

Never sign in the browser or the app: the key must stay on your server.

The link is `https://wall.krin.io/w` with `placement`, `user_id`, `ts` (unix seconds), a one-time `nonce` and `sig`. `sig` is HMAC-SHA256 with your launch key over these lines, joined with `\n`:

```
krin-launch-v1
{placement}
{user_id}
{ts}
{nonce}
{sub_ids}
```

`{sub_ids}` is empty unless you pass tracking sub-ids (up to 5, for example where the user came from). Then it is the keys sorted, `key=value` joined by `&`, percent-encoded as RFC 3986.

```js
// Node 18+ (from docs code/krin.mjs)
import { createHmac, randomBytes } from "node:crypto";

const enc = (s) =>
  encodeURIComponent(s).replace(/[!'()*]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());

export function signLaunchUrl(secret, { placement, userId, subIds = {} },
    ts = Math.floor(Date.now() / 1000), nonce = randomBytes(16).toString("hex")) {
  const keys = Object.keys(subIds).sort();
  const sub = keys.map((k) => `${enc(k)}=${enc(subIds[k])}`).join("&");
  const message = ["krin-launch-v1", placement, userId, String(ts), nonce, sub].join("\n");
  const sig = createHmac("sha256", secret).update(message).digest("hex");
  const query = new URLSearchParams({ placement, user_id: userId, ts: String(ts), nonce, sig });
  for (const k of keys) query.append(`sub_ids[${k}]`, subIds[k]);
  return { url: `https://wall.krin.io/w?${query}`, sig };
}
```

```php
<?php
// PHP 8.1+ (from docs code/krin.php)
function krin_sign_launch_url(string $secret, string $placement, string $userId, array $subIds = [],
                              ?int $ts = null, ?string $nonce = null): string {
    ksort($subIds, SORT_STRING);
    $sub = implode('&', array_map(
        fn ($k) => rawurlencode((string) $k) . '=' . rawurlencode((string) $subIds[$k]),
        array_keys($subIds)
    ));
    $ts = (string) ($ts ?? time());
    $nonce ??= bin2hex(random_bytes(16));
    $sig = hash_hmac('sha256', implode("\n", ['krin-launch-v1', $placement, $userId, $ts, $nonce, $sub]), $secret);
    $query = ['placement' => $placement, 'user_id' => $userId, 'ts' => $ts, 'nonce' => $nonce, 'sig' => $sig];
    foreach ($subIds as $k => $v) {
        $query["sub_ids[$k]"] = $v;
    }
    return 'https://wall.krin.io/w?' . http_build_query($query, '', '&', PHP_QUERY_RFC3986);
}
```

```python
# Python 3.9+ (from docs code/krin.py)
import hashlib, hmac, secrets, time
from urllib.parse import quote, urlencode

def sign_launch_url(secret, placement, user_id, sub_ids=None, ts=None, nonce=None):
    sub_ids = sub_ids or {}
    keys = sorted(sub_ids)
    sub = "&".join(f"{quote(k, safe='')}={quote(sub_ids[k], safe='')}" for k in keys)
    ts = str(int(time.time()) if ts is None else ts)
    nonce = nonce or secrets.token_hex(16)
    message = "\n".join(["krin-launch-v1", placement, user_id, ts, nonce, sub])
    sig = hmac.new(secret.encode(), message.encode(), hashlib.sha256).hexdigest()
    params = [("placement", placement), ("user_id", user_id), ("ts", ts), ("nonce", nonce), ("sig", sig)]
    params += [(f"sub_ids[{k}]", sub_ids[k]) for k in keys]
    return "https://wall.krin.io/w?" + urlencode(params, quote_via=quote)
```

**Check your code against the test vector.** With launch secret `kls_test_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d`, placement `plc_01kbmz6v7r1s0e5d4c3b2a1z0y`, user `player-1042`, ts `1764867600`, nonce `n0nce-7f3a9c2e1b4d` and sub-ids `s1=spring`, `s2=tiktok`, the signature must be:

```
2b9e27a873a2d1da412af2d1d4a794ebc3f7e07f5a511117cc6cf494bf7b3800
```

What the wall checks, and what happens otherwise:

| check | otherwise |
|---|---|
| `ts` within 5 minutes of KRIN's clock | 401 `launch_rejected` |
| `sig` matches this placement's launch key | 401 `launch_rejected` |
| each `nonce` (16 to 128 printable characters) is used once | 401 `launch_nonce_reused`: build a new link |
| `user_id` is your own id for the user: 1 to 128 printable ASCII characters, no spaces | 400 `validation_failed` |
| `user_id` doesn't start with `krin_` (those ids are KRIN's own: test walls, previews, Sandbox test events) | 401 `launch_rejected` |
| the placement is Testing or Live and your account is active | 409 `placement_not_serving` |

When a check fails, the user sees a short page in their language that says the wall couldn't be opened. So sign a fresh link each time the user opens the wall, and never cache links or put them in emails.

## 6. Open or embed the wall

- **Link or app WebView:** open the signed URL.

## 7. Connect your postback and send a test

In **Postback and keys → Reward postback**:

1. **Method:** a **GET** URL template (KRIN fills in macros) or **POST JSON** (KRIN posts the signed message as JSON).
2. **Your URL:** https on port 443, a public host name.
   - GET: include every signed value: `{sig}` `{ts}` `{conversion_id}` `{kind}` `{user_id}` `{reward}` `{payout_micros}` `{test}`. For example `https://api.example.com/krin/postback?conversion_id={conversion_id}&kind={kind}&user_id={user_id}&reward={reward}&payout_micros={payout_micros}&ts={ts}&test={test}&sig={sig}`.
   - POST: no macros in the URL; the values travel in the signed body.
3. **Also send holds and declines** is optional. Credits and reversals are always sent.
4. Choose **Send test postback**.

KRIN sends a real signed message to your URL with `test` set (`true` in JSON, `1` in a GET URL), the user `krin-test-user` and the event `krin_test` ("KRIN test postback"). It carries a net of $0.10 (`payout_micros` 100000) and the reward your currency settings give for it. The console shows your server's HTTP status, the time it took and the request with the keys masked.

- Answer **2xx**. The console then says **Postback acknowledged**.
- Check the signature before you answer, and never credit a test message. [Verify KRIN postbacks](https://docs.krin.io/en/publishers/postbacks/verify) walks through one GET and one POST check with real values.
- A 401 or 403 makes the console say your server refused the signature. The usual cause is checking with the launch key instead of the postback key, or signing the URL-encoded values instead of the decoded ones.
- Changing the URL or the method clears the acknowledgement, so test again after any change.
- Up to 30 tests per placement per hour.

## 8. Go live

Open **Go live**. The **Go-live checklist** has two checks, and both come from real events, so neither can be ticked by hand:

1. **Signed launch verified:** open your own signed link once (step 5), from your app or site.
2. **Postback answered:** your server answered a signed test with 2xx (step 7).

When both are done, **Go live** opens the placement to real users, and **Overview** shows the wall link.

At the **Sandbox** level your wall never shows real offers.
Until KRIN's test offers open, it says there are no offers right now.
Real offers arrive as your organization moves up a level. See the [Publisher FAQ](https://docs.krin.io/en/publishers/faq).

## Next steps

- [Verify KRIN postbacks](https://docs.krin.io/en/publishers/postbacks/verify): the signature check, step by step, with the krin-pb-v2 example.
- [Reward postbacks](https://docs.krin.io/en/publishers/postbacks): every message kind and field, retries and replays.
- [Signatures](https://docs.krin.io/en/reference/signatures): every KRIN signature and its test vector in one place.
- [Publisher FAQ](https://docs.krin.io/en/publishers/faq): earnings, holds, levels and payouts.
- [What's live](https://docs.krin.io/en/live): what answers in production today.

## FAQ

**Can I open the wall without signing the link?**
No. A placement created in the console opens only from a signed link, so each session belongs to a user you know.

**Why did my user see that the wall couldn't be opened?**
The link's `ts` was more than 5 minutes old, its nonce was already used, or the signature didn't match. Sign a new link each time the user opens the wall.

**Does the wall work inside an Android app?**
Yes, in a WebView with the signed link.

**When do I credit the user?**
Only when your server receives a postback with a valid signature and `kind` set to `credit`, and `test` is false (`0` in a GET URL). Nothing the page or the wall shows is a credit.

**What does the user's reward depend on?**
Your net earnings on the offer times your Rate per $1, then your rounding and smallest reward.
