Docs / Serverless

Send requests

Every endpoint has its own runtime URL, https://run.apipods.com/v1/{endpointId}. Submit jobs asynchronously with /run or wait for the result with /runsync, then use the job ID to check status, stream, cancel or retry.

Operations

MethodPathPurpose
POST/runQueue a job and return its ID immediately.
POST/runsyncQueue a job and wait up to 90 s for the result.
GET/status/{jobId}Get the job's status and output.
GET/stream/{jobId}Get partial outputs from a generator handler.
POST/cancel/{jobId}Cancel a queued or running job.
POST/retry/{jobId}Re-queue a FAILED, TIMED_OUT or CANCELLED job.
POST/purge-queueRemove all IN_QUEUE jobs.
GET/healthQueue and worker counts.

All routes authenticate with Authorization: Bearer $APIPODS_API_KEY. Submitting, cancelling and retrying require a READ_WRITE key; /status, /stream and /health work with READ. Full schemas are in the Jobs API reference.

Asynchronous: /run

curl -X POST https://run.apipods.com/v1/ep_4n8wq2zt/run \
  -H "Authorization: Bearer $APIPODS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "prompt": "a lighthouse on a cliff at dusk, 35mm photo",
      "steps": 4
    }
  }'
200 OK
{
  "id": "job_3x9wq2mt",
  "status": "IN_QUEUE"
}

Results of /run jobs are kept for 30 minutes after the job finishes. Use webhooks if you would rather not poll.

Synchronous: /runsync

/runsync holds the connection for up to 90 seconds. If the job finishes in time you get the complete job object. If not, you get the job in its current state (IN_QUEUE or IN_PROGRESS) and continue with /status.

curl -X POST https://run.apipods.com/v1/ep_4n8wq2zt/runsync \
  -H "Authorization: Bearer $APIPODS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "prompt": "a lighthouse on a cliff at dusk, 35mm photo",
      "steps": 4
    }
  }'
200 OK
{
  "id": "job_3x9wq2mt",
  "status": "COMPLETED",
  "delayTime": 812,
  "executionTime": 1934,
  "workerId": "wrk_8q3m2x9k",
  "output": {
    "imageUrl": "https://s3.eu-nl-1.apipods.com/vol_c7d2h4ke/outputs/job_3x9wq2mt.png",
    "seed": 1730299
  },
  "createdAt": "2026-11-18T10:02:13Z",
  "completedAt": "2026-11-18T10:02:16Z"
}
Note: /runsync results are kept for only 60 seconds, and its input limit is 20 MB versus 10 MB for /run. Use /run for anything that may take longer than a minute.

Check status: /status

curl https://run.apipods.com/v1/ep_4n8wq2zt/status/job_3x9wq2mt \
  -H "Authorization: Bearer $APIPODS_API_KEY"

Poll every 1 to 2 seconds for short jobs and back off for long ones. delayTime and executionTime are in milliseconds. See Job states for every status.

Cancel and retry

curl -X POST https://run.apipods.com/v1/ep_4n8wq2zt/cancel/job_3x9wq2mt \
  -H "Authorization: Bearer $APIPODS_API_KEY"

curl -X POST https://run.apipods.com/v1/ep_4n8wq2zt/retry/job_7k2m4p8d \
  -H "Authorization: Bearer $APIPODS_API_KEY"

Cancelling a queued job removes it from the queue. Cancelling a running job stops the handler on its worker; the worker stays up for the next job. Retrying keeps the same job ID and input and puts the job back in the queue with status IN_QUEUE. Only FAILED, TIMED_OUT and CANCELLED jobs can be retried, and only while their result is still retained.

Health and purge

curl https://run.apipods.com/v1/ep_4n8wq2zt/health \
  -H "Authorization: Bearer $APIPODS_API_KEY"
200 OK
{
  "jobs": {
    "inQueue": 3,
    "inProgress": 4,
    "completed": 18342,
    "failed": 12,
    "retried": 5
  },
  "workers": {
    "initializing": 1,
    "idle": 0,
    "running": 4,
    "throttled": 0,
    "unhealthy": 0
  }
}

Per-job policy

Override endpoint defaults for a single job with policy:

Request body
{
  "input": {
    "prompt": "a lighthouse on a cliff at dusk, 35mm photo",
    "steps": 4
  },
  "webhook": "https://api.example.com/hooks/apipods",
  "policy": {
    "executionTimeoutInSec": 120,
    "ttlInSec": 3600,
    "lowPriority": true
  }
}
FieldDescription
executionTimeoutInSecOverrides the endpoint's execution timeout for this job (max 86400).
ttlInSecHow long the job may wait in the queue. Default 86400.
lowPriorityOnly run the job when no normal-priority job is waiting. Low-priority jobs never trigger scale-up.