> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kairos.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Get your users' orders, fills, settlements and fees pushed to your server as signed HTTPS requests.

Webhooks tell your server what happens to the wallets and orders that come through your partner id, without polling. Kairos sends each event as a signed `POST` to the endpoints you register.

## Register an endpoint

Endpoints are managed in the partner dashboard at `https://dashboard.kairos.trade`, under **Webhooks**. Kairos invites your team to it ([onboarding](https://docs.kairos.trade/wallets/onboarding.md)). The owner, admin and developer roles can manage webhooks. There is no API for it.

For each endpoint you set:

* **A URL.** It must be `https`, with no user or password in it, on port 443 or 1024 and up, and resolve to a public address. Redirects are not followed.
* **The events it receives.** An endpoint only gets the types you pick.
* **A description**, optional.

The dashboard shows the endpoint's signing secret (`whsec_…`) once, when you create it. Keep it on your server. **Rotate** replaces it at once: the old secret stops working. You can have up to 10 endpoints.

From the dashboard you can also send a test event, see each delivery with its HTTP status, and retry a failed one.

## What Kairos sends

Every delivery is a `POST` with a JSON body:

```json theme={null}
{
  "id": "5d0f4c3e-8a1b-4c2d-9e7f-6a5b4c3d2e1f",
  "type": "order.filled",
  "createdAt": "2026-11-09T12:00:00.000Z",
  "orgId": "<your partner id>",
  "test": false,
  "data": { … }
}
```

| Field | Means |
| - | - |
| `id` | The event id. The same event has the same `id` on every retry and on every endpoint |
| `type` | One of the [event types](#event-types) |
| `createdAt` | When Kairos recorded the event |
| `orgId` | Your partner id |
| `test` | `true` for a test event sent from the dashboard. Its `data` is a sample, not a real object |
| `data` | The event's object. See [bodies](#bodies) |

Headers:

| Header | Value |
| - | - |
| `Kairos-Signature` | `t=<unix seconds>,v1=<hex HMAC-SHA256>`. See [verify the signature](#verify-the-signature) |
| `Kairos-Event-Id` | The event `id` |
| `Kairos-Event-Type` | The event `type` |
| `Kairos-Delivery-Id` | This endpoint's delivery of the event. The same on every retry |
| `Kairos-Delivery-Attempt` | `1` on the first try, then `2`, `3`, … |
| `Content-Type` | `application/json` |
| `User-Agent` | `Kairos-Webhooks/1.0` |

Bodies are at most 256 KiB.

## Verify the signature

`v1` is the HMAC-SHA256, in hex, of `<t>.<raw body>`, keyed with your endpoint's whole secret, `whsec_` included. Compute it over the raw bytes you received, before parsing the JSON. Each attempt is signed again with a new `t`.

```js Node theme={null}
import crypto from 'node:crypto'

export function verify(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')))
  const t = Number(parts.t)
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false
  const expected = crypto.createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest('hex')
  const given = Buffer.from(parts.v1 ?? '', 'hex')
  return given.length === 32 && crypto.timingSafeEqual(given, Buffer.from(expected, 'hex'))
}
```

```python Python theme={null}
import hashlib, hmac, time

def verify(raw_body: bytes, header: str, secret: str, tolerance_sec: int = 300) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    t = int(parts.get("t", "0"))
    if not t or abs(time.time() - t) > tolerance_sec:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts.get("v1", ""))
```

Kairos doesn't check `t` for you. Refusing old timestamps, as above, stops a captured request from being replayed later.

## Answer and retries

Answer with any `2xx` within 5 seconds. Anything else, a redirect, or a timeout is a failed attempt. Kairos tries each delivery up to 8 times, waiting about 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 24 hours between tries (with some jitter): about 45 hours in all. Test events are sent once.

* **Delivery is at least once.** Deduplicate on `id`.
* **Order is not guaranteed.** Events for one order can arrive in any order across types. Each order body carries `status` and `updatedAt`: apply the latest.
* **Events can arrive late.** An event that couldn't be sent at once is still delivered later.

Answer quickly and do the work afterwards, so a slow handler doesn't turn into retries.

## Event types

| Type | Sent when |
| - | - |
| `order.created` | Kairos records an order |
| `order.partially_filled` | An order's filled size grows but the order is still open. Once per new filled size |
| `order.filled` | An order is completely filled |
| `order.cancelled` | An order is cancelled or expires. Its fills, if any, stay |
| `order.rejected` | An order fails without any fill |
| `trade.executed` | A fill |
| `position.settled` | A position your users' orders bought is redeemed after its market resolved |
| `ctf.split`, `ctf.merge`, `ctf.redeem` | A [split, merge or redeem](https://docs.kairos.trade/wallets/onchain.md) is confirmed on-chain |
| `wallet.created` | Kairos first sees a wallet through your partner id |
| `deposit.completed`, `withdrawal.requested`, `withdrawal.completed`, `withdrawal.failed` | A deposit or withdrawal that Kairos records for one of your users' wallets |
| `fee.accrued` | A fill earns you a [partner fee](https://docs.kairos.trade/wallets/fees.md) |
| `payout.sent` | Kairos pays your partner fees out to you |
| `usage.threshold_reached` | Your usage reaches 80% or 100% of your plan's allowance in a billing period |

## Bodies

Amounts ending in `Cents` are whole US cents. Prices ending in `Bps` are basis points of \$1: `5200` is a price of 0.52. Sizes are shares, as decimal strings. Times are RFC 3339 in UTC.

### Orders (`order.*`)

```json theme={null}
{
  "id": "9c5e9020-4c29-4905-bd34-e589a1fd0e5f",
  "clientOrderId": "0x6f1c2d3e4b5a4c6d8e7f90a1b2c3d4e5",
  "createdAt": "2026-11-09T12:00:00.000Z",
  "updatedAt": "2026-11-09T12:00:01.250Z",
  "wallet": "0x…",
  "venue": "polymarket",
  "marketId": "0x0e9d…88b2",
  "marketTitle": "Buccaneers vs. Bears",
  "category": "sports",
  "tokenId": "1142740024747353410…",
  "outcome": "Buccaneers",
  "side": "buy",
  "type": "limit",
  "timeInForce": "FAK",
  "postOnly": false,
  "priceBps": 3100,
  "avgFillPriceBps": 3050,
  "size": "50",
  "filledSize": "50",
  "notionalCents": 1550,
  "filledCents": 1525,
  "feeCents": 0,
  "partnerFeeCents": 0,
  "status": "filled"
}
```

* `id` is the Kairos order id: the `orderId` from the [order result](https://docs.kairos.trade/wallets/reference.md#order) and the [orders read](https://docs.kairos.trade/wallets/portfolio.md).
* `wallet` is the address that holds the position. On Polymarket that is the wallet's trading wallet, not the signing address.
* `status` is `open`, `partially_filled`, `filled`, `cancelled` or `rejected`. `rejectReason` is added on `rejected`: `insufficient_balance`, `market_closed`, `price_out_of_bounds`, `tick_size`, `venue_rejected`, `rate_limited`, `geo_blocked` or `other`.
* `type` is `limit` or `market`. `avgFillPriceBps` is `null` until something fills.
* `feeCents` is the fee recorded on the order. `partnerFeeCents` is `0`: your share of each fill comes in `fee.accrued`.
* `category` is `politics`, `sports`, `crypto`, `economics`, `culture` or `other`.

### Fills (`trade.executed`)

`id`, `orderId`, `wallet`, `venue`, `marketId`, `marketTitle`, `category`, `tokenId`, `side`, `priceBps`, `size`, `notionalCents`, `feeCents`, `isMaker`, `txHash` (or `null`) and `executedAt`.

### Other events

| Type | `data` fields |
| - | - |
| `position.settled` | `id`, `address`, `venue`, `marketId`, `marketTitle`, `outcome`, `detail`, `asset`, `shares` (the shares your users' orders bought), `amountCents`, `txHash`, `at` |
| `ctf.*` | `id` (the intent id), `kind`, `wallet`, `venue`, `marketId`, `marketTitle`, `category`, `asset`, `amountRaw`, `decimals`, `amountCents`, `txHash`, `at` |
| `wallet.created` | `address`, `firstSeenAt`, `lastActiveAt` |
| `deposit.completed` | `id`, `chain`, `tokenSymbol`, `tokenAddress`, `decimals`, `amount`, `amountUsd`, `fromAddress`, `toAddress`, `txHash`, `createdAt`, `completedAt` |
| `withdrawal.*` | `id`, `status` (`requested`, `completed` or `failed`), `wallet`, `toAddress`, `amount`, `tokenAddress`, `chainId`, `txHash`, `reason` (on `failed`: `failed`, `cancelled` or `expired`), `createdAt`, `endedAt` |
| `fee.accrued` | `id` (the fill id), `orderId`, `wallet`, `venue`, `assetKey`, `decimals`, `feeRaw` (the whole fee on the fill), `partnerFeeRaw` (your share), `at`. Booked, not yet collected: the wallet pays it in a later [settlement](https://docs.kairos.trade/wallets/fees.md#how-fees-are-collected) |
| `payout.sent` | `id`, `assetKey`, `decimals`, `amountRaw`, `txHash`, `createdAt` |
| `usage.threshold_reached` | `object` (`usage`), `meter`, `threshold` (`80` or `100`), `plan`, `periodStart` and `periodEnd` (the period's first and last day, `YYYY-MM-DD`), `used`, `included`, `beyond` (`billed` or `capped`) |

Amounts ending in `Raw` are integers in the token's smallest unit; `decimals` scales them.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.