Skip to content

Node.js server SDK

Install @seatlayer/server 0.9.0, inspect an authoritative hold, book with a stable reference, and use the exact Node.js resource namespaces.

Updated View as Markdown

Use @seatlayer/server from Node.js or TypeScript code running in a trusted backend. Version 0.9.0 requires Node.js 20.19.4 or newer and has no runtime dependencies.

Install and create the client

npm install @seatlayer/server@0.9.0
import { SeatLayer } from '@seatlayer/server';

const seatlayer = new SeatLayer(process.env.SEATLAYER_SECRET_KEY!);
if (seatlayer.mode !== 'test') {
  throw new Error('Use a test key while integrating.');
}

Keep SEATLAYER_SECRET_KEY in the server environment. Never expose the client or its sk_… credential to browser or mobile code.

Exact resource surface

The client exposes charts, channels, events, eventSeries, holders, inventory, orders, performanceGroups, sessions, seasons, templates, webhooks, and workspaces.

New in 0.9.0: eventSeries creates, lists, reads, adds dates to, and updates event series. holders covers customers (listCustomers), holder details, seasons and tickets, ticket transfers, returns, and renewal checkout and decline. orders lists and reads orders across events and seasons, and lists, exports, refunds, cancels, and resends one event’s orders. events adds the event sales calls: buyer checkout, payment gateway, sales readiness, preflight and transition, booking fee, and discount codes.

seatlayer.performanceGroups contains all 13 released operations: listPerformanceGroups, createPerformanceGroup, retrievePerformanceGroup, deletePerformanceGroup, activatePerformanceGroup, closePerformanceGroup, retrievePerformanceGroupLifecycle, createPerformanceGroupBuyerAccessSession, listPerformanceGroupBuyerAccessSessions, revokePerformanceGroupBuyerAccessSession, retrievePerformanceGroupHold, bookPerformanceGroupHold, and retrievePerformanceGroupBooking.

seatlayer.seasons contains all 90 Season operations in 0.9.0, across catalogue, lifecycle, Plans and sales, plan edits and package prices, performances, buyer handoff, holder import, holders, season orders, renewals and hosted renewals, amendments, occurrence return and reclaim, season seats, bulk jobs, reports, recovery, outbox, audit, and support export. Exact method names retain the domain prefix, for example createSeason, publishSeasonPlan, bookSeasonHold, commitSeasonRenewalOffer, and exportSeasonSupportSnapshot. Occurrence return and reclaim are returnSeasonOccurrenceInventory and reclaimSeasonOccurrenceInventory. Each is sent once; reuse its actionId after an unknown outcome.

Season seats are SDK methods in 0.9.0: setAsideSeasonBlock, retrieveSeasonBlock, and releaseSeasonBlock. Turn them on for a season with inventoryMode: 'block' on createSeason or updateSeason; every Season reads back inventoryMode as block or per_hold. The season seats routes give the rules. A refusal throws a SeatLayerError subclass; read its code, for example season_block_not_enabled.

The same 13 Performance Group and 90 Season wire operations are released in all seven official server SDKs; only language naming differs.

The 0.9.0 typed createPerformanceGroup parameters cover the default fixed policy but do not expose the newer REST inclusionMode field. Use the REST/raw-request path when you need flexible_dates; this field-level caveat does not reduce the SDK’s 13 operation coverage.

Inspect and book an Event hold

The buyer surface gives your backend an opaque holdId. Retrieve it from SeatLayer before calculating the order in your trusted commerce system, then book once with your own stable order identifier:

const eventKey = process.env.SEATLAYER_EVENT_KEY!;
const holdId = process.env.SEATLAYER_HOLD_ID!;
const bookingRef = process.env.ORDER_ID!;

const hold = await seatlayer.inventory.retrieveHold(eventKey, holdId);
// An expired, released or booked hold still answers with its status.
if (hold.status !== "active") throw new Error("The hold is no longer active");
const labels = hold.items.map((item) => item.label);
// Price from hold.items and authorize payment in your commerce system here.
const booking = await seatlayer.inventory.book(eventKey, {
  holdId,
  labels,
  bookingRef,
});

Do not calculate a charge from browser-submitted totals. A bookingRef is your commerce system’s immutable join to SeatLayer inventory, not a random retry ID. If the booking response is lost, call seatlayer.inventory.retrieveBooking(eventKey, bookingRef) before deciding whether to repeat the exact same hold, labels, and reference.

Errors, retries, and pagination

Branch on SeatLayerAuthError, SeatLayerConflictError, and SeatLayerRateLimitError. Mode mismatch is available as SeatLayerAuthError.isModeMismatch; sold out is available as SeatLayerConflictError.isSoldOut.

Reads retry 408, 429, and 5xx responses with backoff. These 43 methods also retry with one exact Idempotency-Key:

  • charts.create, charts.copy, templates.instantiateTemplate, events.create, workspaces.create, and performanceGroups.createPerformanceGroup
  • eventSeries: createEventSeries, addEventSeriesDates, and updateEventSeries
  • holders: updateHolder, createHolderTransfer, createHolderReturn, and createHolderRenewalCheckout
  • orders: refundEventOrder and cancelEventOrder
  • seasons (28): createSeason, updateSeason, deleteSeason, publishSeason, duplicateSeasonToLive, createSeasonPlan, updateSeasonPlan, deleteSeasonPlan, replaceSeasonPackagePrices, createSeasonPerformances, attachSeasonPerformances, deleteSeasonPerformance, attachSeasonPlanPerformance, deleteSeasonPlanPerformance, markSeasonPerformancePast, refundSeasonPerformance, createSeasonCheckoutTest, createSeasonHolderImport, createSeasonHolderImportFromSeason, createSeasonRenewalOffers, createSeasonRenewalCheckout, releaseSeasonLapsedOffers, createSeasonAmendment, refundSeasonOrder, cancelSeasonOrder, cancelSeasonOrderDate, setAsideSeasonBlock, and releaseSeasonBlock

Holds, bookings, lifecycle and sales changes other than publishSeason, occurrence return and reclaim, the event sales calls, resends, show-once secrets, and raw mutations are single-attempt.

Large lists use async iteration:

for await (const event of seatlayer.events.listAll()) {
  await syncEvent(event);
}

That helper is Event-specific. Performance Group and top-level Season list methods return one cursor page, and so do listSeasonRenewalOffers, listSeasonHolders, retrieveSeasonHostedRenewals, holders.listCustomers, holders.listHolderTickets, orders.listOrders, orders.listEventOrders, and eventSeries.listEventSeries. Pass the response’s opaque nextCursor back as cursor to the same method until it is absent.

See errors, retries, and idempotency for the full contract.

Verify and continue

Verify the flow with a test key, a test Event, and a real test hold. Then add webhook verification, choose the correct inventory model, and complete the going-live checklist.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close