Skip to main content
Back

API Documentation

Comprehensive guides and code examples for the PixelDojo agent-first image and video API

LLM.txt

NEW

For AI assistants

Copy our docs into Claude, GPT, or any AI for instant integration help.

OpenAPI Spec

Swagger compatible

Import into Postman, Swagger UI, or any OpenAPI tool.

Base URL

API endpoint

https://pixeldojo.ai/api/v1

Getting Started

Everything you need to start using the PixelDojo API

The PixelDojo API allows agents and applications to access our AI image and video generation capabilities programmatically. To use the API, you'll need:

  • An API key (create one in the API Keys section)
  • Credits for generation (per-image for image models, per-second for video models)
  • Review model-specific parameters in API Platform or fetch /api/v1/models/{apiId}/schema

API access does not require an active subscription. Signed-in users can create keys and purchase credits directly.

Base URL

https://pixeldojo.ai/api/v1

TypeScript SDK

Typed client for Node.js, Deno, Bun, and any JavaScript runtime

Install
npm install @pixeldojo/sdk
Usage
import { PixelDojoClient } from "@pixeldojo/sdk";

const pd = new PixelDojoClient({ apiKey: "pd_your_api_key" });

// Submit + poll until complete
const job = await pd.generate("flux-1.1-pro", {
  prompt: "A fantasy castle on a cliff at sunset",
  aspect_ratio: "16:9",
});

console.log(job.assets[0].url);
MethodDescription
listModels()List all available models
getModel(apiId)Get model details + schema
getModelSchema(apiId)Get JSON schema for request body
run(apiId, input)Submit a job (returns immediately)
generate(apiId, input)Submit + poll until complete
getJob(jobId)Poll job status and get output
listJobs()List recent jobs
replayWebhook(jobId)Replay webhook for terminal jobs

@pixeldojo/sdk on npm · Zero runtime dependencies · ESM + CJS · Full TypeScript types

Authentication

How to authenticate your API requests

All API requests must include your API key in the request headers.

API keys are available to signed-in users and work with prepaid credits. You do not need an active subscription to use the API.

Request Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Security Best Practices

  • Never expose your API key in client-side code
  • Rotate your API keys periodically
  • Use environment variables to store your API keys
  • Set appropriate CORS policies on your server

Rate Limits

Understanding API usage limits

To ensure fair usage and system stability, the PixelDojo API has the following rate limits:

PlanRate LimitNotes
Standard60 requests per minuteShared across all API endpoints
Rate Limit Headers
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1619284800

Error Handling

Understanding API error responses

The API uses standard HTTP status codes to indicate the success or failure of requests.

CodeStatusDescription
unauthorized401Missing or invalid API key
invalid_json400Invalid JSON in request body
validation_error400Input validation failed
not_found404Model or job not found
insufficient_credits402Insufficient credits
credit_error500Failed to deduct credits
submission_failed500Failed to submit job
expired410Job has expired
rate_limit_exceeded429Rate limit exceeded
internal_error500Internal server error
Example Error Response
{
  "error": {
    "code": "insufficient_credits",
    "message": "Your account has insufficient credits",
    "status": 403
  }
}

Featured Models

Live model list from the API

0 models
Loading models...

Generation Jobs API

Submit async jobs for image and video models

POST
/api/v1/models/{apiId}/run

Description

Submit an async generation job for a specific model. Credit costs vary by model (per-image for images, per-second for video).

Request Parameters

ParameterTypeRequiredDescription
promptstring
Yes
The text prompt for generation
image_urlstringNoOptional image URL for image-conditioned or image-to-video models
aspect_ratiostringNoAspect ratio (varies by model)
durationnumberNoVideo duration in seconds (video models only)
num_outputsintegerNoNumber of outputs to generate (varies by model)
seedintegerNoRandom seed for reproducibility
webhook_urlstringNoWebhook URL for job completion callbacks

Model-specific parameters vary. See /api/v1/models/{apiId}, /api/v1/models/{apiId}/schema, or the model detail page for the full schema.

Example Requests

# Submit a job
curl -X POST "https://pixeldojo.ai/api/v1/models/flux-1.1-pro/run" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "A sunset", "aspect_ratio": "1:1", "webhook_url": "https://example.com/webhook"}'

# Poll for results
curl "https://pixeldojo.ai/api/v1/jobs/job_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY"

# List recent jobs
curl "https://pixeldojo.ai/api/v1/jobs?limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Replay a terminal webhook
curl -X POST "https://pixeldojo.ai/api/v1/jobs/job_abc123/webhook" \
  -H "Authorization: Bearer YOUR_API_KEY"

Submit Response

{
  "jobId": "job_abc123",
  "status": "pending",
  "statusUrl": "https://pixeldojo.ai/api/v1/jobs/job_abc123",
  "creditCost": 1,
  "creditsRemaining": 99,
  "expiresAt": "2025-01-23T12:00:00Z"
}

Completed Response

{
  "jobId": "job_abc123",
  "status": "completed",
  "output": {
    "images": [
      "https://temp.pixeldojo.ai/pixeldojotemp/1686432789123-abc123-0.png"
    ]
  },
  "creditCost": 1,
  "expiresAt": "2025-01-23T12:00:00Z"
}

Poll for Results

GET
/api/v1/jobs/{jobId}

Poll the status URL until the job is completed or failed. Status values include pending, processing, completed, and failed.

Control Plane Routes

RoutePurpose
GET /api/v1/jobsList recent jobs for the authenticated API key owner
GET /api/v1/jobs/{jobId}Full job state including assets and webhook delivery info
GET /api/v1/jobs/{jobId}/webhookInspect webhook configuration and delivery attempts
POST /api/v1/jobs/{jobId}/webhookReplay the terminal webhook for completed or failed jobs

Image Storage Policy

Generated images are stored temporarily on our servers for 24 hours. Download and save images you wish to keep, as they will be automatically deleted after this period.

Best Practices

Tips for effective API usage

Write Detailed Prompts

Be specific about style, lighting, composition, and details for best results.

Choose the Right Model

Use qwen-image for text in images, wan-image for fast generation, and flux-1.1-pro-ultra for highest quality.

Handle Errors Gracefully

Implement proper error handling and retry logic with exponential backoff.

Use Seeds for Reproducibility

Set a seed value when you need to reproduce the same image results.

AI Agent Discovery

Machine-readable endpoints for AI agents and LLMs

Quick Reference

Endpoint

POST https://pixeldojo.ai/api/v1/models/{apiId}/run

Poll: GET https://pixeldojo.ai/api/v1/jobs/{jobId}

Authentication

Authorization: Bearer YOUR_API_KEY

Required Parameters

prompt

Credit Cost

Varies by model (per-image or per-second)