Contract 4d1e0ad · updated 2026-11-11
Lissen Ticketing
Getting started

Getting started

What the engine is, how you authenticate, and the conventions that hold across every endpoint.

The Lissen ticketing engine is a multi-tenant API for ticketing and membership commerce. You configure what you are selling, the engine holds the capacity, prices the cart, takes the money on your own Stripe account, and records every fact that follows.

Read this page once. Everything in it is true of every endpoint, so the guides that follow never repeat it.

If you want the shape of the whole thing before the details, read How it fits together first: what stays in your systems, what lives here, and one sale end to end.

You are an organizer

An organizer is a tenant. Your events, items, quotas, discount codes, customers and orders all belong to exactly one organizer, and nothing crosses between two of them. You will be given an organizer id at onboarding:

org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7

Every id in the engine has this shape — a short prefix naming the kind, then a UUID. The same string appears in the API, in your logs, in an activity payload and in a support thread, so you can paste one straight from an email into a search box.

PrefixWhat it is
org_organizer (you)
evt_event — the door-and-clock record of an occasion
itm_item — a priced offer
quo_quota — a pool of capacity
fsc_fee schedule
dsc_discount code
cs_checkout session
hld_hold
cus_customer
ord_ / pos_order / position
act_activity

Test and live are two organizers, not two environments

There is one API, one hostname, one set of endpoints. What decides whether a purchase moves real money is the organizer: test is fixed on it at the moment it is created and can never change.

A sandbox is therefore a test organizer twin of your live one — its own events, its own quotas, its own Stripe account in test mode. You develop against the test organizer with a test key and go live by switching two values: the organizer id and the key.

curl https://tickets.lissen.com/api/v1/organizer \
  -H "Authorization: Bearer tk_test_..." \
  -H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7"
{
  "id": "org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7",
  "name": "Acme Events",
  "slug": "acme-events",
  "test": true,
  "status": "active",
  "psp_account_ref": "acct_1QxAcmeTestAccount"
}

GET/v1/organizer is the cheapest possible smoke test: if it answers, your key, your header and your mode all agree.

Your API key

Keys come from the dashboard: an owner of your organizer signs in and mints one, or Lissen mints one and hands it over. Either way you receive:

  • the secret, shown exactly once at the moment it is minted. We store only a hash of it, so a lost key is replaced, never recovered;
  • the organizer id(s) the key is granted on.

A key is a principal with grants, which is why the organizer header below is mandatory rather than inferred: the same key can legitimately be granted on more than one organizer, and a request that did not say which one it meant would be ambiguous the day a second grant is added.

Send it as a bearer token:

-H "Authorization: Bearer tk_test_..."

A key is a bearer credential: anyone holding it can sell, refund and read on your behalf. Keep it server-side. Never ship one to a browser or a mobile app — for the buyer's browser there is a separate, far weaker credential scoped to a single checkout session.

Several keys can be active at once, which is how you rotate without downtime: an owner mints the new key in the dashboard, you deploy it, then the owner revokes the old one there. Lissen can do the same on request.

The Ticketing-Organizer header

Every /v1 request must name its tenant.

-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7"

There is no default, including for a key granted on exactly one organizer. Omitting it is a 400 that names exactly what to send:

{
  "error": {
    "type": "invalid_request_error",
    "code": "missing_organizer",
    "message": "Ticketing-Organizer is required",
    "param": "Ticketing-Organizer",
    "request_id": "d2b7f0c4-9a51-4a2f-9c1e-6c4b0a7e12f3"
  }
}

If you have seen Stripe's Stripe-Account header, this is the same idea for the same reason.

Errors

Every non-2xx response has one shape:

{
  "error": {
    "type": "invalid_request_error",
    "code": "insufficient_capacity",
    "message": "Not enough capacity for the requested items",
    "param": "line_items",
    "request_id": "d2b7f0c4-9a51-4a2f-9c1e-6c4b0a7e12f3"
  }
}
  • type is one of five broad categories: invalid_request_error, authentication_error, idempotency_error, rate_limit_error, api_error. Branch on it when you only need to know "my fault, your fault, or retry".
  • code is the stable, documented value you branch on for real. Codes are added, never removed or repurposed — so switch on the ones you handle and let the rest fall through to a generic message.
  • param appears on validation failures and names the offending field.
  • request_id identifies this exact request in our logs. It also rides every response — success or failure — as the Request-Id header. Log it; it is the first thing we will ask for.

The code registry

