Organiser API
The organiser API lets your own website or app check whether someone holds a valid ticket for one of your events. For example, you can unlock members-only content once a ticket holder enters their ticket code.
Getting an API key
Open your organisation's settings, go to API Key and choose Generate API key. The key starts with zwt_.
- The key is shown once. Copy it and store it somewhere safe, like your server's environment variables.
- Choose Rotate API key to replace it. The old key stops working straight away.
- Each organisation has one key, and it works for all of the organisation's events.
Keep the key on your server. Anyone who has it can check tickets for your events. Never put it in browser JavaScript, a mobile app or a public code repository. Your website should send the ticket code to your own server, and your server should call this API.
Authentication
Send the key in the Authorization header of every request:
Authorization: Bearer zwt_YOUR_API_KEYVerify a ticket
POST https://zerowastetickets.com/api/v1/tickets/verifyThe request body is JSON:
event_id: the event's ID. You can find it in the address bar when you manage the event, for example/admin/events/EVENT_ID/settings.code: the ticket code the ticket holder gives you. This is usually the 8-character code shown on their ticket, such asAB12CD34. Capital and lower-case letters are treated the same. The full code from the ticket's QR code also works.
Example
curl -X POST https://zerowastetickets.com/api/v1/tickets/verify \
-H "Authorization: Bearer zwt_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"event_id": "YOUR_EVENT_ID", "code": "AB12CD34"}'Response
{
"valid": true,
"status": "unused",
"ticket_type": "Weekend Pass",
"ticket_id": "4b1c7388-2f6a-4c1e-9d0b-7a55e3c1f210"
}valid:trueif the code belongs to a current ticket for this event. This is the field to check.status: the ticket's state.unusedandused(already checked in) are valid.transferring(being passed to someone else) andcancelledare not.ticket_type: the name of the ticket type.ticket_id: a permanent ID for the ticket. Use it to make sure each ticket unlocks your feature only once.
If no ticket matches, you get "valid": false and the other fields are null. The API never returns the ticket holder's name or email address.
Errors
Errors return JSON such as {"error": "not found"} with one of these status codes:
400: the request body is not valid JSON, orevent_idis not a valid ID.401: the API key is missing, wrong or has been replaced.404: the event doesn't exist or belongs to another organisation.429: too many requests. Wait a moment and try again.
Things to know
- When a ticket is transferred, it gets a new code and the old one stops working. The
ticket_idstays the same. - Requests are rate limited to about 10 a second, with short bursts of up to 30.
- Ticket holders can share their code with other people. If that matters for your feature, record the
ticket_idand allow one unlock per ticket.
Help
Questions or problems? Get in touch.