Use github.com/seatlayer/seatlayer-go from a trusted Go backend. Version
v0.9.0 requires Go 1.23 or newer and uses only the standard library.
Install and create the client
go get github.com/seatlayer/seatlayer-go@v0.9.0import (
"errors"
"os"
seatlayer "github.com/seatlayer/seatlayer-go"
)
client, err := seatlayer.New(os.Getenv("SEATLAYER_SECRET_KEY"))
if err != nil {
return err
}
if client.Mode() != "test" {
return errors.New("use a test key while integrating")
}Import the module as seatlayer; the package name intentionally differs from
the final repository segment. Keep the secret key in the server environment.
Exact service surface
The client exposes Charts, Channels, Events, EventSeries, Holders,
Inventory, Orders, PerformanceGroups, Sessions, Seasons, Templates,
Webhooks, and Workspaces.
client.Events also holds event sales setup: buyer checkout, payment gateway,
sales readiness, PreflightSales, TransitionSales, booking fee, and discount
codes. client.Holders.ListCustomers lists customers.
client.PerformanceGroups contains all 13 released operations: List,
Create, Retrieve, Delete, Activate, Close, RetrieveLifecycle,
CreateBuyerAccessSession, ListBuyerAccessSessions,
RevokeBuyerAccessSession, RetrieveHold, BookHold, and RetrieveBooking.
client.Seasons contains all 90 Season operations in v0.9.0. Go drops the
redundant Season prefix inside the service, for example Create, PublishPlan,
BookHold, CommitRenewalOffer, and ExportSupportSnapshot. The service
covers catalogue, lifecycle, performances, Plans and plan edits, package prices,
sales, checkout tests, buyer handoff, holder import and the holder list,
renewals and hosted renewals, amendments, Season orders, reports and CSV
exports, bulk jobs, season seats, recovery, outbox, audit, and support export.
ReturnOccurrenceInventory returns one Season occurrence allocation to ordinary
Event inventory, and ReclaimOccurrenceInventory reclaims it while it is still
free.
Season seats are Seasons.SetAsideBlock, Seasons.RetrieveBlock, and
Seasons.ReleaseBlock. Turn them on with
InventoryMode: seatlayer.SeasonInventoryModeBlock in SeasonCreateParams or
SeasonUpdateParams; every Season answer carries inventoryMode (block or
per_hold). Both writes answer 202 with a job to follow with
Seasons.RetrieveBulkJob. The season seats
routes list the rules and refusal codes. A
refusal is a *seatlayer.APIError or a typed wrapper such as
*seatlayer.ConflictError; read its Code.
The same 13 Performance Group and 90 Season wire operations are released in all seven official server SDKs; only language naming differs.
The v0.9.0 typed PerformanceGroups.Create parameters cover the default
fixed policy but do not expose the newer REST inclusionMode field. Use the
REST/raw-request path for
flexible_dates; the other typed create fields and all 13 operations remain
available.
Inspect and book an Event hold
Every API method accepts a context.Context. Cancelling it stops retry work
immediately.
eventKey := os.Getenv("SEATLAYER_EVENT_KEY")
holdID := os.Getenv("SEATLAYER_HOLD_ID")
bookingRef := os.Getenv("ORDER_ID")
hold, err := client.Inventory.RetrieveHold(ctx, eventKey, holdID)
if err != nil {
return err
}
// An expired, released or booked hold still answers with its status.
if hold.Status != "active" {
return errors.New("the hold is no longer active")
}
if len(hold.Items) == 0 {
return errors.New("the hold contains no inventory")
}
labels := make([]string, 0, len(hold.Items))
for _, item := range hold.Items {
labels = append(labels, item.Label)
}
// Price from hold.Items and authorize payment in your commerce system here.
_, err = client.Inventory.Book(ctx, eventKey, seatlayer.BookParams{
HoldID: holdID,
Labels: labels,
BookingRef: bookingRef,
})
return errDo not calculate a charge from browser-submitted totals. BookingRef is your
commerce system’s immutable join to SeatLayer inventory. If the response is
lost, call client.Inventory.RetrieveBooking(ctx, eventKey, bookingRef) before
deciding whether to repeat the exact same hold, labels, and reference.
Errors, retries, and iteration
Errors are values. Use errors.As with *seatlayer.AuthError,
*seatlayer.ConflictError, and *seatlayer.RateLimitError; SoldOut() is the
explicit sold-out business branch.
Reads retry 408, 429, and 5xx with exponential backoff and full jitter.
These 43 methods also retry with one exact key:
Charts:Create,CopyTemplates:InstantiateTemplateEvents:CreateEventSeries:Create,AddDates,UpdateWorkspaces:CreatePerformanceGroups:CreateHolders:Update,CreateTransfer,CreateReturn,CreateRenewalCheckoutOrders:RefundEventOrder,CancelEventOrderSeasons(28):Create,Update,Delete,CreatePlan,UpdatePlan,DeletePlan,Publish,DuplicateToLive,CreatePerformances,AttachPerformances,DeletePerformance,AttachPlanPerformance,DeletePlanPerformance,MarkPerformancePast,ReplacePackagePrices,CreateCheckoutTest,CreateHolderImport,CreateHolderImportFromSeason,CreateRenewalOffers,CreateRenewalCheckout,ReleaseLapsedOffers,CreateAmendment,RefundOrder,CancelOrder,CancelOrderDate,RefundPerformance,SetAsideBlock, andReleaseBlock
Other mutations and raw Do mutations are single-attempt. Retry-After takes
precedence when present.
Large lists use Go 1.23 range-over-function iteration:
for event, err := range client.Events.All(ctx, nil) {
if err != nil {
return err
}
syncEvent(event)
}That iterator is Event-specific. Performance Group and top-level Season list
methods return one cursor page; pass the response’s opaque NextCursor in the
next list options until it is empty.
See errors, retries, and idempotency for the shared contract.
Verify and continue
- Go package reference
v0.9.0 - tagged source and package README
PerformanceGroupsmethods atv0.9.0- all
Seasonsmethods atv0.9.0 - current API operation support
- OpenAPI 3.1 reference
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.