Prerequisites
Sign in to your own account and create a key in API & MCP settings. For this tutorial enable tasks:read, tasks:write, credits:read and downloads:read. Add uploads:write if you need to upload images. Save the displayed key securely: plaintext is shown once.
Set the key in your shell without putting it in a URL. All requests in one workflow must use the same deployment and account.
BASE_URL="https://spriteflow.io"
read -rs SPRITEFLOW_API_KEY
export SPRITEFLOW_API_KEYDiscover and estimate
curl --fail-with-body "$BASE_URL/api/v1/capabilities" \
-H "Authorization: Bearer $SPRITEFLOW_API_KEY"
curl --fail-with-body "$BASE_URL/api/v1/credits" \
-H "Authorization: Bearer $SPRITEFLOW_API_KEY"Capabilities lists operations, input Schemas, documentation links and business options. Choose Character design, copy its request JSON and call POST /api/v1/estimates before generation. Estimation validates parameters and reports credits but neither reserves balance nor creates a task.
Submit once
Submit that JSON to POST /api/v1/tasks with a unique Idempotency-Key. The request shape is {operation, input, webhookUrl?}. Keep both the body and key until the task finishes. HTTP 202 means accepted, with taskId, statusUrl and pollAfterSeconds.
curl --fail-with-body "$BASE_URL/api/v1/tasks" \
-H "Authorization: Bearer $SPRITEFLOW_API_KEY" \
-H "Idempotency-Key: character-ranger-001" \
-H "Content-Type: application/json" --data-binary @request.jsonPoll and use the result
TASK_ID="replace-with-returned-task-id"
curl --fail-with-body "$BASE_URL/api/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer $SPRITEFLOW_API_KEY"
ASSET_ID="replace-with-returned-asset-id"
curl --fail-with-body "$BASE_URL/api/v1/assets/$ASSET_ID/download" \
-H "Authorization: Bearer $SPRITEFLOW_API_KEY"Wait at least the recommended interval between polls. When terminal is true, inspect the overall state and every item. Download a successful asset from the returned temporary URL, or pass its ID into Pro animation as inputAssetId with a new idempotency key.
Handle a lost response
Repeat the identical submission with its original key. A replay returns the original task and does not charge again. If parameters change, use a new key only for an intentional new generation. See Idempotency.
Machine-readable references
Public endpoints provide OpenAPI, the document index and English Markdown at /api/docs/markdown?page=<article-slug>. No sign-in or Bearer key is needed to read them; API business operations still require your scoped key.
