Sprite FusionSprite Fusion
Pixel Art GeneratorAPI

API Reference

Endpoint, request, response, and event reference for the Sprite Fusion API.

Base URL:

https://www.spritefusion.com/api/v1

Authenticate every request with your API key:

Authorization: Bearer $SPRITE_FUSION_API_KEY

GET /credits

Returns the credits currently available to the account.

curl -sS https://www.spritefusion.com/api/v1/credits \
  -H "Authorization: Bearer $SPRITE_FUSION_API_KEY"
{"credits":285}

POST /uploads

Creates a short-lived upload URL for an input image. Send JSON with these fields:

FieldTypeDescription
content_typestringimage/png, image/jpeg, or image/webp
size_bytesintegerExact file size, up to 20 MiB
sha256stringLowercase SHA-256 digest of the file
{
  "content_type": "image/png",
  "size_bytes": 12480,
  "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}

The response contains the signed upload_id, upload URL, their separate expiry times, and headers to use for the upload:

{
  "upload_id": "upl_...",
  "upload_url": "https://...",
  "upload_url_expires_at": "2026-08-28T12:05:00.000Z",
  "upload_id_expires_at": "2026-08-29T12:00:00.000Z",
  "headers": {"Content-Type":"image/png"}
}

See Input Images for the complete upload flow.

POST /generate

Starts any generation or transformation operation. Send Content-Type: application/json. A successful request returns a text/event-stream response.

OperationRequired fieldsOptional fields
generateprompt, size
editprompt, inputs (1–9)size
style-referenceprompt, inputs (1–20)size
direction-setinputs (exactly 1)size
animateprompt, inputs (exactly 1)output_frames, colors

Image size may be 16, 32, or 64. Generate also accepts "any". Animation output_frames must be an even number from 2 to 16, and colors must be an integer from 2 to 256.

{
  "operation": "edit",
  "prompt": "Give this character a blue cape",
  "inputs": [{"asset_id":"asset_..."}],
  "size": 32
}

Each item in inputs uses one of the following forms:

{"asset_id":"asset_..."}
{"data_url":"data:image/png;base64,..."}
{"upload_id":"upl_..."}

See Generate and Transform Sprites for an example of every operation.

Stream events

Each JSON event is sent on an SSE data: line.

EventDescription
startedThe request started and credits were reserved
progressGeneration is underway
outputA generated asset was saved and is ready to use
completedThe request finished with succeeded or failed
data: {"type":"started","request_id":"req_...","operation":"edit","credits":{"reserved":15,"remaining":285}}

data: {"type":"progress","message":"Generating sprites"}

data: {"type":"output","index":0,"asset":{"id":"...","type":"image","assetUrl":"https://media.spritefusion.com/..."}}

data: {"type":"completed","status":"succeeded","output_count":1,"credits":{"remaining":285}}

See Streaming, Errors, and Credits for complete readers and interruption handling.

Errors

Errors returned before streaming use JSON:

{"error":{"code":"invalid_request","message":"At least one input image is required."}}
StatusMeaning
400Invalid request or image
401Missing, invalid, or revoked authentication
402Subscription or credit requirement not met
404Input image not found
413Request or image limit exceeded
429Rate limit or temporary credit contention
500Unexpected application failure

When a 429 response includes Retry-After, wait that many seconds before trying again.

Need Help?

On this page