CodeStatusTypeWhat it meansWhat to do
invalid_request400invalid_request_errorThe request body or query failed validation. `param` names the field.Fix the named field and send the request again.
missing_organizer400invalid_request_errorNo `Ticketing-Organizer` header was sent.Send `Ticketing-Organizer: org_…` on every `/v1` request. There is no default, not even for a key granted on exactly one organizer.
invalid_organizer400invalid_request_errorThe header was present but is not a well-formed organizer id. It is checked for shape before anything else happens, so this never means the organizer is missing or forbidden — those are `not_found` and `organizer_not_granted`.Check the id you copied from your onboarding email; it is `org_` followed by a UUID.
missing_authorization401authentication_errorNo `Authorization: Bearer …` header was sent.Send your API key as a bearer token.
invalid_api_key401authentication_errorThe bearer token is not a live API key. A checkout-session client secret presented to a keyed route also lands here — deliberately, so the two credential kinds can never be confused for one another.Check the key, and check you are not sending a buyer client secret to a partner-plane route.
organizer_not_granted403authentication_errorThe key is valid but holds no grant on the organizer named in the header.Use a key granted on that organizer, or ask Lissen to add the grant.
api_key_not_authorized403authentication_errorThe key is the wrong kind or scope for this plane — a door pass on a partner route, for example.Use a `kind: api`, `scope: full` key for the partner plane.
api_key_mode_mismatch403authentication_errorA test key was presented for a live organizer, or the reverse. Mode is a property of both the key and the organizer, and they must agree.Use the key that belongs to that organizer's mode.
missing_idempotency_key400invalid_request_errorThis operation requires `Idempotency-Key` and none was sent.Send a unique key (a UUID is ideal) on every durable creation — every POST that mints a resource, not only the ones that consume capacity or move money.
idempotency_key_reused409idempotency_errorThis key was already used with a different request body. Fingerprints cover method, path, sorted query pairs and the exact request bytes.Use a fresh key for a genuinely different request, or resend the original bytes to replay the original response.
idempotency_key_in_flight409idempotency_errorAn identical request under the same key is still executing. This is the only concurrency case that 409s.Wait and retry; the first attempt will finish or release the key.
buyer_plane_unavailable404invalid_request_errorA buyer-plane route was reached in a deployment where that route is disabled.Use the enabled buyer-plane deployment for this operation.
door_pass_unavailable404invalid_request_errorA door-pass route was reached in a deployment where that route is disabled.Use the enabled door-pass deployment for this operation.
invalid_pagination400invalid_request_error`starting_after` and `ending_before` were sent together, or a cursor is unusable.Send at most one cursor.
invalid_sale_window400invalid_request_errorAn item's `sale_starts_at` is not before its `sale_ends_at`.Order the window correctly, or clear one end of it.
invalid_event_window400invalid_request_errorAn event's `starts_at` is not before its `ends_at`.Fix the times. Both are RFC 3339 UTC.
invalid_reference400invalid_request_errorThe request referenced an id that does not exist under this organizer — an `event_id`, a `quota_id`, an `item_id`, a `plan_id` (when creating a membership benefit), or a customer named by `id` or `external_ref` in a transfer.Check the id, and check the `Ticketing-Organizer` header names the tenant that owns it.
code_already_exists400invalid_request_errorA discount code with this name already exists for the organizer. Uniqueness is case-insensitive: `SUMMER` and `summer` are the same code.Pick another code, or update the existing one.
capacity_locked409invalid_request_errorAnother request held the capacity lock for the quotas this one touches, or the lock on the same purchaser's allowance for an event with a per-customer cap, and the wait timed out. This is contention, not a refusal — nobody has taken the tickets.Retry with a short backoff. A contended purchase deliberately fails fast rather than parking a connection.
insufficient_capacity409 (waitlist) · 422 (checkout)invalid_request_errorThere is genuinely not enough room. The decision was recomputed inside the lock immediately before it was returned.Read availability, offer fewer units, or send the buyer to a waitlist. For a comp, `detail.shortfalls` names each short quota; set `capacity_override` only if the organizer means to issue past capacity.
invalid_footprint400invalid_request_errorThe requested items could not be resolved to any quota. An empty capacity footprint is refused rather than treated as unlimited.Check the item ids in the request.
quota_below_consumption400invalid_request_errorA quota resize would have put its size below what is already issued plus what live checkouts are holding.Read the quota's availability and resize to at least `issued + in_baskets`.
quota_unlimited_immutable400invalid_request_errorAn unlimited quota (`size: null`) cannot be given a finite size. Unlimited is terminal.Create a new finite quota and rebind the item to it, if the item has no live capacity yet.
item_quotas_locked400invalid_request_errorAn item's `quota_ids` cannot change once live capacity depends on the item.Mint a new item on the quotas you want and close the old item's sale window.
not_found404invalid_request_errorNo such object under this organizer. An object belonging to another tenant reads as absent, never as forbidden.Check the id and the organizer header.
internal_error500api_errorSomething failed on our side.Retry. If it persists, send us the `request_id` from the response — it identifies the exact request in our logs.
currency_mismatch400invalid_request_errorA cart, a discount code or a fee schedule mixed currencies. Carts are single-currency and the engine performs no FX.Keep every line, code and schedule in one currency.
item_not_sellable422invalid_request_errorThe item exists but cannot be sold right now — inactive, outside its sale window, gated with no applied unlock, or approval-gated outside an approved invitation. A comp ignores the sale window, gating and approval and is refused only for an inactive item or an item with no event.Quote the cart first: the line's `blocked_reason` tells you which of those it is.
fee_schedule_not_found422invalid_request_errorNo active fee schedule matches this position's currency. Pricing fails loud rather than assuming a zero fee.Lissen sets fee schedules; partners cannot create one. Contact Lissen to set a schedule for the organizer in that currency, then quote again to confirm before selling.
fee_schedule_ambiguous422invalid_request_errorMore than one active schedule matched at the same scope.Contact Lissen: only Lissen can deactivate the extra schedule. Quote again afterwards to confirm the sale prices.
connect_account_not_onboardable422invalid_request_errorHosted onboarding cannot be started for this organizer in its current state.Talk to us — this usually means the account is already attached.
connect_account_already_linked422invalid_request_errorThat Stripe account is already attached to another organizer.One account belongs to exactly one organizer. Use a different account.
connect_state_invalid400invalid_request_errorThe OAuth `state` did not verify. It is bound to the organizer, its mode, the redirect URI, the initiating key and the linkage as it stood when the URL was minted, so any attach anywhere invalidates every outstanding state.Start the authorization again to mint a fresh URL.
connect_oauth_failed400invalid_request_errorStripe refused the authorization code exchange.Start the authorization again.
connect_oauth_not_available422invalid_request_errorOAuth attach is switched off for test organizers in this engine, so a sandbox tenant is given an account created inside our own sandbox instead.Use hosted onboarding for a test organizer while OAuth attach is off.
connect_oauth_state_consumed409invalid_request_errorThat authorization has already been completed. A state is spent exactly once — including when the second attempt names the account the first one linked.Nothing: the account is attached. Read `/v1/organizer` to confirm.
connect_provider_unavailable503api_errorStripe was unreachable or rate-limited us.Retry with backoff.
staff_identity_invalid401authentication_errorThe request carried a staff sign-in assertion instead of an API key, and it did not verify. Partner integrations never send one.Authenticate with your API key (`Authorization: Bearer tk_…`). If you are Lissen staff, sign in again through the staff admin.
staff_identity_not_permitted403authentication_errorThis operation does not accept a staff or dashboard sign-in. Today that is check-in scanning, which runs under the organizer's API key or a door pass, and the operations where you attest a customer's identity — an ordinary ticket transfer and a position claim — which run under the organizer's API key. Connect onboarding, OAuth attach and holder corrections do accept an organizer owner or Lissen staff.Run it with the organizer's API key (or a door pass, for scanning). To move a ticket without the holder's authority, make a holder correction with a reason (`POST /v1/positions/{id}/holder_correction`) from your own system; the dashboard does not offer one yet.
fee_exceeds_charge422invalid_request_errorAn absorbed fee would have swallowed the whole post-discount charge. The invariant is checked against what is actually charged, so a discount that halves a line can trip a flat fee that was fine at list price.Lissen owns the schedule, so contact Lissen to adjust its flat component or mode. Until then, quote the cart without the discount or at a higher price and confirm the quote succeeds.
checkout_session_not_open409invalid_request_errorThe session is no longer open — completed, expired, refused, or its hold is no longer live.Read the session to see which. An expired session cannot be revived; create a new one.
checkout_session_locked409invalid_request_errorPayment has started on this session, so the cart and its quote are contractual and can no longer be changed.Do not retry the update. Poll the session until it reaches a terminal state.
checkout_session_conflict409invalid_request_errorTwo updates of the same session raced, or the session moved while its payment was being prepared. Loud and retryable, rather than a silent partial adjustment.Re-read the session, decide the cart you want from what you now see, and send the update again.
code_not_reservable422invalid_request_errorA presented discount code could not be reserved even after the cart was re-priced against what the reservation saw — its last use went to someone else.Re-quote the cart; the code will come back under `rejected_codes` with a reason you can show the buyer.
payment_intent_unavailable422invalid_request_errorThe session has no usable payment intent yet. Creation commits the cart, hold and reservations first and creates the intent immediately afterwards, so a create response can legitimately carry empty `psp_refs`.Retry the payment-credentials endpoint; that is the call that prepares the intent. Retrieving the session does not prepare or recover payment.
invalid_client_secret401authentication_errorThe bearer is missing, malformed, wrong, or is used outside a closed session’s permitted operations/window. Outcome retrieval (including /finalize, which then only reads) and an already-completed zero-total /complete retry remain available until one hour after session expiry. Every authentication failure is this one answer with no distinguishing detail, so the endpoint cannot be used to probe which sessions exist. A VALID secret used with another session's id is different: that is a non-enumerating 404, identical to the answer for a session that never existed.The buyer's session is over. Send them back to start a new checkout. If you are getting a 404 instead, check that the id in the path is the session the secret was issued for.
identity_not_assigned403authentication_errorYou signed in successfully, but this email is not assigned to any organizer and is not Lissen staff.Ask the person who invited you (or Lissen) to add your email to the organizer's team (as an owner or event editor), then sign in again.
buyer_identity_required422invalid_request_errorThe session names no buyer email, so there is nobody to send the order to. Payment credentials are withheld until the session's `customer.email` is set — on the partner plane at create or update, or on the buyer plane's update. A comp is refused the same way when its recipient resolves to a customer with no email.Set `customer.email` (and `customer.name` if you have it) on the session, then request the credentials again. For a comp named by `recipient.external_ref`, send `recipient.email` with it; a recipient named by `recipient.id` alone cannot carry an email, so name them by `recipient.email` instead.
invalid_webhook_url400invalid_request_errorThe webhook URL is not a valid HTTPS URL.Use a publicly reachable HTTPS endpoint.
invalid_webhook_enabled_type400invalid_request_errorAn enabled activity type is not a supported exact type or wildcard.Use an activity type, a resource wildcard such as `order.*`, or `*`.
webhook_endpoint_not_found404invalid_request_errorNo webhook endpoint with that id belongs to this organizer.Check the endpoint id and organizer header.
webhook_endpoint_rotation_failed500api_errorThe signing secret could not be stored securely.Retry shortly. If this continues, contact support.
membership_already_exists409invalid_request_errorThis customer already has an `active` or `past_due` membership on the selected plan. An unpaid `incomplete` join is resumed with fresh payment credentials instead, and an expired attempt is replaced, so neither answers this error. It is also returned while the membership still reads `incomplete` if Stripe has already activated its subscription and the webhook has not arrived yet, and for an `incomplete` membership whose subscription Stripe holds as `unpaid` or `paused`.Read the existing membership. If it still reads `incomplete` because Stripe has just activated it, wait for its status to update (or for `membership.activated`) rather than cancelling it. If its subscription is `unpaid` or `paused` at Stripe, it will not activate by itself: cancel it first. To join again, cancel it or wait for it to reach `canceled`.
membership_already_canceled409invalid_request_errorThis membership has already reached its canceled state.Nothing to cancel. Joining again, free or paid, creates a new membership after the canceled record.
membership_state_conflict409invalid_request_errorThe membership's current status does not allow this operation, so nothing changed. `detail.operation` names the operation and `detail.status` the status that blocked it. Pause needs an `active` membership with no cancellation scheduled; resume needs a `paused` one; undoing a cancellation needs an `active` or `past_due` membership with a cancellation scheduled and a subscription the provider has not ended; a `paused` membership cannot be canceled; setting the next charge needs an `active` membership with no cancellation scheduled, or a `past_due` one with `at: now` (a date cannot be set while a payment is overdue). An ended membership is never revived.Read the membership and act on its current `status`. Resume a paused membership before canceling it or setting its next charge, undo a scheduled cancellation before pausing or setting the next charge, pay a `past_due` membership's overdue invoice with `at: now` before moving its date, and join again (a new membership) after a membership has ended.
membership_no_billing422invalid_request_errorA free membership has no paid period, so it has nothing to pause, resume, charge or reverse a cancellation on. Nothing changed. Canceling a free membership ends it immediately.Do not offer pause, resume, next charge or undo-cancellation for a membership whose plan has `price_minor` 0.
membership_pause_unsupported422invalid_request_errorThe payment provider cannot natively pause this subscription: it was not created with flexible billing, it does not collect automatically, it is driven by a schedule, or it is not active at the provider. The engine never migrates an existing subscription to make it eligible. Nothing changed. `detail.provider_code` carries the provider's own code when it refused the pause.Do not retry. Keep the membership active, or cancel it at period end. Contact Lissen support if a subscription you expect to be pausable is refused.
membership_resume_payment_failed422invalid_request_errorThe provider refused the restart payment, for example because the customer has no usable saved payment method. The membership stays `paused`, no benefits return and no `membership.resumed` is recorded.Have the customer add or fix their payment method (a paused membership can open the [hosted payment-method update](/guides/memberships/reference#update-the-payment-method)), then call resume again with a new `Idempotency-Key`.
door_pass_expired401authentication_errorThe door pass has passed its expiry time.Use a newly minted pass for this event.
door_pass_organizer_mismatch403authentication_errorThe door pass is not granted to the organizer named by the request.Use a pass granted to that organizer.
already_checked_in409invalid_request_errorThis admission already has an active check-in. A transfer of an admitted position is refused with the same code: ordinary transfers stop at check-in.At the door, ask the organizer to confirm the duplicate. For a transfer, an organizer can still correct the holder with a holder correction.
position_revoked422invalid_request_errorThe admission has been revoked. A transfer or holder correction of a revoked position is refused with the same code; changing its holder cannot revive it.Do not admit the holder; ask the organizer about a replacement.
code_not_found422invalid_request_errorThe admission code is not known to this organizer.Rescan the ticket or use the manual fallback.
wrong_event403invalid_request_errorThe admission belongs to an event outside this door pass's event set.Send the holder to the correct event entrance.
checkin_not_admitted409invalid_request_errorOnly an admitted check-in can be voided.Read the check-in and void the admitted record, if one exists.
checkin_not_found404invalid_request_errorNo check-in with that id belongs to this organizer.Refresh the check-in list and use the current id.
invalid_door_pass_expiry422invalid_request_errorThe door-pass expiry is not in the future.Choose a future expiry, or omit it to use the event default.
waitlist_closed409invalid_request_errorThe item's derived availability is not sold out, so its waitlist is closed.Offer the item for sale, or retry after the remaining availability is gone.
waitlist_entry_exists409invalid_request_errorThis email already has a waiting or invited entry for this item.Use the existing entry, or wait for it to lapse before joining again.
waitlist_entry_not_waiting409invalid_request_errorThe entry is no longer waiting and cannot be promoted, rejected or removed.Retrieve the entry and follow its current status instead.
invitation_window_closed409invalid_request_errorThere is no positive invitation window before the event cutoff.Do not send an invitation for this event; leave the capacity public.
invitation_session_immutable409invalid_request_errorAn invitation checkout cannot change its item or quantity.Keep the invited item and quantity; update only the buyer's contact details.
order_not_refundable409invalid_request_errorThe order is not in a state where the selected refund can start.Read the order, then retry only while it is paid or refund_pending.
position_not_refundable409invalid_request_errorAt least one selected position is already revoked, belongs to another order, or has a money-only refund that is still processing.Select live positions from the order that have not already been refunded; after a money-only refund, wait until it completes or fails before refunding and revoking the ticket.
refund_positions_mismatch400invalid_request_errorA selected position is not part of the order or refund being handled.Choose positions from the named order, or assign only the positions covered by the external refund.
identity_token_rejected401invalid_request_errorThe Lissen identity action token was not accepted. The reason is in the message: it was malformed or expired, addressed to another service, minted for another action, bound to a different checkout session, carried an unverified address, or had already been spent. Nothing on the session changed.Ask the identity component for a fresh token for THIS session and try again. A token is single-use and lives five minutes.
reverify_required403invalid_request_errorThe attestation behind this session is older than ninety days, which is the horizon after which a saved card must not pay unattended.Have the buyer verify their address with Lissen again, attest the session with the fresh token, and repeat the payment.
payment_method_not_owned403invalid_request_errorThe named payment method is not this buyer's. The same answer is given whether it belongs to somebody else or to nobody the engine knows.Use a card from the buyer's own saved list, or enter a new one through the wallet setup call.
live_payments_not_configured503api_errorLive payment credentials are unavailable; checkout fails before reserving capacity or contacting the payment provider.Contact the platform operator to complete live payment setup, then retry.
refund_payment_mode_mismatch409invalid_request_errorThe payment belongs to a different test or live mode. No positions were revoked.Refund the payment through its original environment; a live payment cannot be refunded from a test environment.
payment_required422invalid_request_errorThe binding checkout quote is non-zero and cannot complete without payment.Use the payment flow, or update the cart and its quote before trying zero-total completion again.
payment_declined422invalid_request_errorThe engine charged the card and the card refused it: on a pay call that asked for engine confirmation, or on a membership join that named a saved card. `message` is the card's reason, written for the buyer; `detail.decline_code` is the card network's code when there is one. Nothing started: a checkout session is still open, and a join created nothing.Show the message where the buyer pays and let them choose another card or enter a new one. Do not retry the same card unchanged.
quantity_limit_exceeded422invalid_request_errorThe line asks for more units than the item's max_per_order allows.Lower the quantity to the item's limit, which is in the error detail.
waitlist_item_not_open409invalid_request_errorThe approval-gated item is switched off or outside its sale window, so it is not taking requests.Show the item as closed, or retry inside its sale window.
not_position_holder403invalid_request_errorThe acting customer in a transfer does not hold the position now. Having bought it, having held it before, or having a copy of its QR code does not count. Nothing changed.Read the position's `holder_customer_id` and let that customer transfer it. To fix a mistaken holder, the organizer uses a holder correction instead.
holder_unchanged422invalid_request_errorThe destination already holds this position, so there is nothing to change.Check the destination; no request is needed if it is already the holder.
item_not_in_event400invalid_request_errorA membership benefit assignment named an item that is not one of this event's items: it belongs to another event or to no event. Nothing changed.Select only items whose `event_id` is this event, or assign the benefit to the item's own event.
invalid_order_limits400invalid_request_errorAn event's `min_tickets_per_order` is greater than its `max_tickets_per_order` or `max_tickets_per_customer`, so no checkout could satisfy both. `param` names the field to change.Lower the minimum, raise the maximum, or clear one of them with `null`. The check uses the event's stored values for any field the request leaves out.
order_quantity_below_minimum422invalid_request_errorThe checkout has fewer of one event's tickets than the event's `min_tickets_per_order`, counted across all of that event's items in the checkout. `detail.event_id` names the event, `detail.limit` the minimum and `detail.quantity` this checkout's count. Nothing changed; a refused update leaves the existing cart as it was.Add tickets for that event until the checkout reaches `detail.limit`. The event's `min_tickets_per_order` is on the Event and on the buyer plane's `line_items[].event`, so a checkout can bound its quantity controls first.
order_quantity_above_maximum422invalid_request_errorThe checkout has more of one event's tickets than the event's `max_tickets_per_order`, counted across all of that event's items in the checkout. `detail.event_id` names the event, `detail.limit` the maximum and `detail.quantity` this checkout's count. Nothing changed; a refused update leaves the existing cart as it was.Reduce the event's tickets to at most `detail.limit` in this checkout. Splitting them across checkouts does not help when the event also caps tickets per customer.
customer_ticket_limit_exceeded422invalid_request_errorThe purchaser (the checkout's customer, who becomes the order customer) would hold more of one event's tickets than its `max_tickets_per_customer`. Their live tickets from earlier orders and the tickets in their other open checkouts count; tickets they transferred away still count. `detail.remaining` is how many more they may buy. At buyer completion nothing is issued; in paid settlement the payment is refunded in full and the session closes as `payment_refused`.Offer at most `detail.remaining` tickets for that event, or none when it is zero. Allowance comes back only when the purchaser's other open checkouts expire or are released, or when their tickets are revoked. Completing another checkout does not: its held tickets become purchased tickets, which keep counting. A transfer or a money-only refund does not give allowance back either.
refund_amount_exceeds_refundable409invalid_request_errorA `money_only` refund asked for more than the order or the named positions can still return, or a membership payment refund asked for more than the charge can still return. Completed and processing refunds already count against that balance (an order also counts failed-but-not-retried refunds). Nothing was refunded.Read the order's or the membership charge's `amount_refundable_minor`, then request that amount or less, or name more positions.
membership_charge_not_refundable409invalid_request_errorThe membership charge carries no payment reference the engine can refund. This happens for a charge recorded before membership refunds were supported, or one that was not paid by card. Nothing was refunded.Refund it in the Stripe Dashboard if it must be returned: the engine reconciles the refund into the membership's payment history.
customer_email_conflict409invalid_request_errorAnother customer of this organizer already has the email you sent. Nothing changed: the engine never merges two customers or moves their orders, memberships or tickets.Keep the customer's current email, or resolve the duplicate on your side first. Two customers with one address are two records until you decide otherwise.
membership_prerequisite_not_met422invalid_request_errorThe plan being joined requires another plan (`required_plan_id` on the plan), and this customer does not hold an `active` membership of it. Only `active` counts: an `incomplete`, `past_due` or `canceled` membership of the required plan does not, nor does having none, nor does a customer who does not exist yet. Nothing was created: no Stripe subscription or customer, no membership, no customer record. Paid and free plans are refused alike. `detail.required_plan_id` and `detail.required_plan_name` name the plan to hold.Do not offer the join until the customer holds an active membership of `detail.required_plan_id` (list `GET /v1/memberships?customer_id=…&plan_id=…&status=active` to check ahead). Earning that membership only makes them eligible: they still have to choose to join, and nothing is charged or enrolled automatically.
membership_not_billable422invalid_request_errorThe membership has no Stripe-billed subscription whose payment method could be updated: it belongs to a free plan, or it is still `incomplete` and awaiting its first payment. No session was created and nothing changed.A free membership has no payment method; do not offer the update. For an `incomplete` membership, finish the join with the payment credentials it returned (or re-join to resume it), then offer the update once the membership is `active`.
payment_method_update_unavailable422invalid_request_errorThe organizer's connected Stripe account cannot host the hosted payment-method update: Stripe refused to open the customer portal for it (the portal is unavailable to the account, or the member's Stripe customer no longer exists there). Nothing changed and no session was created.Check the organizer's Stripe account can use the customer portal in this mode, then retry. Offer the member another way to reach the organizer meanwhile; retrying the same request unchanged will fail the same way until the account is fixed.
credit_unchanged422invalid_request_errorThe customer is already credited with this admission, so there is nothing to correct.Check the check-in's `credited_customer_id`; no request is needed if it is already the right customer.
membership_group_conflict409invalid_request_errorThe plan being joined is in an exclusive group (`exclusive_group` on the plan) and this customer already holds an ongoing membership of another plan in the same group. Ongoing means any membership that is not `canceled`: `incomplete` (first payment pending), `active` (also when set to cancel at period end, until it actually ends), `past_due` and `paused` all count. Nothing was created: no Stripe subscription or charge, no membership, no customer record, and the existing membership was not changed. `detail.membership_id`, `detail.plan_id`, `detail.plan_name`, `detail.status` and `detail.group` name the membership in the way. Joining the same plan twice is still `membership_already_exists`.Do not offer the alternative while the customer holds the existing membership; tell them which plan they are on (`detail.plan_name`). The engine never switches plans for you: to move them, end the existing membership through the normal cancel flow and let them join the other plan once it is `canceled` (a membership set to cancel at period end still blocks until it ends). Retrying the same request unchanged keeps failing the same way.
membership_enrollment_closed409invalid_request_errorThe plan's owner has closed it to new signups (`enrollment_open` is false). Nothing was created: no Stripe subscription or customer, no membership, no customer record. Paid and free plans are refused alike. Existing members are unaffected: their price, renewals and benefits continue. This is not `active`: a plan can be closed to new members while staying active for the ones it has. `detail.plan_id` names the plan.Do not offer the join: read `enrollment.status` on the plan (`GET /v1/membership_plans/{id}`) and show the offer as closed. An owner reopens it with `enrollment_open: true`. An unfinished join (first payment still pending) that was started before the plan closed can still be resumed.
membership_enrollment_full409invalid_request_errorThe plan has a `member_cap` and every place is taken, or held by another join whose first payment is still pending. Nothing was created: no Stripe subscription or customer, no membership, no customer record. A taken place is never given back when a member leaves, so a filled founding cohort stays full until an owner raises or clears the cap. `detail.plan_id`, `detail.member_cap` and `detail.places_left` (0) describe it.Show the offer as full (`enrollment.status` is `full` on the plan). A place held by an unpaid join frees itself if that payment is abandoned, so the plan can open again within a day; poll the plan rather than retrying the join blindly. An owner who wants more members raises `member_cap` or sets it to null.
membership_plan_earned_only422invalid_request_errorThe plan has an attendance rule, so it is earned by attending events and cannot be joined. Nothing was created. `detail.plan_id` names the plan.Do not offer a join. Show the customer's progress with `GET /v1/membership_plans/{id}/qualification`; the engine grants the membership when they qualify.
attendance_rule_not_configured422invalid_request_errorThe plan has no attendance rule, so there is no qualification to read and no event can be selected for it.Set `attendance_rule` on the free plan first (`POST /v1/membership_plans/{id}`), or use the plan the rule is configured on.
attendance_scope_not_selected422invalid_request_errorThe plan's attendance rule counts every event (`scope` `all_events`), so selecting events for it has no effect. Nothing changed.Change the rule's `scope` to `selected_events` before choosing which events count, or leave the events alone: every event already counts.
checkout_offer_not_applicable422invalid_request_errorThe `offer` on a checkout creation does not fit the cart: it covers none of the checkout's items, it is an `amount` or `price_override` offer priced in a different currency, or the organizer has switched discount pricing off so the engine could not apply it. Nothing was created: no session, no hold. An offer that applies but is outbid by a better membership price is not this error; it is created, and reported in `superseded_effect_ids`.Create the checkout without an `offer` to sell at the catalog and membership price, or correct the offer's scope or currency and retry with a new Idempotency-Key.
member_role_not_permitted403authentication_errorYou are signed in to the dashboard as an event editor, and this operation is not part of that role. Editors create and edit events and ticket types, manage their capacity and see attendees, for the events an owner gave them; everything else (orders, customers, refunds, payments, keys, webhooks, team) is for organizer owners.Ask an organizer owner to do it, or to change your role. Integrations are unaffected: an organizer API key keeps its own authority.
entitlement_provider_not_found404invalid_request_errorNo external entitlement provider with that id belongs to this organizer. In-engine providers (discount codes, memberships) are not addressable here.List `GET /v1/entitlement_providers` for the ids you have registered, and check the organizer header.
entitlement_provider_conflict409invalid_request_errorAn active external provider is already registered for that `quote_url`, so a second one would be called for the same carts. Nothing changed.Update the existing provider, or switch it off first (`PATCH` with `status` `disabled`) before registering or enabling another for the same URL.
invalid_entitlement_provider400invalid_request_errorA provider callback is not an absolute https URL. `param` names the field, `quote_url` or `commit_url`. Nothing was registered.Give the provider a publicly reachable https URL for each callback.
invitation_allowance_exceeded422invalid_request_errorA comp that names an `allocation_id` would pass the allocation's limit, or the limit of the shared pool it joined; or a guest invitation (`POST /v1/guest_invitations`) would pass the inviting member's guest allowance. Nothing was issued and nothing was consumed. `detail.shortfalls` names each short budget (`budget` is `pool`, `allocation` or `member_guest`) with its limit, what was used and what remains.Issue fewer tickets, or raise the allocation's or pool's limit with `PATCH /v1/invitation_allocations/{id}` or `PATCH /v1/invitation_pools/{id}`. For a member's allowance, show the member what is left (`remaining_units`); a benefit's units can be raised with `PATCH /v1/membership_benefits/{id}`, and a per-period allowance starts afresh when `bucket.ends_at` passes. Setting `capacity_override` does not help: it skips only event capacity. Retry with a new Idempotency-Key once there is room.
membership_not_eligible422invalid_request_errorThe membership named by a guest invitation gives no member benefits now: it is paused, canceled, still incomplete or past due beyond its benefit grace, or its plan is inactive. The rule is the one every member benefit follows. `detail.status` is the membership's status. Nothing was issued.Do not offer the invitation until the membership is active again (resume it, or wait for the failed payment to be settled), then retry with a new Idempotency-Key.
guest_benefit_not_applicable422invalid_request_errorThe benefit named by a guest invitation is not a `guest_invitation` benefit of the member's plan, or no assignment covers the item: the benefit is not assigned to the item's event, or is assigned to other ticket types of it only. Nothing was issued.Send the plan's own guest invitation benefit and an item its assignment covers. List `GET /v1/events/{id}/membership_benefits` to see what an event offers, and assign the benefit with `PUT /v1/events/{id}/membership_benefits/{benefit_id}`.
cancellation_policy_not_configured404invalid_request_errorThe event has no cancellation policy: its organizer has not configured what cancelling it does (stop new sales, close pending checkouts, refund paid tickets, disable admission, notify attendees). There is no default, so nothing happens and an event with no policy cannot be cancelled.Save the policy with `PUT /v1/events/{id}/cancellation_policy`, deciding all five consequences explicitly, then retry.
organizer_admin_required403authentication_errorThe operation changes money- or admission-affecting policy, or cancels an event, and needs the organizer's administrator authority. The credential is valid but does not carry it. Nothing changed.Use the organizer's own API key or an owner's sign-in. A credential that may only edit events cannot configure the cancellation policy or cancel an event.
admission_disabled422invalid_request_errorThe event was cancelled under a policy that disables admission, so no ticket to it is accepted at the door. The scan is recorded as rejected; the ticket itself is not revoked and no money moved. A delayed (offline) scan taken before the cancellation is still honoured when it syncs.Do not admit the holder. Door staff can tell them the event was cancelled; the organizer decides about refunds.
cancellation_policy_required422invalid_request_errorThe event has no cancellation policy, so cancelling it was refused and nothing changed. There is no default: an organizer decides what cancelling does before it can happen.Save the policy with `PUT /v1/events/{id}/cancellation_policy`, then cancel again.
event_already_cancelled409invalid_request_errorThe event was already cancelled. A cancellation is recorded once and is not reversed by this API; its `detail.cancellation_id` names the one that exists. Nothing changed.Read it with `GET /v1/events/{id}/cancellation` to see its policy snapshot and progress. Do not retry the cancel.
cancellation_not_retryable409invalid_request_errorThe cancellation has no failed action to retry: it is still in progress, or it already completed. Nothing changed.Read `GET /v1/events/{id}/cancellation`. While it is `in_progress` the background executor keeps working; retry only when its status is `needs_attention`.
tax_location_required400invalid_request_errorThe organizer charges tax on memberships, and the paid join said nowhere the buyer is. Nothing was created in Stripe.Send the buyer's `customer.address.country` (a two-letter code), or the `customer.ip_address` they joined from, and join again.
tax_location_invalid400invalid_request_errorStripe Tax could not place the buyer from the address or IP address the join gave. No subscription was created.Ask the buyer for their country (and postal code where their country has one) and join again with `customer.address`.
membership_plan_not_tax_inclusive422invalid_request_errorThe organizer charges tax on memberships, and the plan was created before that: its Stripe price does not include tax, so Stripe Tax would charge more than the plan's price. Nothing was created in Stripe.Create a new plan with the same price (it includes tax) and offer that one instead. Changing the plan's price does not help: the new price keeps the tax treatment of the plan's current one.
first_charge_at_free_plan400invalid_request_errorThe join gave `first_charge_at` for a free plan, which charges nothing. Nothing was created.Join the free plan without `first_charge_at`: it is active at once.
first_charge_at_out_of_range400invalid_request_errorThe paid join's `first_charge_at` is not in the future, or is more than 730 days away, the furthest Stripe allows. Nothing was created in Stripe.Send a date between now and 730 days from now and join again. To charge at once, leave `first_charge_at` out.
next_charge_at_out_of_range400invalid_request_errorThe next charge was moved to a date that is not in the future, or is more than 730 days away, the furthest Stripe allows. Nothing changed.Send a date between now and 730 days from now with a new `Idempotency-Key`, or `"at": "now"` to charge at once.
saved_payment_method_free_plan400invalid_request_errorThe join named `saved_payment_method` for a free plan, which charges nothing. Nothing was created.Join the free plan without `saved_payment_method`: it is active at once.
stripe_customer_not_found400invalid_request_errorThe `saved_payment_method.stripe_customer_id` the join named does not exist on the organizer's connected Stripe account, or was deleted there. Nothing was created.Check the Customer id on the organizer's own Stripe account, or join without `saved_payment_method` so the member enters a card.
payment_method_not_attached400invalid_request_errorThe `saved_payment_method.stripe_payment_method_id` the join named does not exist, or is not attached to the Stripe customer it named. The engine never attaches a card itself. Nothing was created.Name a payment method already attached to that Customer, or join without `saved_payment_method` so the member enters a card.
stripe_customer_linked409invalid_request_errorThe Stripe customer the join named already belongs to another customer: through that customer's membership, their Pay with Lissen wallet, or the engine's own tags on it. `detail.customer_id` names them; a Customer tagged for another organizer is refused without naming anyone. Emails are never compared. Nothing was created.Join the customer `detail.customer_id` names instead, if it is the same person, or leave `saved_payment_method` out so the member enters a card.
membership_plan_free422invalid_request_errorThe plan is free (`price_minor` 0): it has no price to change and no billing to move, so nothing changed. A free plan cannot become paid either.Create a paid plan for the paid offer. Only a paid plan's price can be changed, and it stays above 0.
provisioner_required403authentication_errorCreating organizers and setting where an organizer's payments are charged are Lissen's operations: they need an API key Lissen has made a provisioner (setting collection also accepts Lissen staff). Nothing changed.Ask Lissen. An organizer's own key cannot do this, by design: collecting on Lissen's platform account makes Lissen the merchant.
slug_already_exists409invalid_request_errorAnother organizer already has that slug. A slug your key already created answers 200 with that organizer instead.Choose another slug.
saved_payment_method_unavailable422invalid_request_errorThe join named `saved_payment_method`, and Lissen collects the organizer's memberships on its own Stripe account, which cannot charge a card saved on the organizer's connected account. Nothing was created.Join without `saved_payment_method`: the member enters a card through `payment` (or `setup`), confirmed with Stripe.js started without a connected account.
notification_claim_not_held409invalid_request_errorThe `claim_id` you settled is not a claim your own sender holds on that activity's message: it was already settled or given back, it was recorded `ambiguous` after the claim window, or it is the engine's. Nothing changed.Read `GET /v1/activities/{id}/notifications` for where the message stands, and never send it again on that claim. A retried settlement whose first answer was lost lands here too: the state shows what it recorded.
invitation_usage_fully_returned409invalid_request_errorEvery unit of the invitation usage (`POST /v1/invitation_usages/{id}/returns`) has already been given back, so there is nothing left to return. Nothing changed. `detail` has the usage's `units` and `returned_units`.Nothing to do: the budgets already have those units back. A retried return whose first answer was lost lands here when you retry it with a new Idempotency-Key; retry with the same key to read the first answer.
invitation_return_exceeds_remaining409invalid_request_errorA return asked for more `units` than the invitation usage has left to give back: what it took less what was already returned. Nothing was returned. `detail.remaining_units` is what is left.Ask for `detail.remaining_units` or fewer, or omit `units` to give back everything that is left.

Idempotency

Network calls fail after the server has already acted. Idempotency-Key is how you retry without creating the same thing twice.

curl -X POST https://tickets.lissen.com/api/v1/events \
  -H "Authorization: Bearer tk_test_..." \
  -H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
  -H "Idempotency-Key: 7c1f0a3e-4d29-4f81-9b6b-1e2a5c8d0f44" \
  -H "Content-Type: application/json" \
  -d '{
        "name": "Acme Winter Social",
        "starts_at": "2026-11-14T19:30:00Z",
        "ends_at": "2026-11-14T23:00:00Z",
        "timezone": "Europe/London",
        "venue_name": "The Old Foundry"
      }'

Required on every create that the API marks as requiring it, not only the ones that move money. Not every POST takes a key: door passes, check-ins, quotes, the Connect URLs and notification claims do not. Where a key is required, omitting it is a 400 missing_idempotency_key before anything happens. The API reference shows the header on each operation; the list is:

OperationIdempotency-Key
POST /v1/events, POST /v1/items, POST /v1/quotas, POST /v1/discount_codesrequired
POST /v1/checkout_sessions, POST /v1/comps, POST /v1/guest_invitationsrequired
POST /v1/membership_plans, POST /v1/memberships, POST /v1/membership_benefitsrequired
POST /v1/memberships/{id}/pause, POST /v1/memberships/{id}/resume, POST /v1/memberships/{id}/undo_cancellation, POST /v1/memberships/{id}/next_charge, POST /v1/membership_plans/{id}/pricerequired
POST /v1/positions/{id}/transfer, POST /v1/positions/{id}/holder_correction, POST /v1/position_claimsrequired
POST /v1/checkins/{id}/credit_correctionrequired
POST /v1/waitlist_entries, POST /v1/waitlist_entries/{id}/promoterequired
POST /v1/refundsrequired
POST /v1/invitation_pools, POST /v1/invitation_allocations, POST /v1/invitation_usages/{id}/returnsrequired
POST /v1/webhook_endpoints, POST /v1/entitlement_providersrequired
PATCH /v1/events/{id}, PATCH /v1/items/{id}, PATCH /v1/quotas/{id}, PATCH /v1/discount_codes/{id}optional, still worth sending
PATCH /v1/branding, PATCH /v1/notification_provider, PATCH /v1/customers/{id}optional
PATCH /v1/checkout_sessions/{id}, POST /v1/checkout_sessions/{id}/expireoptional
POST /v1/membership_plans/{id}, POST /v1/memberships/{id}/cancel, PATCH /v1/membership_benefits/{id}optional
POST /v1/events/{id}/cancel, POST /v1/events/{id}/cancellation/retry, PUT /v1/events/{id}/cancellation_policy, PUT /v1/events/{id}/membership_benefits/{benefit_id}, DELETE /v1/events/{id}/membership_benefits/{benefit_id}, PUT /v1/events/{id}/qualifying_plans/{plan_id}, DELETE /v1/events/{id}/qualifying_plans/{plan_id}optional
PATCH /v1/invitation_pools/{id}, PATCH /v1/invitation_allocations/{id}optional
POST /v1/waitlist_entries/{id}/reject, POST /v1/waitlist_entries/{id}/removeoptional
PATCH /v1/webhook_endpoints/{id}, DELETE /v1/webhook_endpoints/{id}, POST /v1/webhook_endpoints/{id}/rotate, PATCH /v1/entitlement_providers/{id}optional
POST /v1/quotesnot accepted: a quote mints nothing, so there is nothing to make idempotent
POST /v1/door_passesoptional
POST /v1/door_passes/{id}/revoke, POST /v1/checkins, POST /v1/checkins/sync, POST /v1/checkins/{id}/voidnot accepted
PATCH /v1/organizer, POST /v1/memberships/{id}/payment_method_update_sessionsnot accepted
POST /v1/organizers, PATCH /v1/organizer/collectionnot accepted: a retried create with the same slug returns the organizer it made, and the collection write sets the values you name
POST /v1/connect/onboarding, POST /v1/connect/oauth/authorizationnot accepted: both return a single-use URL, so replaying a stored response would hand you a dead link
POST /v1/activities/{id}/notifications/claim, POST /v1/activities/{id}/notifications/settlenot accepted: a replayed claim could hand you a claim since given back; the claim itself is what keeps a send single (sending a message yourself)
Every buyer-plane operationnot accepted: the buyer's own credential drives its one session

Where an operation does not declare the header, the engine does not read it.

Send a fresh UUID per logical operation, and reuse it for every retry of that operation.

What happens on a repeat

SituationAnswer
Same key, same body, first request succeededThe original response, verbatim, with Idempotent-Replayed: true.
Same key, same body, first request failed with a 400, 401, 403, 404 or 422 raised while doing the workThat same failure, verbatim. A request that was semantically wrong stays wrong.
Same key, same body, first request failed transiently (429, 500, 503)The work runs again. A transient failure is exactly what a retry is for.
Same key, different body409 idempotency_key_reused.
Same key, same body, first request still running409 idempotency_key_in_flight. This is the only concurrency case that 409s.

Three details worth knowing before you build a retry loop:

  • A replay returns the original response verbatim while the resource is live — including anything that response delivered only once, such as a checkout session's client_secret. Stored responses are encrypted at rest, and are purged once the resource they describe reaches a terminal state; after that the same key answers 409. For a checkout session that has completed, expired or been refused, a replay therefore answers 409 and never starts a new purchase: read the session instead, and only create a new one (with a new key) if the buyer really wants to buy again. So a retry that lost its answer to a dropped connection can genuinely recover it, rather than being told the operation succeeded and the credential is gone.
  • Not every 4xx is stored. Authentication, the organizer header and request validation are all checked before the key is claimed, so those failures never consume a key and never replay — fix the request and send it again with the same key. Only a failure raised while performing the operation is recorded for replay.
  • The fingerprint is method + path + sorted query parameters + the exact request bytes. Reordering query parameters is fine. Reordering JSON keys is not: {"a":1,"b":2} and {"b":2,"a":1} are different bodies. Serialize once and retry the same buffer.

A replay does no work and emits no activity, so a consumer of your feed never sees a duplicate. Idempotency keys are scoped to your organizer and are retained for at least 24 hours.

Pagination

Lists are keyset-paginated on the object id. There are no page numbers.

curl "https://tickets.lissen.com/api/v1/events?limit=50" \
  -H "Authorization: Bearer tk_test_..." \
  -H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7"
{
  "data": [
    { "id": "evt_0199c4e5-2b10-7f44-8a91-3c7d0e5f8a22", "name": "Acme Winter Social" },
    { "id": "evt_0199c4e4-8d33-7a02-9e17-5b2a1f9c4d81", "name": "Acme Autumn Session" }
  ],
  "has_more": true
}
  • limit — 20 by default, 100 maximum.
  • starting_after=<id> — the next page (older). ending_before=<id> — the previous page (newer). Send at most one; both together is a 400.
  • The order is reverse-chronological, and ids are time-ordered, so the id is the cursor. Store the last id you processed in your own database and you can resume from it later without holding one of our tokens.

That property is the whole reason for this design: it is what makes a reconciliation sweep of the activity stream resumable from your own replica.

Wire conventions

Five rules, everywhere, with no exceptions:

  1. snake_case field names, on requests and responses alike.
  2. Money is an integer in minor units, always alongside an ISO-4217 currency. {"price_minor": 2500, "currency": "GBP"} is £25.00. No floats ever appear in a total.
  3. Timestamps are RFC 3339 UTC strings: 2026-11-14T19:30:00Z. Event times additionally carry the venue's IANA timezone as a separate field, because "doors at 8pm" is a fact about the venue, not about UTC.
  4. metadata is yours. Config and transactional resources carry an opaque metadata object. Put your own foreign keys in it; the engine stores and echoes it — in responses and in every activity payload — and never reads it.
  5. Be a tolerant reader. /v1 is additive forever: we add fields and enum values, and we never remove or repurpose one. Ignore fields you do not recognise, and do not crash on an enum value you have not seen. A breaking change would take a new version prefix, which we intend never to ship.

Rate limits

There is no published rate limit today. The error taxonomy reserves the rate_limit_error type and 429, so one can be introduced later without breaking a client that already handles them.

Treat 429 and 503 as retryable, with exponential backoff and jitter of your own — the engine does not currently send Retry-After, so do not wait for one. Note that capacity_locked is a contention answer, not a refusal: nobody took the tickets, the request just could not get the lock in time. Retry it.

Generating a client

The contract is published as OpenAPI 3.1, generated from the same definitions the server validates against. Rather than hand-writing types, generate them.

curl -o ticketing-openapi.json https://tickets.lissen.com/docs/openapi.json
npx openapi-typescript ticketing-openapi.json -o src/ticketing.d.ts

Then wrap fetch once, so the two headers and your error handling live in one place:

import type { paths } from "./ticketing";

type Organizer = `org_${string}`;

export function createTicketingClient(opts: {
  apiKey: string;
  organizer: Organizer;
  baseUrl?: string;
}) {
  const baseUrl = opts.baseUrl ?? "https://tickets.lissen.com/api";

  return async function request<T>(
    path: string,
    init: RequestInit & { idempotencyKey?: string } = {},
  ): Promise<T> {
    const response = await fetch(`${baseUrl}${path}`, {
      ...init,
      headers: {
        Authorization: `Bearer ${opts.apiKey}`,
        // Never inferred, never defaulted — one header, every request.
        "Ticketing-Organizer": opts.organizer,
        "Content-Type": "application/json",
        ...(init.idempotencyKey
          ? { "Idempotency-Key": init.idempotencyKey }
          : {}),
        ...init.headers,
      },
    });

    if (!response.ok) {
      const body = (await response.json()) as {
        error: { code: string; message: string; request_id: string };
      };
      // Log request_id: it is what identifies this call in our logs.
      throw new Error(
        `${body.error.code}: ${body.error.message} (request ${body.error.request_id})`,
      );
    }

    return (await response.json()) as T;
  };
}

// `paths` gives you the response type of every operation:
type Event =
  paths["/v1/events/{id}"]["get"]["responses"][200]["content"]["application/json"];

Any OpenAPI generator works — this is one spelling, not a requirement. There is no official SDK you must use.

Next

On this page