---
title: "Generate a sprite"
method: POST
path: "/api/sprites"
tags: ["Sprites"]
---

# Generate a sprite

`POST /api/sprites`

## Request

- Base URL: `https://www.sprite-ai.art`
- URL: `https://www.sprite-ai.art/api/sprites`
- Auth: HTTP bearer

Generate a still pixel art sprite from a text prompt. Synchronous: the PNG comes back inline as base64 in image.pngBase64. Costs 1 token.

## Request body

- object
  - `prompt` string, required
  - `width` integer
  - `height` integer
  - `asset_type` 'character' | 'creature' | 'prop' | 'weapon' | 'vehicle' | 'tile' | 'background' | 'ui' | 'effect' | 'item'
  - `direction` 'none' | 'south' | 'south-west' | 'west' | 'north-west' | 'north' | 'north-east' | 'east' | 'south-east'
  - `camera_perspective` 'none' | 'front' | 'side' | 'top_down' | 'three_quarter' | 'isometric'
  - `public` boolean
  - `reference_asset_id` string, uuid
  - `palette_id` string, uuid

## Response `201`

The generated sprite, with the PNG inline.

- object

## Other responses

- `400`: The request failed validation.
- `401`: Missing or invalid API key.
- `402`: Not enough tokens.
- `403`: The API key is revoked or expired.
- `404`: Not found, or not yours.
- `429`: Rate limited. Retry after the Retry-After header.
- `500`: Generation failed. Tokens are refunded.

---

[API](https://skmtc.dev/sprite-ai/apis/sprite-ai-api.md) · [All operations](https://skmtc.dev/sprite-ai/apis/sprite-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/sprite-ai/apis/sprite-ai-api/revisions/2c1231b72433?raw)
