Guide 01
Launch a 10,000-code campaign in one call
Anything above 10 codes goes through code batches: one POST queues the generation, Pixoo processes it FIFO per shop, and you collect the codes when it completes.
1Queue the batch
The call returns 202 immediately with a codeBatch to track. The Idempotency-Key makes retries safe — replays return the original batch instead of queuing a second one.
curl -X POST https://api.pixoo.app/api/v1/discounts/1234567890/code-batches \
-H "Authorization: Bearer pixoo_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: summer-launch-2026" \
-d '{"quantity": 10000, "prefix": "SUMMER-"}'{
"codeBatch": {
"id": "cb_9b1deb4d…",
"status": "queued",
"totalCodes": 10000,
"codesProcessed": 0,
"percentComplete": 0,
"queuePosition": 0,
"discountId": "1234567890",
"createdAt": "2026-07-10T09:00:00Z",
"completedAt": null,
"error": null
}
}2Wait for it — webhook or poll
Subscribe to code_batch.completed (see the webhook guide) and Pixoo pings you the moment the batch lands. Or poll the batch — once completed, add ?include=codes to fetch every code in one go.
curl "https://api.pixoo.app/api/v1/code-batches/cb_9b1deb4d…?include=codes" \
-H "Authorization: Bearer pixoo_live_YOUR_KEY"{
"codeBatch": {
"id": "cb_9b1deb4d…",
"status": "completed",
"totalCodes": 10000,
"codesProcessed": 10000,
"percentComplete": 100,
"queuePosition": null,
"discountId": "1234567890",
"createdAt": "2026-07-10T09:00:00Z",
"completedAt": "2026-07-10T09:04:12Z",
"error": null,
"codes": ["SUMMER-7F3K9Q2M8T1Z", "SUMMER-2B8XW4KQ90MJ", "…"]
}
}3Distribute
The codes are yours: pipe them to your ESP, print partner, loyalty platform or affiliate portal. Each code is unique on the discount, and the discount enforces all the usual Pixoo rules — markets, currencies, caps — at checkout.