WinIt for Business · API v1
One REST API over JSON: sell or gift raffle tickets, run private draws for your own guest list, plug into XP and referrals, and get signed webhooks when something happens.
1. Get a partner account
Apply on the access form. We verify the business (KYB), then email a portal invite.
2. Mint a key
Create a test key in the partner portal, with only the permissions you need. We show the key once.
3. Call the API
Base URL https://winitnaija.com/api/v1. Every response is JSON with ok, requestId and either data or error.
Pass your key as a bearer token (or X-API-Key):
curl https://winitnaija.com/api/v1/account \
-H "Authorization: Bearer wn_live_xxxxxxxxxxxxxxxxxxxxxxxx"Amounts are always in minor units — pence for GBP, kobo for NGN. Keep every key server-side.
Sandbox keys
A wn_test_ key runs in the sandbox. It reads the real raffles and checks every order exactly like a live key — raffle open, quantity, answer, billing mode — but issues pretend ticket numbers, moves no money, charges no fees and never touches a player's account. CHECKOUT orders get a sandbox payment page where you choose “paid” or “walked away”; XP awards and reward claims answer as if they worked without changing anything. Webhooks still fire, with sandbox: true.
Each key only sees its own world: a test key can't read live orders or draws, a live key can't read sandbox ones, and an Idempotency-Key can't be reused across the two. Clear sandbox data any time from the portal. Switch to a wn_live_ key when you're ready to sell.
Each key carries a set of scopes. Ask for the narrowest set that does the job — you can mint more keys any time.
| Scope | What it allows |
|---|---|
account:read | Your partner profile, prepaid balance and billing ledger. |
raffles:read | Live raffles, ticket pricing bundles and published winners. |
orders:read | Look up orders you placed and the ticket numbers issued. |
orders:write | Issue tickets, or create a hosted checkout link for a customer. |
business:read | Your private Business draws, guest counts and winners. |
business:write | Create a Business draw, import guests and run the draw. |
referrals:read | Validate a referral code and read its stats. |
referrals:write | Generate referral codes and attach a referral to a player. |
rewards:read | Player XP, tier, streak and spin tokens; the rewards catalogue. |
rewards:write | Award partner-sponsored XP and claim an unlocked tier reward. |
webhooks:read | Your webhook URL and recent delivery attempts. |
webhooks:write | Change the webhook URL, rotate the secret, send a test event. |
* | Everything above. Use it only for a key you control end to end. |
PREPAID
Debits your prepaid balance in one atomic step and issues the tickets immediately.
POSTPAID
Charges against your credit limit and issues tickets immediately; we invoice and settle later.
CHECKOUT
Returns a hosted checkout link (checkoutUrl) so the end customer pays for the tickets themselves.
Send an Idempotency-Key header on every order so a retry never double-charges:
curl -X POST https://winitnaija.com/api/v1/orders \
-H "Authorization: Bearer wn_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Idempotency-Key: order-2026-03-14-0001" \
-H "Content-Type: application/json" \
-d '{
"competitionId": "cmp_123",
"quantity": 5,
"billingMode": "PREPAID",
"externalRef": "crm-8841",
"recipient": {
"firstName": "Ada",
"lastName": "Obi",
"email": "ada@example.com",
"phone": "08030000000"
}
}'The response:
{
"ok": true,
"requestId": "req_9f12ab34cd56",
"data": {
"order": {
"id": "pord_7h2k...",
"status": "PAID",
"billingMode": "PREPAID",
"quantity": 5,
"amountPence": 500,
"tickets": ["000418", "000419", "000420", "000421", "000422"],
"checkoutUrl": null
}
}
}One small fee on the money that moves, nothing per call, and your rates are always visible to you.
API calls: free
Calls cost nothing on the standard rates. We still count them, so you can see your usage day by day — very high-volume or data-only accounts may agree a per-call rate with us.
Money fee: 1%
1% of any money that moves through the API, and never more than ₦1,000 on one order. On PREPAID and POSTPAID it is charged with the order; on CHECKOUT, once your customer has paid. Sandbox orders are never charged.
Where to see it
GET /api/v1/account returns your rates and your usage so far this month; the partner portal shows the same, day by day.
No other charges
No set-up fee, no monthly fee, no minimum. Health checks and sandbox calls are always free.
Who you are, what you can spend, and whether the API is up.
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /api/v1/health | — | Health check and the currency this site runs in. |
| GET | /api/v1/account | account:read | Profile, prepaid balance, credit limit and ledger. |
Sell or gift tickets on live raffles from inside your own product.
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /api/v1/raffles | raffles:read | List live, closed and drawn raffles. |
| GET | /api/v1/raffles/:id | raffles:read | One raffle with its prizes and winners. |
| POST | /api/v1/orders | orders:write | Issue tickets or create a checkout link. |
| GET | /api/v1/orders | orders:read | Your recent orders. |
| GET | /api/v1/orders/:id | orders:read | One order with the ticket numbers issued. |
Private draws for your own guest list — nobody outside the list can enter.
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /api/v1/business/draws | business:read | Your private draws. |
| POST | /api/v1/business/draws | business:write | Create a private draw. |
| GET | /api/v1/business/draws/:id | business:read | One draw, its guests and winners. |
| POST | /api/v1/business/draws/:id/guests | business:write | Import guests (guests[] or csv). |
| POST | /api/v1/business/draws/:id/run | business:write | Run the draw and get the fairness proof. |
A whole Business draw, end to end:
# 1. create the draw
curl -X POST https://winitnaija.com/api/v1/business/draws \
-H "Authorization: Bearer wn_live_..." -H "Content-Type: application/json" \
-d '{ "title": "Staff Christmas draw", "eventAt": "2026-12-19T19:00:00+01:00",
"prize": "55-inch TV", "winnerCount": 3, "venue": "Eko Hotel" }'
# 2. import the guest list (guests[] or a csv string)
curl -X POST https://winitnaija.com/api/v1/business/draws/pdrw_123/guests \
-H "Authorization: Bearer wn_live_..." -H "Content-Type: application/json" \
-d '{ "csv": "Ada,Obi,ada@example.com,08030000000\nTom,Hart,tom@example.com," }'
# 3. run it — the response carries a proof per winner
curl -X POST https://winitnaija.com/api/v1/business/draws/pdrw_123/run \
-H "Authorization: Bearer wn_live_..."Every winner comes with a proof string — the hash and random seed behind that pick, so you (or your client) can show the draw was fair. Running a draw locks the guest list for good.
Hook your own loyalty programme into WinIt XP, tiers and referral codes.
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /api/v1/referrals/:code | referrals:read | Validate a code and read its stats. |
| POST | /api/v1/referrals | referrals:write | Generate a code or attach a referral. |
| GET | /api/v1/rewards | rewards:read | Tier rewards catalogue and XP rules. |
| GET | /api/v1/rewards/users | rewards:read | A player's XP, tier, streak and spin tokens. |
| POST | /api/v1/rewards/xp | rewards:write | Award partner-sponsored XP (idempotent by ref). |
| POST | /api/v1/rewards/claim | rewards:write | Claim an unlocked tier reward for a player. |
We POST signed JSON when something happens; you verify and act on it.
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /api/v1/webhooks | webhooks:read | Your webhook URL and delivery log. |
| PATCH | /api/v1/webhooks | webhooks:write | Update the URL or rotate the secret. |
| POST | /api/v1/webhooks/test | webhooks:write | Send yourself a signed webhook.test event. |
| Event | Sent when |
|---|---|
order.paid | A CHECKOUT order was paid and the tickets were issued. |
order.cancelled | An order was cancelled or its checkout expired. |
private_draw.completed | A Business draw was run — includes the winners and proofs. |
raffle.drawn | A public raffle you sold tickets on has been drawn. |
webhook.test | You pressed “Send a test event”. |
Each request carries X-WinIt-Event, X-WinIt-Delivery and X-WinIt-Signature: t=<unix>,v1=<hmac>. Verify it before you trust the body:
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyWinItWebhook(secret: string, sigHeader: string, rawBody: string) {
const parts = Object.fromEntries(sigHeader.split(",").map((p) => p.trim().split("=", 2)));
const expected = createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
return timingSafeEqual(Buffer.from(expected, "hex"), Buffer.from(parts.v1, "hex"));
}Failures return { ok: false, error: { code, message } } with the matching HTTP status. Quote the requestId when you ask us about one.
| Code | HTTP | What it means |
|---|---|---|
UNAUTHORIZED | 401 | No API key on the request, or it isn't a wn_ key. |
INVALID_API_KEY | 401 | The key is wrong or has been revoked. |
EXPIRED_API_KEY | 401 | The key passed its expiry date. |
PARTNER_SUSPENDED | 403 | The partner account is inactive — talk to us. |
INSUFFICIENT_SCOPE | 403 | The key doesn't carry the scope this endpoint needs. |
VALIDATION_ERROR | 400 | The body failed validation; details lists each problem. |
INVALID_JSON | 400 | The body wasn't valid JSON. |
INTERNAL_ERROR | 500 | Our end. Retry with the same Idempotency-Key. |
Tell us what you're building and we'll set up a test account the same week.
Apply for access