API & MCP
REST API
PixelZ REST API reference: authentication, endpoints, jobs, errors and limits for image generation, pixelize, background removal, effects and animation.
The REST API runs the same tools as the MCP server, for scripts, build pipelines and your own apps. It is available on paid plans and uses your plan's credits.
Authentication
Create a key in Settings → API & MCP and send it as a bearer token with every request:
Authorization: Bearer pz_…Base URL: https://api.pixelz.io. Requests and responses are JSON.
Quick start
Turn an image into pixel art:
curl https://api.pixelz.io/v1/pixelize \
-H "Authorization: Bearer $PIXELZ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image": "https://example.com/knight.png", "colors": 16, "remove_background": true}'Every tool answers with a job. Download the file from the url of its output:
{
"id": "k57f3d9x2c8a1b0e4r6t7y8u9i0o",
"tool": "pixelize",
"status": "done",
"credits": 0,
"outputs": [
{ "kind": "image", "url": "https://…/api/storage/…", "width": 32, "height": 32 }
]
}Endpoints
| Endpoint | Does | Credits |
|---|---|---|
POST /v1/images | Pixel art from a prompt | fast 2, standard 4, pro 8 |
POST /v1/pixelize | An image snapped to its pixel grid | free |
POST /v1/remove-background | A transparent background | free |
POST /v1/effects | An animated pixel effect from a description | about 4 |
POST /v1/animations | A sprite, animated | 8 |
GET /v1/jobs/{id} | A job's status and result | free |
POST /v1/uploads | An upload for a local file | free |
GET /v1/credits | Credits left this month | free |
POST /v1/images
| Field | Type | Notes |
|---|---|---|
prompt | string | Required, 3–2000 characters. What to draw. |
size | 16 | 32 | 64 | 128 | 256 | 512 | Longer side in pixels. Default 64. |
aspect_ratio | "1:1" | "16:9" | "9:16" | Default "1:1". |
transparent_background | boolean | Cut the subject out. Default true. |
colors | "auto" | 2–64 | Palette size. Default "auto". |
engine | "gemini" | "gpt" | The image model family. Default "gemini". |
quality | "fast" | "standard" | "pro" | Default "standard". Credits: fast 2, standard 4, pro 8. |
reference_image | string | Optional. An image to follow for style or subject. |
curl https://api.pixelz.io/v1/images \
-H "Authorization: Bearer $PIXELZ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "a knight with a blue cape, idle pose, side view", "size": 64}'Answers 202 with a running job; it usually finishes within two minutes. The image is also saved to your Assets.
POST /v1/pixelize
| Field | Type | Notes |
|---|---|---|
image | string | Required. An https URL, an upload id or base64 data. |
colors | "auto" | 2–64 | Palette size. Default "auto". |
remove_background | boolean | Also make the background transparent. Default false. |
save_to_assets | boolean | Also keep the result in your PixelZ Assets. Default false. |
POST /v1/remove-background
| Field | Type | Notes |
|---|---|---|
image | string | Required. An https URL, an upload id or base64 data. |
save_to_assets | boolean | Also keep the result in your PixelZ Assets. Default false. |
POST /v1/effects
| Field | Type | Notes |
|---|---|---|
description | string | Required, 3–400 characters. What happens and how it moves. |
width | 16–96 | Canvas width in pixels. Optional. |
height | 16–96 | Canvas height in pixels. Optional. |
Takes up to a minute. The job has two outputs, a horizontal strip PNG and a looping gif; frames describes the strip.
POST /v1/animations
| Field | Type | Notes |
|---|---|---|
image | string | Required. The sprite, at most 256×256. |
motion | string | Required, 3–300 characters, e.g. "walking to the right, arms swinging". |
frames | 4 | 6 | 8 | Frames in the loop. Default 6. |
curl https://api.pixelz.io/v1/animations \
-H "Authorization: Bearer $PIXELZ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image": "https://example.com/knight-32.png", "motion": "walking to the right", "frames": 6}'Answers 202 with a running job; it takes 1–3 minutes. The output is a strip, and frames describes it.
Jobs
Pixelize, remove-background and effects answer with the finished job. Images and animations answer with a job that is still running: poll it every 10 seconds or so until its status is done or failed.
curl https://api.pixelz.io/v1/jobs/<id> -H "Authorization: Bearer $PIXELZ_API_KEY"| Field | Notes |
|---|---|
id | The job's id. |
tool | generation, pixelize, removeBackground, effect or animation. |
status | running, done or failed. |
credits | What the job cost. 0 while it runs, and when it failed and was refunded. |
outputs | The files: kind (image, strip or gif), url, width, height. |
frames | For a strip: frameWidth, frameHeight, frameCount, and for effects fps and loop. |
error | Why the job failed. |
saved | true when the result was also saved to your Assets. |
Images
- PNG or JPEG, as a public https URL, an upload id or base64 data (a data URL works too).
- Up to 2 MB and 1024×1024 pixels. Interlaced PNGs are not accepted.
Uploading a file
To send a file from disk, open an upload, send the file to the address you get, and pass the returned id as image:
curl -X POST https://api.pixelz.io/v1/uploads -H "Authorization: Bearer $PIXELZ_API_KEY"
# { "image": "upload:k9…", "upload_url": "https://api.pixelz.io/v1/uploads/3f9c…", "expires_in_minutes": 60 }
curl -T knight.png "https://api.pixelz.io/v1/uploads/3f9c…"
# { "image": "upload:k9…", "width": 256, "height": 256 }
curl https://api.pixelz.io/v1/remove-background \
-H "Authorization: Bearer $PIXELZ_API_KEY" -H "Content-Type: application/json" \
-d '{"image": "upload:k9…"}'The address takes one file and needs no key, so keep it private. An upload lasts 60 minutes and only your account can use it.
Errors
A failed request answers with a status and a message:
{ "error": "Use a public https URL for the image" }| Status | Meaning |
|---|---|
| 400 | The body is not valid JSON, or a field is missing or out of range. |
| 401 | No key, or a key that is unknown or revoked. |
| 402 | Not enough credits left this month. |
| 403 | The account is not on a paid plan. |
| 404 | No such job or upload address. |
| 409 | The upload address was already used. |
| 413 | The uploaded file is larger than 2 MB. |
| 422 | The image was refused or the tool failed. The message says why. |
| 429 | Too many requests, or too many running at once. Wait and retry. |
Credits and limits
- Prices are the same as in the app. A request that fails is refunded.
- An effect is billed by what the model used, about 4 credits. You need 14 available to start one.
- 60 requests a minute per account across all keys, in bursts of up to 20.
- 4 requests and 10 jobs running at once, 1000 calls of the free tools a day, 100 uploads open at once.
- Jobs and their files are deleted after 30 days. Generated images, animations and results sent with
save_to_assetsstay in your Assets until you delete them.
Working with an AI agent? The MCP server offers the same tools with the same key.