API basics
These eight rules apply to every request, so once you've read them the rest of the API will feel predictable.
1. Making a request#
Send every request to https://api.eventtickets.dev/v1 with your secret key in the Authorization header. Request bodies are JSON sent with Content-Type: application/json, and every response comes back as JSON too.
curl https://api.eventtickets.dev/v1/events \ -H "Authorization: Bearer sk_test_..."
Keep your keys on your server and never put one in a web page, an app or a public code repository, because anyone with your key can act as your account. If a key leaks, revoke it in Developers and make a new one.
2. Test mode and live mode#
Your account has two separate sets of data: a sk_test_ key only sees test events, orders and tickets, and a sk_live_ key only sees live ones. Every object has "livemode": true or false so you can tell them apart, which means you can build and try everything with a test key and then swap in your live key.
3. Money and dates#
Amounts are always whole numbers in the smallest unit of the currency, with no decimals anywhere. For pounds that's pence, so 1200 is £12.00 and 50 is 50p.
Dates are ISO 8601 with a timezone, like 2026-11-14T22:00:00Z (the Z means UTC), and we always reply in UTC.
4. Key permissions#
A key can have full access, or only the permissions you tick when you create it, and a :write permission includes reading the same things. Give your website the least it needs: a site that only sells tickets needs events:read and checkout:write.
- events:read / write
- Events and their days, ticket types, prices, add-ons and series.
- checkout:write
- Start checkouts and look them up.
- orders:read / write
- Orders, and with write the key can also refund and resend tickets.
- tickets:read / write
- Tickets, and with write the key can also issue and cancel comps.
- coupons:read / write
- Discount codes.
- webhooks:read / write
- Webhook endpoints.
- branding:read / write
- Your branding: colours and wording on checkout and confirmation, contact email and ticket email style.
- fans:read / write
- Your fan list, and with write the key can also add, tag, unsubscribe and remove fans.
- campaigns:read / write
- Email campaigns and their results, and with write the key can also send and cancel them.
5. When something goes wrong#
Errors always have the same shape: a short code for your program, a message written for people, and param when one field is the problem. The message is safe to log, and usually tells you how to fix it.
{
"error": {
"code": "invalid_request",
"message": "Choose between 1 and 10 tickets.",
"param": "quantity"
}
}- 400 invalid_request
- Something in the request is missing or wrong, so check param and message to see what.
- 401 unauthorized
- No key, a mistyped key, or a revoked key.
- 403 forbidden
- The key doesn't have the permission this needs.
- 404 resource_missing
- No such object, or it belongs to the other mode (test vs live).
- 409 conflict
- The request is allowed in general but not right now, like refunding an unpaid order.
- 409 account_not_approved
- Your first live event hasn't been approved yet, so live events can't go on sale until you submit it for review from the dashboard. Test mode isn't affected.
- 422 idempotency_key_reused
- You reused an Idempotency-Key with a different request.
- 429 rate_limited
- You've sent too many requests, so wait the number of seconds in Retry-After before trying again.
- 500 api_error
- Something went wrong on our side, so retry with the same Idempotency-Key.
6. Safe retries#
Networks fail, and when a request times out you can't tell whether it worked, so sending it again could, say, refund twice. To make a retry safe, add an Idempotency-Key header to POST requests: any unique string, such as your own order number.
If we've seen that key in the last 24 hours, we don't do the work again and send back the first answer instead, with the header Idempotent-Replayed: true.
curl https://api.eventtickets.dev/v1/orders/ord_9c1e4b7a2d3f5e60/refund \ -X POST \ -H "Authorization: Bearer $EVENTTICKETS_KEY" \ -H "Idempotency-Key: refund-ord_9c1e4b7a2d3f5e60"
7. Lists and paging#
Anything that returns many objects gives you one page at a time, newest first, and you can ask for up to 100 with limit (default 20). If has_more is true, ask again with starting_after set to the id of the last object you got.
let after;
do {
const url = new URL("https://api.eventtickets.dev/v1/orders");
url.searchParams.set("limit", "100");
if (after) url.searchParams.set("starting_after", after);
const page = await fetch(url, { headers: { Authorization: `Bearer ${key}` } }).then((r) => r.json());
for (const order of page.data) console.log(order.id, order.amount_total);
after = page.has_more ? page.data.at(-1).id : undefined;
} while (after);8. Rate limits#
Each live key can make 300 requests a minute and each test key 100, and every response tells you where you stand with X-RateLimit-Remaining and X-RateLimit-Reset. If you go over, you get a 429 with a Retry-After header saying how many seconds to wait.