Jetron TicketFluid

Browser or server

Which calls belong in the browser, which belong on your server, and what changes when you proxy the API.

Every API endpoint except the attendee lookups takes your public key, so you can call it from browser code, from your own server, or both. What matters is whether a call reads data that is the same for everyone, or acts for one attendee. The attendee lookups take your private key and run on your server only.

At a glance

EndpointActs forCall it from
GET /hostEveryoneServer or browser. Server rendering suits it best
GET /eventsEveryoneServer or browser. Server rendering suits it best
GET /events/{slug}EveryoneServer or browser. Server rendering suits it best
GET /events/{slug}/galleryEveryoneServer or browser
GET /events/{slug}/sponsorsEveryoneServer or browser
GET /events/{slug}/momentsEveryoneServer or browser
GET /events/{slug}/ticketsEveryoneBrowser, so availability is live. Server is fine with a short cache
GET /events/{slug}/addonsEveryoneBrowser, so availability is live and the attendee's own hold is taken into account
GET /events/{slug}/salesEveryoneServer or browser
POST /events/{slug}/sales/{saleId}/verify-passwordOne attendeeBrowser
POST /events/{slug}/sales/{saleId}/waitlistOne attendeeBrowser
POST /events/{slug}/promo-codes/validateOne attendeeBrowser
POST /events/{slug}/reservationsOne attendeeBrowser, or your server with a device ID per attendee. Browser when selling add-ons on their own
DELETE /events/{slug}/reservationsOne attendeeSame as reservations
POST /events/{slug}/ordersOne attendeeSame as reservations
GET /events/{slug}/orders/{reference}One attendeeBrowser (your callback page) or server
POST /attendees/tickets/lookupOne attendeeServer only. It uses your private key. See Attendee tickets
POST /attendees/addons/lookupOne attendeeServer only. It uses your private key. See Attendee tickets
Webhook receiverYour businessServer only. It uses your private key

The private key never goes in the browser

The private key (jt_private_...) is for looking up attendee tickets and add-ons and verifying webhook signatures. Anyone who has it can read your attendees' QR codes, so keep it on your server. Every other endpoint rejects it with 403.

Calls that are the same for everyone

The host profile, events, galleries, sponsors, moments, tickets, add-ons and sales return the same data for every visitor, so they are safe to fetch on your server and render into the page. That gives you fast first loads and good search results. Host, event, gallery, sponsor and moment responses support ETags, so you can revalidate them cheaply.

Ticket and add-on availability (quantityLeft and status) changes as people buy. If you render them on the server, refresh them in the browser before the attendee picks a quantity, or keep any server cache to a few seconds.

Calls that act for one attendee

Reservations, orders, promo code checks, sale passwords and waitlist signups belong to one attendee. Reservations and orders are tied together by the X-Device-ID header: a UUID that identifies the attendee's cart. See Reservations for how it works.

From the browser this is simplest. Each attendee's browser has its own device ID, and the SDK creates and stores one for you.

Calling checkout endpoints from your server

Some sites wrap the API in their own backend, for example to add their own checks before a purchase. That works, with one rule:

Send a separate X-Device-ID for every attendee

When no X-Device-ID is sent, the API groups requests by the caller's IP address. From your server, every attendee has your server's IP, so they would all share one reservation and overwrite each other's carts. Always send a device ID per attendee.

A simple way to do this: create a UUID when an attendee starts checkout, keep it in their session, and send it on every reservation, order and release call for that attendee.

server.ts
import { createClient } from '@jetronticket/api'

const fluid = createClient({ apiKey: process.env.JETRON_PUBLIC_KEY! })

export async function reserve(session: Session, slug: string, items: CartItem[]) {
  const { data: reservation } = await fluid.createReservation(
    slug,
    { items },
    { deviceId: session.fluidDeviceId },
  )
  session.fluidDeviceId = reservation.reservationToken
  return reservation
}

On a server, the SDK creates a new device ID for each reservation you make without one, and returns it as reservationToken. It then requires you to pass that token to createOrder and releaseReservation, so attendees can never end up sharing a cart by accident.

Rate limits

Requests are rate limited per API key. Your browser traffic and your server traffic count towards the same allowance. When you go over it, the API returns 429 with a Retry-After header saying how many seconds to wait. Caching event reads (with ETags) is the easiest way to stay well under the limit.

One call has a second limit, per IP address: reservations with no tickets, when an add-on in them is free or limited to certain tickets. Those are limited to 30 a minute per IP. Make them from the browser: from your server, all your attendees would share one allowance. This 429 may not carry a Retry-After header; its message says how many seconds to wait.

On this page