OptionalmaxContentLength?: numberOptionalmaxRedirects?: numberOptionalmaxRetryDurationMs?: numberOptional wall-clock ceiling on total retry duration in ms. Overrides
the default 8000ms. Pass 0 to disable and rely on _maxRetries
alone.
Optionaltimeout?: numberStaticInstanceReturns the singleton instance of the Tiltify client.
The instance reference is stored on globalThis behind
Symbol.for("@playlive/tiltify-core.instance") rather than on a
private static field of this class. Consumer bundlers — notably
Vite's optimizeDeps in dev — can pre-bundle each subpath export
of a downstream package independently and inline tiltify-core
into each pre-bundle. That produces two class Tiltify
declarations, each with its own _instance slot, and consumer
calls like tiltify.UseProxy(...) land on a different instance
than the one the fetcher chain eventually reads from — all
requests then run against an unconfigured client and, depending on
the caller, fail silently.
Symbol-registry lookup on globalThis collapses those duplicate
copies to a single logical instance. Same technique used in
@playlive/fundraiser-data/config for its configure() slot; see
that module's packageDocumentation block for the fuller story.
Activates a webhook endpoint by its ID. Requires webhooks:write scope.
Clears the currently stored bearer token, refresh token, and expiration.
After calling this, GetAuthStatus returns MISSING.
Creates or updates a webhook subscription for a given endpoint and event.
Returns the currently configured base URL.
Deletes a webhook subscription for a given endpoint and event.
Disables authentication entirely — useful when a proxy handles auth.
Disables all library logging (equivalent to SetLogLevel("silent")).
Errors are still thrown — only the log sink is silenced.
Re-enables the default logging behavior ("warn" and above).
Finds an auction house by cause slug and auction-house slug.
Finds an auction house by user slug and auction-house slug.
Finds a campaign by user/team slug and campaign slug. Returns null on 404.
https://v5api.tiltify.com/api/public/openapi (operation getCampaignBySlugs)
Finds a team by its slug. Returns null on 404.
https://v5api.tiltify.com/api/public/openapi (operation getTeamBySlug)
Finds a user by their slug. Returns null on 404.
https://v5api.tiltify.com/api/public/openapi (operation getUserBySlug)
Helper for calling the Tiltify v5 API with optional pagination parameters. Tiltify error responses are returned as data rather than thrown.
A DIY paginator. Calls the provided async callback with each page of
data. The callback must return a cursor string to continue paginating,
or null to stop.
Get the currently active milestones for a fundraising event by its
public id — the same UUID returned by
GET /public/fundraising_events/{id} and referenced throughout the
Tiltify REST API (/supporting_events, /user_leaderboard, …).
This is a proxy-only call. Tiltify's public REST API has no
milestones endpoint for a fundraising event — milestones exist only
for campaigns, team campaigns, personal campaigns, and facts (and
/public/facts/:fact_id/milestones 404s for fundraising-event ids).
The FE-level list is reachable only through the GraphQL endpoint
tiltify.com's own landing pages use, which browsers cannot call from a
Play Live surface (CORS + Cloudflare bot-scoring).
The proxy therefore fills the gap at
GET /public/fundraising_events/:fundraising_event_id/milestones,
resolving the fact via GraphQL, filtering active === true
server-side, and returning a Tiltify REST-shaped { data, metadata }
envelope. Requires UseProxy to have been called — there is no
direct fallback.
The proxy scopes this route to St. Jude: a fundraising event owned by
any other cause is refused with a 403, since fact ids are global and
the route would otherwise act as an open relay for Tiltify's GraphQL
gateway.
Public / unauthenticated route: no Authorization header is sent
and the proxy never returns inactive milestones. This method also
re-filters active === true client-side as defence-in-depth in case
a future proxy version drifts.
The returned items are field-compatible with the REST
TiltifyMilestone from GetMilestones, minus
inserted_at / updated_at / legacy_id (the upstream GraphQL
fragment does not project those).
The fundraising event's public id (UUID).
Ordered array of active milestones, or null when no
fundraising event matches the id (the proxy answers 404 with
Tiltify's own error envelope, matching GetCampaign's
not-found convention). An empty array is meaningful and
distinct: the event exists but currently has no active milestones.
Gets all current fundraising events at the cause level with optional pagination.
Gets all team campaigns for the current cause.
Gets bids for a given auction item.
Optionallimit: numberGets bids for an auction item with pagination metadata.
Gets an auction house by its ID.
Gets a single auction item by ID.
Gets auction items for a given auction house.
Optionaloptions: {Returns the current authentication mode.
Returns the current authentication mode as a string.
Returns the freshness status of the currently stored access token.
Fetches an OAuth access token from Tiltify using the client_credentials
grant. Only valid in CLIENT auth mode.
DISABLED mode → returns null (proxy-handled auth).USER mode → throws (call OverrideAuthToken instead).Falls back to process.env.TILTIFY_CLIENT_ID.
Falls back to process.env.TILTIFY_SECRET.
OAuth scope to request. Defaults to "cause".
The bearer token string, or null if auth is disabled.
Gets a campaign by its ID.
The campaign ID.
If true, fetches a team campaign.
The campaign data, or null if not found.
https://v5api.tiltify.com/api/public/openapi (operation getCampaign)
Gets donations for a given campaign with optional date range filters.
Gets the fitness goals for a given campaign.
Returns a cause by its ID. Returns null if not found.
Returns all cause campaigns, automatically handling pagination.
Gets donations for the current cause. Requires cause mode + API key.
Gets the donor leaderboard for a given cause.
Gets all current St. Jude fundraising events.
Returns the currently stored OAuth refresh token, or null if none has
been provided. Refresh tokens are only set by callers via
OverrideAuthToken or rotated automatically by
RefreshAuthToken.
Returns the current bearer token string, or null if not authenticated.
Returns the user associated with the current OAuth access token (USER mode only).
Gets up to 3 active donation matches for a given campaign.
Gets the top teams by fitness distance for a given fundraising event.
Gets the top teams by fitness time for a given fundraising event.
Gets the top users by fitness distance for a given fundraising event.
Gets the top users by fitness time for a given fundraising event.
Gets the user leaderboard for a given fundraising event.
Gets a fundraising event by its ID.
https://v5api.tiltify.com/api/public/openapi (operation getFundraisingEvent)
Gets all campaigns supporting a given fundraising event.
Gets the donor leaderboard for a given campaign.
Gets the donor leaderboard for a given campaign, returning the raw paginated response.
Returns the current retry-duration cap (ms). 0 means disabled.
Gets the milestones for a given campaign.
Returns the current API mode ("public" or "cause").
Gets the next unachieved milestone for a campaign based on amount raised.
Gets a single poll by ID for a given campaign.
Gets all polls for a given campaign.
Gets the rewards for a given campaign.
Gets the schedule for a given campaign.
Returns the currently configured source-tag value.
Gets the donation targets for a given campaign.
Gets a team by its ID. Returns null on 404.
https://v5api.tiltify.com/api/public/openapi (operation getTeam)
Gets a specific team campaign or all campaigns for a team.
Gets all campaigns for a given team ID with optional status / supporting filters.
Optionalstatus: "published" | "retired"OptionalsupportingType: TiltifyCampaignSupportableTypeGets the members of a team.
Optionallimit: numberOptionalbefore: stringOptionalafter: stringhttps://v5api.tiltify.com/api/public/openapi (operation getTeamMembers)
Gets all campaigns supporting a given team campaign.
Gets the user leaderboard for a given team campaign.
Returns the current token expiration timestamp in milliseconds.
Gets a user by their ID.
https://v5api.tiltify.com/api/public/openapi (operation getUser)
Returns the currently configured outbound User-Agent string.
Lists all campaigns and team campaigns for a given user ID.
Gets all personal campaigns for a given user ID.
Returns whether proxy fallback mode is currently enabled.
Manually sets the current bearer token, its expiration, and (optionally) a refresh token. The canonical way to authenticate in USER auth mode.
Full Authorization-header value (e.g. "Bearer eyJ...").
Milliseconds timestamp at which the token expires.
OptionalrefreshToken: string | null
OAuth refresh token. Pass undefined to leave any
previously stored refresh token in place; pass null to explicitly clear it.
Overrides the base URL used for all API requests.
Optionalretry: numberExchanges the currently stored refresh token for a fresh access token. Only valid in USER auth mode.
The new bearer token string, or null if auth is disabled.
Switches to the cause API namespace (requires SetCauseApiKey).
Sets the client ID + secret used for client-credential auth. Takes
precedence over TILTIFY_CLIENT_ID / TILTIFY_SECRET env vars.
Tiltify application client ID.
Tiltify application client secret.
Replaces the built-in console.*-based logger with a custom sink — for
example to forward logs to Sentry, pino, or any structured logger.
Sets the minimum log level. Anything below the chosen level is dropped.
Use "silent" to suppress all logging.
One of "debug" | "info" | "warn" | "error" | "silent".
Sets the maximum retry count for transient failures (default 5).
PerformRequest retries 401/502/5xx responses and AbortError
timeouts up to this many times, with 0.5s backoff between attempts.
Each attempt is a fresh fetch() and so produces its own OTEL
undici span — lowering this is the right knob for "best effort"
Lambdas (e.g. periodic ticks, fire-and-forget snapshots) where a
single failed read is cheap and the next invocation will retry
anyway, and where the per-attempt OTEL error span volume is
unwanted dashboard noise.
Pass 0 to disable retries entirely.
Sets a wall-clock ceiling on the total time a single PerformRequest
(including all retry sleeps) may spend before short-circuiting with the
last observed error. Defaults to 0 (disabled) so _maxRetries alone
governs retry behavior — opt in from short-timeout callers such as
API-Gateway lambdas that would otherwise burn ~15s on a full
exponential-backoff chain while their client has already timed out.
The cap is checked before each retry sleep; a sleep that would push
Date.now() past the deadline aborts the retry loop and throws the
response's error immediately. Explicit Retry-After headers are still
honoured whenever they fit within the remaining budget.
Pass 0 to disable the cap.
Maximum retry budget in milliseconds.
Switches to the public API namespace (default).
Overrides the value sent in the source-tagging header (X-Source by default).
The source identifier (e.g. an app name or build ID).
Sets the per-request timeout in milliseconds (default 5000).
Overrides the outbound User-Agent header. Useful when a consumer wants
Tiltify-side logs (and Cloudflare bot-scoring) to attribute traffic to a
specific PLAY LIVE surface instead of the generic library default. The
value is sent verbatim on every fetch — token mints, refresh exchanges,
and all REST calls.
A non-empty UA string. Empty / whitespace-only values
are ignored so consumers cannot accidentally fall back to Node's bare
node default by passing "".
Internal
Test helper: clears credentials set via SetCredentials, reverting to env var fallback.
Internal
Test helper: manually overrides the token expiration time.
A Date-compatible milliseconds timestamp.
Switches to client-credential auth mode. Reads TILTIFY_CLIENT_ID and
TILTIFY_SECRET from process.env unless SetCredentials has
been called.
Resets the base URL back to the default Tiltify v5 API URL and clears proxy flags.
Configures the library to use a Tiltify proxy. Disables direct auth and
overrides the base URL. Also clears any leftover bearer token stashed by
a previous GetAuthToken / OverrideAuthToken call — the proxy handles
auth server-side, and leaving a stale (or cause-scoped) bearer on the
singleton would poison downstream requests. USER mode is preserved so
consumers driving their own OAuth flow keep their token.
Either an env shorthand ("dev" | "qa" | "prod") or
an explicit proxy base URL. Defaults to the production St. Jude proxy.
Optionalsource: string
Optional value for the source-tagging header.
Enables proxy mode with an automatic env fallback chain
(prod → qa → dev). Transient or server-side failures advance the chain;
4xx responses propagate immediately.
Optionalsource: string
Optional source-tag header value (see UseProxy).
Switches to user OAuth auth mode.
In this mode the library does not perform the initial OAuth code-exchange — the consumer is responsible for that step (typically on a server they control) and pushes the resulting bearer token into the client via OverrideAuthToken. If the consumer also supplies a refresh token, the library will transparently exchange it for a fresh access token when the current one expires (see RefreshAuthToken).
Waits asynchronously for the given number of seconds. Useful for Tiltify rate-limit handling.
Number of seconds to wait.
Tiltify v5 REST client. Prefer the tiltify singleton over
new Tiltify().