spine-sdk) is a typed, documented client for
the Spine API. It wraps all five public
endpoints, polls runs with configurable intervals, and narrows response
types through discriminated unions so TypeScript guides you through every
run state.
Install
fetch and FormData. Full type declarations ship in the package, so
TypeScript picks them up out of the box.
First request
SPINE_API_KEY environment variable so keys stay out of your
source code:
What’s in the box
Typed run states
Run is a discriminated union narrowed by status. The compiler
forces you to handle each state before touching result, progress,
or errors.Auto-polling
client.runs.waitForCompletion() polls to a terminal state with
configurable interval, timeout, and AbortSignal cancellation.Typed errors
SpineBadRequestError, SpineAuthError, SpineNotFoundError,
SpineServerError, SpineTimeoutError, and more — branch on the
exact failure.Runs everywhere
Node, browsers, Deno, Bun, Cloudflare Workers. One package, zero
runtime dependencies.
Next steps
Quickstart
Full end-to-end example with uploads, polling, and artifact download.
Runs and polling
All the options on
runs.create, waitForCompletion, and manual polling.Canvas introspection
Walk the block graph and task tree produced by a run.
Errors and retries
Error hierarchy and how to tune the built-in retry policy.