API Reference

One endpoint, infinite images.

Every PixelDrive plan uses the same REST API. Authenticate with a Bearer token, POST a template id plus your data, get a PNG URL back. Bulk, async, signed URLs, and an MCP server for AI agents are all here.

Base URLs

FieldTypeDescription
Render APIhttps://render.pixeldrive.pro/v1All authenticated render endpoints
Image CDNhttps://render.pixeldrive.pro/imgPublic image serving (no auth)
MCPhttps://pixeldrive.pro/mcpModel Context Protocol for AI agents
POSTAuthorization: Bearer <token>

Authentication

auth:

Create a token in your dashboard under API tokens. Send it on every request. The same token works for the REST API and the MCP server, and identifies which account is billed.

curl https://render.pixeldrive.pro/v1/render \
  -H "Authorization: Bearer pdrv_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

A missing, revoked, or expired token returns 401.

POST/v1/render

Render a single image

auth: Bearer tokencost: 1 credit (cache hits free)

Render one image synchronously. Results are cached by a content hash of the template + payload, so identical requests return instantly and cost nothing.

Request body

FieldTypeDescription
templateIdstring (uuid)The template to render. Required.
payloadobjectMap of element id → value. See below. Required.
pixelRationumberOutput scale. Default 1 (exact canvas size). Pass 2 for retina, 3 for hi-res.
previewbooleanIf true: ephemeral (~1h), not charged, not saved. For iteration.

Payload value types

Each element id maps to one value object, depending on the element:

FieldTypeDescription
{ "text": "…" }stringText, QR-code and barcode elements
{ "src": "https://…" }urlImage and SVG elements (full URL)
{ "value": 4.5 }numberNumeric fields (e.g. rating stars)

Example

curl -X POST https://render.pixeldrive.pro/v1/render \
  -H "Authorization: Bearer pdrv_..." \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "ee3a339f-2826-406c-a6e4-04b9a7b4d373",
    "payload": {
      "headline":  { "text": "500K followers" },
      "avatar":    { "src":  "https://example.com/pic.jpg" }
    },
    "pixelRatio": 1
  }'

Response

{
  "url": "https://render.pixeldrive.pro/img/t/<templateId>/<hash>.png",
  "fromCache": false,            // false | "redis" | "db"
  "fieldsHash": "a1b2c3d4e5f6g7h8",
  "renderMs": 620,
  "uploadBytes": 254714,
  "creditsRemaining": 9999
}
POST/v1/render/batch

Bulk render (async)

auth: Bearer tokencost: 1 credit per non-cached image

Queue up to 1,000 renders against one template and get a batch id back immediately. Poll /v1/batches/:id or stream /stream for results. This is the right tool for generating hundreds of images — it never blocks a connection.

Request body

FieldTypeDescription
templateIdstring (uuid)Template to render against.
payloadsobject[]Array of 1–1000 payload objects (same shape as /v1/render).
userIdstring (uuid)Account to bill; must own the template.
curl -X POST https://render.pixeldrive.pro/v1/render/batch \
  -H "Authorization: Bearer pdrv_..." \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "ee3a339f-...",
    "payloads": [
      { "name": { "text": "Alice" } },
      { "name": { "text": "Bob" } }
    ],
    "userId": "660e8400-..."
  }'

// 202 Accepted
{ "batchId": "770e8400-...", "count": 2, "jobIds": ["…","…"] }
GET/v1/batches/:id

Batch status (polling)

auth: Bearer token

Counts plus a per-job results array.

{
  "batchId": "770e8400-...",
  "total": 2, "queued": 0, "running": 1, "completed": 1, "failed": 0,
  "results": [
    { "id": "…", "status": "completed",
      "result": { "imageUrl": "https://render.pixeldrive.pro/img/…", "contentType": "image/png", "fromCache": false },
      "failedReason": null },
    { "id": "…", "status": "running", "result": null, "failedReason": null }
  ]
}
GET/v1/batches/:id/stream

Batch status (live stream)

auth: Bearer token

Server-Sent Events. Emits a progress event whenever counts change, then a done event with the full results. Closes automatically when finished (max 30 min).

event: progress
data: {"total":2,"completed":1,"failed":0,"running":1,"queued":0}

event: done
data: {"results":[ … ]}
GET/v1/jobs/:id

Single job status

auth: Bearer token

Status of one job from a batch (ids come from the batch response's jobIds).

{
  "id": "job-uuid",
  "status": "completed",         // waiting | active | completed | failed | delayed
  "progress": 100,
  "result": { "imageUrl": "https://render.pixeldrive.pro/img/…", "contentType": "image/png" },
  "failedReason": null,
  "attemptsMade": 1
}
GET/img/t/:templateId/:hash.png

Serve a rendered image

auth: none — publiccost: free

Public, content-addressed, cached for a year (immutable). These are the URLs returned by every render. Drop them straight into an <img>, an email, or a CDN.

GET https://render.pixeldrive.pro/img/t/ee3a339f-.../a1b2c3d4e5f6g7h8.png
→ 200, Content-Type: image/png, Cache-Control: public, max-age=31536000, immutable
POST/v1/sign

Signed image URL

auth: Bearer token

Issue a short-lived signed URL for an image (for private/expiring links).

FieldTypeDescription
keystringImage key, e.g. t/<id>/<hash>.png. (or pass url)
urlstringA full image URL instead of a key.
expiresInnumberSeconds until expiry. 60–604800, default 3600.
curl -X POST https://render.pixeldrive.pro/v1/sign \
  -H "Authorization: Bearer pdrv_..." \
  -d '{ "url": "https://render.pixeldrive.pro/img/t/…/….png", "expiresIn": 7200 }'

{ "url": "https://…signed…", "key": "t/…/….png", "expiresIn": 7200 }
POSThttps://pixeldrive.pro/mcp

MCP server (for AI agents)

auth: Bearer tokencost: preview free · generate 1 credit

A Model Context Protocol endpoint so AI assistants can generate images directly. Authenticate with the same Bearer API token. Two tools:

FieldTypeDescription
preview_imagefreeEphemeral preview, returns an inline image for the model to see. No credit. For iterating.
generate_image1 creditFinal, saved render. Returns the permanent URL + credits remaining.

Both take { templateId, payload } with the same payload shape as the REST API. Point your MCP client at https://pixeldrive.pro/mcp with header Authorization: Bearer pdrv_….

Credits, limits & errors

FieldTypeDescription
1 creditper renderEach non-cached render. Refunded on failure.
0 creditscache hitsIdentical template+payload returns instantly, free.
0 creditspreviewspreview:true and the MCP preview_image tool.
0 creditsimage servingGET /img/… is always free.
60 / minpreview ratePer user, for preview renders (429 when exceeded).
1000batch maxPayloads per /v1/render/batch call.

Status codes

FieldTypeDescription
200 / 202okSuccess (202 for accepted batches).
400bad requestInvalid body / payload (Zod validation).
401unauthorizedMissing / revoked / expired token.
402no creditsInsufficient credit balance. Top up on Billing.
404not foundUnknown template / image / job.
429rate limitedPreview rate limit exceeded.

Manage tokens in API tokens · upgrade for more credits on Billing · see plans on Pricing.