S
spritesynthDOCS

API Quick Start

Get started with the spritesynth REST API in minutes. Generate pixel art from the command line with Python, JavaScript, or Go.

The spritesynth API lets you generate pixel art, manage assets, and export for game engines — all from code. Every plan includes API access.

Authentication

All API requests require a Bearer token. Create an API key at Account → API Keys.

Authorization: Bearer sk_live_your_api_key_here

Base URL

https://spritesynth.com/api

Your First Generation

Generate a pixel art image from a text prompt:

cURL

curl -X POST https://spritesynth.com/api/generations/image \
  -H "Authorization: Bearer sk_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "prompt": "a tiny pixel art knight with sword and shield",
"width": 64,
    "height": 64
  }'

Python

import requests

response = requests.post(
    "https://spritesynth.com/api/generations/image",
    headers={
        "Authorization": "Bearer sk_live_your_api_key_here",
        "Accept": "application/json",
    },
    json={
        "prompt": "a tiny pixel art knight with sword and shield",
"width": 64,
        "height": 64,
    },
)

data = response.json()
print(f"Generation ID: {data['data']['id']}")
print(f"Status: {data['data']['status']}")

JavaScript

const response = await fetch("https://spritesynth.com/api/generations/image", {
  method: "POST",
  headers: {
    Authorization: "Bearer sk_live_your_api_key_here",
    "Content-Type": "application/json",
    Accept: "application/json",
  },
  body: JSON.stringify({
    prompt: "a tiny pixel art knight with sword and shield",
    model: "fast",
    width: 64,
    height: 64,
  }),
});

const data = await response.json();
console.log(`Generation ID: ${data.data.id}`);
console.log(`Status: ${data.data.status}`);

Go

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"io"
)

func main() {
	payload, _ := json.Marshal(map[string]interface{}{
		"prompt": "a tiny pixel art knight with sword and shield",
"width":  64,
		"height": 64,
	})

	req, _ := http.NewRequest("POST", "https://spritesynth.com/api/generations/image", bytes.NewBuffer(payload))
	req.Header.Set("Authorization", "Bearer sk_live_your_api_key_here")
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Accept", "application/json")

	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)

	fmt.Println(string(body))
}

Response

A successful generation returns:

{
  "data": {
    "id": "abc123",
    "type": "create_image",
"status": "pending",
    "prompt": "a tiny pixel art knight with sword and shield",
    "credits_cost": 1,
    "created_at": "2026-06-07T12:00:00Z"
  }
}

Polling for Results

Generations are asynchronous. Poll the status endpoint until status is completed:

curl https://spritesynth.com/api/generations/{id} \
  -H "Authorization: Bearer sk_live_your_api_key_here" \
  -H "Accept: application/json"

When complete, the response includes asset_id — download the image:

curl https://spritesynth.com/api/assets/{asset_id}/download \
  -H "Authorization: Bearer sk_live_your_api_key_here"

Available Models

ModelSpeedQualityBest for
fastFastGoodRapid iteration, prototyping
slowMediumBalancedProduction assets, general use

Error Handling

The API returns standard HTTP status codes:

CodeMeaning
200Success
201Created
401Invalid or missing API key
402Insufficient credits
422Validation error
429Rate limited

Error responses include a message field:

{
  "message": "The given data was invalid.",
  "errors": {
    "prompt": ["The prompt field is required."]
  }
}

Rate Limits

  • Free: 60 requests/minute
  • Paid: 120 requests/minute
  • Custom: Contact sales

Rate limit headers are included in every response:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1717756800

Next Steps

Was this page helpful?

On this page