Availability
What the three availability states mean, what a hold is, and what to render for each
Capacity lives in a quota: a pool of units that one or more items draw on. An item always draws on at least one quota, and several items can share one — which is how a single 300-person room sells as early-bird, standard and guest list without three separate ceilings.
Availability is calculated at request time, and rechecked again during checkout before capacity is committed:
available = size − issued − in_basketsBecause it is worked out from what actually exists rather than kept as a running total, the engine can tell "nobody can have one" apart from "somebody is buying the last one right now".
The read
GET/v1/quotas/{id}/availabilitycurl https://tickets.lissen.com/api/v1/quotas/quo_0199c4e6-1a2b-7c30-9d11-4e5f6a7b8c90/availability \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7"{
"quota_id": "quo_0199c4e6-1a2b-7c30-9d11-4e5f6a7b8c90",
"size": 300,
"issued": 274,
"in_baskets": 4,
"available": 22,
"state": "available"
}| Field | What it counts |
|---|---|
size | The pool's ceiling. null means unlimited. |
issued | Live positions whose item draws on this quota. A position consumes one unit of every quota its item draws on. |
in_baskets | Units claimed by live holds — capacity sitting in somebody's checkout right now. |
available | size − issued − in_baskets, never below zero. null when the quota is unlimited. |
state | available, in_baskets or gone. |
issued can exceed size: a comp
issued with the capacity override counts as issued without raising the size.
available then stays at zero until issued positions plus live holds fall
below the size again.
A syntactically wrong quota id is invalid_request before any lookup happens.
Only a well-formed id that names nothing under your organizer is not_found.
Several quotas at once
A listing page usually needs every quota an event's items draw on. Ask for them in one request instead of one per quota:
GET/v1/availabilitycurl "https://tickets.lissen.com/api/v1/availability?quota_ids=quo_0199c4e6-1a2b-7c30-9d11-4e5f6a7b8c90,quo_0199c4e6-2b3c-7d41-8e22-5f6a7b8c9d01" \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7"The response is { "data": [ … ] } with one entry per quota that exists under
your organizer, in the same shape as the single read. Up to 100 ids per
request; an id that names nothing is left out rather than reported, and a
malformed id fails the whole request with invalid_request before any lookup.
How many of each item were issued
A quota's issued counts every item that draws on it, so a shared quota cannot
say how many early-bird tickets went and how many standard. Ask for the count
per item instead of paging through the event's positions:
curl "https://tickets.lissen.com/api/v1/item_issuance?item_ids=itm_0199c4e7-3c4d-7e52-9f33-6a7b8c9d0e12,itm_0199c4e7-4d5e-7f63-8a44-7b8c9d0e1f23" \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7"The response is { "data": [ { "item_id": "itm_…", "issued": 42 }, … ] }:
the live positions of each item, which is what a sales figure counts. A revoked
position is not counted, and an item with none reports 0. The limits are
those of the batch read above: up to 100 ids, unknown ids left out, a malformed
id refused. Items outside an event editor's event scope are also omitted.
To page through only one event's items, list items with
GET /v1/items?event_id=evt_….
The three states
The state is the field to branch on. The numbers are for your own dashboards; the state is what a buyer's screen should be a function of.
available — there is room. Either available is above zero, or the quota
is unlimited. Sell.
in_baskets — available is zero and at least one live hold exists on
this quota. Nothing is left to sell, but nothing is finally gone either: the
units are inside checkouts that can still expire. Every one of those holds has
a deadline, so this state can resolve itself without anyone doing anything.
gone — available is zero and there are no live holds. Every unit has
been issued.
in_baskets is deliberately not purchasable. A hold is an exclusive claim
for the buyer who made it, so offering those units to a second buyer would be
selling the same seat twice and refunding one of them later. The honest answer
is "not right now, check back in a few minutes" — and unlike "sold out", it is
true.
What brings capacity back
Capacity returns when a hold is released or lapses, a position is revoked, or
quota size increases. Completion moves units from in_baskets to issued and
does not increase available.
- A hold released or lapsed — the session was expired, or its deadline passed. The units go back to the pool.
- A position revoked — a refund, a payment bounce or a dispute frees the unit it consumed. See orders & issuance and refunds & disputes.
- You resizing the quota. Raising
sizeadds room immediately. That is the only lever you hold directly.
What a hold is
A hold is capacity claimed for one buyer while they pay. It is created by the checkout session that owns it — you never create one directly, and there is no holds endpoint — and it ends when the session completes, when the session is expired, or when its own deadline passes.
The session's expires_at is the hold's clock. Read it there rather than
computing one: see Checkout for how a session's lifetime
works, including the fact that updating a cart does not buy the buyer more
time.
The standard checkout hold runs for ten minutes today. That is an
engine-wide setting Lissen owns rather than a per-request one, and it is not
the only value in play — an invitation hold from a waitlist promotion is
deliberately much longer. Do not hard-code either; read expires_at.
Two properties are worth knowing before you build a countdown:
- Liveness is the hold's status, not the clock. Passing
expires_atdoes not by itself free anything: a background pass expires the session (releasing its hold) or lapses a session-less hold, and the units return then. There is no contractual maximum on how long that takes. The engine will undersell briefly rather than risk overselling by one, so a buyer can seein_basketsfor capacity whose deadline has already gone. - A release is a written fact, not an inference. When the units come back
the engine records an activity, and which one depends on the hold. A hold
that belongs to a checkout session is released when its session expires, and
that release is
hold.updated(the session's owncheckout_session.expiredcomes with it). A hold with no session, such as an invitation hold, lapses on its own and emitshold.lapsed. If you are mirroring availability into your own store, those activities, not a timer you ran yourself, are the events to act on.
Unlimited quotas
A quota with size: null is deliberately unlimited: available is null and
state is always available, however many positions exist.
{
"quota_id": "quo_0199c4e6-1a2b-7c30-9d11-4e5f6a7b8c90",
"size": null,
"issued": 1841,
"in_baskets": 2,
"available": null,
"state": "available"
}Unlimited is terminal. A quota that has been made unlimited can never be
given a finite size again — the attempt is refused with
quota_unlimited_immutable. Widening a finite quota to unlimited is allowed;
narrowing back is not, because live checkouts have already been decided against
a pool with no ceiling. If you need a cap on something currently unlimited,
create a finite quota and point a new item at it.
Render available: null as "available", never as 0 — a naive
available > 0 check reads unlimited as sold out.
What to render
| State | A reasonable UI |
|---|---|
available, available above your threshold | The normal buy button. |
available, a handful left | "Only 6 left" — it is a true number at the instant you read it. |
in_baskets | "Currently in other people's baskets — check back shortly." Offer a refresh. |
gone | "Sold out." |
Two rules that will save you a support thread:
- Availability is a display value, not a reservation. The binding
decision is recalculated during checkout, at the moment capacity is claimed.
A quota that read
availablecan still refuse when you open the session. Handle that; do not treat it as a bug. - A quota's availability is not an item's sellability. An item can be
inactive, outside its sale window, or gated behind an entitlement while its
quota has plenty of room. Quote the cart to learn which — the line comes
back with
sellable: falseand ablocked_reason. See Pricing & entitlements.
What emits on the activity stream
Reading availability emits nothing. It is a read; it changes no state.
The facts that move a number in this response do emit:
quota.created,quota.updated— the pool itself, most often a resize.hold.created— units moved intoin_baskets.hold.updated— the hold's capacity footprint changed, its deadline was re-armed, or it was released or converted into positions.hold.lapsed— a hold's deadline passed and its units returned to the pool.
Issuance moves units from in_baskets to issued; those activities arrive
with orders & issuance.
Stable error codes
Reading availability can fail with the usual authentication and tenancy codes,
plus invalid_request for a malformed quota id and not_found for a
well-formed one that names nothing here. A quota belonging to another organizer
reads as absent rather than forbidden, which is the correct answer.
The two codes you meet when you act on what you read are not the same answer as each other:
capacity_locked— the request could not get the capacity lock in time. Retry with a short backoff. Do not conclude anything about availability from it: the retry may well succeed, and it may equally come backinsufficient_capacityonce it gets in.insufficient_capacity— there is genuinely not enough room, decided inside the lock immediately before it was returned. Do not blind-retry the same request; re-read availability and offer fewer units, or a different item.
Resizing a quota has its own small family:
| Code | Status | Type | What it means | What to do |
|---|---|---|---|---|
quota_below_consumption | 400 | invalid_request_error | A 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_immutable | 400 | invalid_request_error | An 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. |
The whole registry is on Getting started.
Gotchas
- Two items sharing a quota share a ceiling. Selling out the guest list can take standard entry with it if both draw on the same pool. Model that deliberately.
available: 0withstate: "gone"is not the same thing asavailable: 0withstate: "in_baskets". Branch onstate.- Do not poll this endpoint per buyer per second. It is cheap but it is still a round trip per quota. Poll on a sensible interval for a listing page, and read the activity stream if you need to react to a change quickly.
- An item's quota binding freezes once live capacity depends on it
(
item_quotas_locked). Get the binding right before you sell, or create a new item and close the old one's sale window. To open a second tier when the first runs out, link it withopens_after_item_id; "runs out" there is issued units reaching a quota's size, notin_baskets.