# Headless offers: KRIN offers in your own app

> **Not live on production yet.** This guide follows the published API contract. Its steps work once these parts answer in production: Properties, placements and secrets, Headless Offer API: offers in your own app, API keys for the public API.

> With the Headless Offer API your server asks KRIN for one user's ranked offers, draws them in your own app, and starts the offer the user taps. KRIN answers a single-use click link on t.krin.io; open it on the user's own device. The reward comes back on your placement's reward postback, as for the wall.

The KRIN wall is a ready-made page. If you would rather draw offers in your own app, with your own cards and layout, use the Headless Offer API. Your users get the same offers the wall would show them, in the same order, with the same rules.

> **Answer.** With the Headless Offer API your server asks KRIN for one user's ranked offers, draws them in your own app, and starts the offer the user taps. KRIN answers a single-use click link on t.krin.io; open it on the user's own device. The reward comes back on your placement's reward postback, as for the wall.

## What you need

- A placement in app.krin.io with its reward postback connected ([Quickstart](https://docs.krin.io/en/publishers/quickstart/web), [Reward postbacks](https://docs.krin.io/en/publishers/postbacks)).
- A publisher secret API key on your server. Listing needs the `offers:read` scope. Starting needs `offers:start`; `offers:read` alone can't start. Use a `krin_sk_test_` key and a Sandbox placement while you build.
- For each request: your id for the user (the same one your wall links use), the IP address their device reached your server from, and the user agent of the browser or web view that will open the click.

The user id, IP and user agent always go in the JSON body, never in the URL.

## 1. List the user's offers

```bash
curl -X POST "https://api.krin.io/v1/headless/offers/query?placement_id=plc_...&country=US&limit=20" \
  -H "Authorization: Bearer $KRIN_SECRET_KEY" \
  -H "Krin-Version: 2026-12-04" \
  -H "Content-Type: application/json" \
  -d '{"user_id": "user-1234", "ip": "203.0.113.7", "user_agent": "Mozilla/5.0 (Linux; Android 14) ..."}'
```

The answer is one page of ranked offers, the same shape the wall gets: each offer has its `id`, title, art, steps and rewards in your placement's currency.

- `country` filters the list. The click itself is priced and checked on the country the user's browser comes from.
- The user agent decides the platform. Without it, the list has web offers only.
- `tab` picks a list (`for_you` by default, or `games`, `apps`, `quick`, `surveys`), and `q` in the body searches it.
- Pass `next_cursor` as `cursor` for the next page. A cursor works only with the key and the user it came from.

The user is the same user as on your wall: their history, caps and age range are shared. Until they give their age range, the list holds the offers open to every age.

## 2. Start the offer the user taps

```bash
curl -X POST "https://api.krin.io/v1/headless/offers/ofr_.../start" \
  -H "Authorization: Bearer $KRIN_SECRET_KEY" \
  -H "Krin-Version: 2026-12-04" \
  -H "Idempotency-Key: 0b6f7a52-8d0e-4b8f-a1f4-5c2d9e3a7b10" \
  -H "Content-Type: application/json" \
  -d '{"placement_id": "plc_...", "country": "US", "user_id": "user-1234", "ip": "203.0.113.7", "user_agent": "Mozilla/5.0 (Linux; Android 14) ..."}'
```

```json
{ "click_id": "clk_...", "redirect_url": "https://t.krin.io/c/..." }
```

`redirect_url` is single use. Send it straight to the user's app; don't store it. `?dry_run=true` runs every check and answers the `click_id` it would make, with `redirect_url` null.

## 3. Open the click on the user's device

Open `redirect_url` on the user's own device, in the browser or web view whose user agent you sent. KRIN sends the user on to the offer.

> **The click must open from the user's device.** The browser that opens `redirect_url` must come from the same IP network (the same /24 for IPv4, /48 for IPv6) and with the same user agent you sent at start. Otherwise it isn't redirected and nothing is credited, and the mismatch counts against the placement's quality. Never open the link from your server.

When the user completes the offer, KRIN sends your placement's reward postback, exactly as for the wall. Its `launch` field is `headless`.

## When start says no

| Answer | What it means | What to do |
|---|---|---|
| 403 `onboarding_required` | The user hasn't chosen an age range or accepted the wall's terms yet | Open your wall for this user once with a signed link. After they choose their range and accept, start works |
| 403 `network_refused` | The IP is a data center, VPN, proxy or Tor network | Send the IP the user's device reached you from |
| 404 | This user can't see this offer or placement | List again and start an offer from the new list |
| 409 `already_started` | The Idempotency-Key was used before. The single-use link is never stored | Start again with a new key |
| 409 `placement_not_serving` | The placement is paused or not live | Check the placement in the console |
| 429 `click_limit`, `rate_limited` | Too many starts or calls | Wait for `Retry-After` |

## Testing

A console member (developer and up) can call the list too. Their calls are previews: they never count in stats, reports or ranking. A member can start only on a Sandbox account, where clicks are test clicks.

All error codes are on [Errors](https://docs.krin.io/en/errors/). The full request and answer shapes are in the [API reference](https://docs.krin.io/en/api).
