Skip to content

Node.js server SDK

Install @seatlayer/server 0.7.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.7.0 requires Node.js 20.19.4 or newer and has no runtime dependencies.

Install and create the client

npm install @seatlayer/server@0.7.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, inventory, performanceGroups, sessions, seasons, templates, webhooks, and workspaces.

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 48 frozen 0.7.0 operations across catalogue, lifecycle, Plans and sales, buyer handoff, holder import, renewals, amendments, reports, recovery, outbox, audit, and support export. Exact method names retain the domain prefix, for example createSeason, publishSeasonPlan, bookSeasonHold, commitSeasonRenewalOffer, and exportSeasonSupportSnapshot. Source-only occurrence return/reclaim methods are not part of the 0.7.0 package.

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

The 0.7.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);
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 14 methods also retry with one exact Idempotency-Key: charts.create, charts.copy, templates.instantiateTemplate, events.create, workspaces.create, performanceGroups.createPerformanceGroup, and the Season methods createSeason, updateSeason, deleteSeason, createSeasonPlan, duplicateSeasonToLive, createSeasonHolderImport, createSeasonRenewalOffers, and createSeasonAmendment. Holds, bookings, lifecycle changes, 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; pass the response’s opaque nextCursor back as cursor to the same list 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