Introduction
The Pixel Engine API gives you programmatic access to pixel engine. Submit an image and a prompt, poll until the job finishes, and download the result. This page covers everything you need to make your first request.
Base URL
https://api.pixelengine.ai/functions/v1All requests and responses use application/json. All endpoints support CORS.
Authentication
Every request must include an API key as a Bearer token in the Authorization header:
Authorization: Bearer pe_sk_...Creating an API key
API keys are managed in your account under Account → API.
- Sign in and go to Account → API.
- Click Add key and optionally give it a name.
- Copy the full key immediately — it is only shown once.
pe_sk_ab12cd34…) is saved for identification. If you lose your key, delete it and create a new one.You can hold up to 10 keys per account. Keys can be renamed, deactivated (paused without deletion), or permanently deleted. A deactivated key returns 401 unauthorized on every request until it is reactivated.
Credits
Pixel Engine uses a credit system. Your available balance is the sum of two pools:
| Pool | Description |
|---|---|
| Monthly credits | Refreshed on your billing date. Approximately 200 credits = $1. |
| Purchased credits | Bought explicitly. Approximately 100 credits = $1. |
Monthly credits are spent first. Purchased credits are only drawn down once your monthly pool is exhausted.
Before a job runs, a hold is placed on the required credits for up to 10 minutes. If the job fails, the hold is released and no credits are consumed. Credits are only deducted on a successful generation.
Endpoint costs
| Endpoint | Cost |
|---|---|
POST /animate | 20 credits |
GET /balance | Free |
GET /jobs | Free |
Check your current balance at any time with GET /balance.
Errors
All error responses share this shape, regardless of endpoint:
{
"error": {
"code": "string",
"message": "string"
}
}code is a stable, machine-readable string — safe to match in application code. message is human-readable and safe to surface to users.
Common error codes
| HTTP | Code | When |
|---|---|---|
| 401 | unauthorized | Missing, malformed, or inactive API key. |
| 402 | insufficient_credits | Not enough available credits to cover the job. |
| 500 | internal_error | Server-side failure. |
Endpoint-specific errors are documented on the API Reference page.
Polling
POST /animate returns a job ID immediately — generation runs asynchronously in the background. Use GET /jobs to wait for the result.
Recommended pattern
- Submit with
POST /animate. Save the returnedapi_job_id. - Call
GET /jobs?id=<api_job_id>every 3–5 seconds whilestatusis"queued"or"pending". - Stop polling when
statusis"success"or"failure". On success,output.urlcontains a signed download link.
Typical generation time is ~90 seconds.
# 1. Submit a job
curl -X POST https://api.pixelengine.ai/functions/v1/animate \
-H "Authorization: Bearer pe_sk_..." \
-H "Content-Type: application/json" \
-d '{
"image": "<base64-encoded PNG>",
"prompt": "a character walking left"
}'
# → { "api_job_id": "f47ac10b-...", "status": "queued", "error": null }
# 2. Poll every 3–5 seconds until status is "success" or "failure"
curl "https://api.pixelengine.ai/functions/v1/jobs?id=f47ac10b-..." \
-H "Authorization: Bearer pe_sk_..."
# → on success: output.url holds a signed download link (valid 1 hour)See also
The API Reference contains the full specification for every endpoint: request bodies, all accepted fields and their types, response shapes, status values, metadata formats, and the complete list of error codes per endpoint.