Skip to content

Go server SDK

Install seatlayer-go v0.7.0, inspect an authoritative hold, book with a stable reference, and use the exact Go service namespaces.

Updated View as Markdown

Use github.com/seatlayer/seatlayer-go from a trusted Go backend. Version v0.7.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.7.0
inside application startupgo
import (
    "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, Inventory, PerformanceGroups, Sessions, Seasons, Templates, Webhooks, and Workspaces.

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 48 frozen v0.7.0 operations. Go drops the redundant Season prefix inside the service, for example Create, PublishPlan, BookHold, CommitRenewalOffer, and ExportSupportSnapshot. The service covers catalogue, lifecycle, Plans and sales, buyer handoff, holder import, renewals, amendments, reports, recovery, outbox, audit, and support export. Source-only occurrence return/reclaim operations are not part of v0.7.0.

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

The v0.7.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
}
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 err

Do 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 14 methods also retry with one exact key: Charts.Create, Charts.Copy, Templates.InstantiateTemplate, Events.Create, Workspaces.Create, PerformanceGroups.Create, and Seasons.Create, Update, Delete, CreatePlan, DuplicateToLive, CreateHolderImport, CreateRenewalOffers, and CreateAmendment. 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

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