Every API call the Sprites Go SDK makes includes anDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/superfly/sprites-go/llms.txt
Use this file to discover all available pages before exploring further.
Authorization: Bearer <token> header. You supply the token when you create the client and the SDK handles all credential propagation from there. This page covers how to obtain a token, the two client constructors available, and all functional options for tuning client behavior.
Obtaining a token
Using an existing token
If you already have a sprite access token, pass it directly tosprites.New:
Exchanging a Fly.io macaroon
sprites.CreateToken is a package-level function (no client required) that exchanges a Fly.io authentication token for a sprite access token. Use this during initial setup or in tooling that bootstraps credentials:
https://api.sprites.dev/v1/organizations/<orgSlug>/tokens. It uses HTTP/1.1 to avoid HTTP/2 header-size limits on the Fly.io edge proxy, so the call succeeds even when the Fly.io macaroon is large.
The
flyMacaroon argument must be a valid Fly.io authentication token (starts with FlyV1). The returned token is a shorter sprite-specific credential that you store and reuse.Creating a client
sprites.New
The primary constructor. Accepts a token and zero or more functional options:
sprites.NewClient
An alternative constructor that takes the base URL and token as positional arguments. Useful when you prefer explicit parameters over functional options:
NewClient is equivalent to sprites.New(token, sprites.WithBaseURL(baseURL)).
Client options
Pass any number of options as the trailing arguments tosprites.New.
WithBaseURL
Override the default API endpoint. Useful for self-hosted deployments or local development:
WithHTTPClient
Provide a pre-configured *http.Client. Use this to set custom timeouts, add middleware, configure proxies, or attach transport-level TLS settings:
WithControlInitTimeout
Sets how long client.Sprite(name) waits when attempting to establish a multiplexed control connection before falling back to per-request direct WebSocket connections. The default is 2 seconds:
WithDisableControl
Disables control connections entirely. Every command opens its own direct WebSocket connection, which is the legacy behavior:
Closing the client
When you are done, callclient.Close() to release all pooled control connections: