Go SDK
go get github.com/seal0-app/sdk-goStandard library only, with no dependencies. Go 1.23 or later. Source and issues: github.com/seal0-app/sdk-go (Apache-2.0).
Create a client
Section titled “Create a client”import seal0 "github.com/seal0-app/sdk-go"
client, err := seal0.New(os.Getenv("SEAL0_API_KEY")) // keep the key on the serverOptions: seal0.WithBaseURL (default https://api.seal0.app), seal0.WithHTTPClient, seal0.WithMaxRetries (default 2).
Evaluate
Section titled “Evaluate”ev, err := client.Evaluate(ctx, "cus_test_0001", "max_projects")if err != nil { return deny() // unknown Customer or feature, auth or network failure: fail closed}if n, unlimited, ok := ev.Entitlement.Value.Limit(); ok && (unlimited || projects < n) { return allow()}- Every feature at once:
client.EvaluateAll(ctx, "cus_test_0001"). - Reading values:
Value.Bool(),Limit()(number and metered),Enum(),IsUnlimited(). Build values withseal0.BoolValue,NumberValue,UnlimitedValueandEnumValue. - Metered results carry
Entitlement.Usage: used, limit, remaining, over limit and the period.
Errors
Section titled “Errors”switch {case errors.Is(err, seal0.ErrCustomerNotFound):case errors.Is(err, seal0.ErrFeatureNotFound):}var apiErr *seal0.APIErrorif errors.As(err, &apiErr) { log.Printf("seal0: %s (request %s)", apiErr.Code, apiErr.RequestID)}*seal0.APIError carries Status, Code, Field and RequestID. See Errors and retries.
Managing data (full-scope key)
Section titled “Managing data (full-scope key)”Every API operation has a method: CreateFeature, UpdateFeature, CreatePlan, PutDraft, PublishPlan, UpsertCustomer, AssignSubscription, UpdateSubscription, ChangePlanVersion, CreateOverride, RevokeOverride, RecordUsage, and the matching getters and lists.
- PATCH fields:
seal0.Set(v)changes a field,seal0.Null[T]()clears it, and leaving it unset keeps it. - Lists:
for f, err := range client.Features(ctx) { … }pages through everything. - Idempotency: every mutation sends an
Idempotency-Key, reused across retries. Choose your own withseal0.WithIdempotencyKey.
Automating setup has a full example.