Skip to main content
This reference covers all operations available for queue-based endpoints. For conceptual information and advanced options, see Send API requests.

Setup

Before running these examples, install the Runpod SDK:
Set your API key and endpoint ID as environment variables:
You can also send requests using standard HTTP libraries like fetch (JavaScript) and requests (Python).

/runsync

Synchronous jobs wait for completion and return the complete result in a single response. Best for shorter tasks, interactive applications, and simpler client code without status polling.
  • Maximum payload size: 20 MB
  • Result retention: 1 minute after completion
  • Default wait time: 90 seconds (adjustable via ?wait=x parameter, 1000-300000 ms)
The ?wait parameter controls how long the request waits for job completion, not how long results are retained.
Response:

/run

Asynchronous jobs process in the background and return immediately with a job ID. Best for longer-running tasks, operations requiring significant processing time, and managing multiple concurrent jobs.
  • Maximum payload size: 10 MB
  • Result retention: 30 minutes after completion
Response:
Retrieve results using the /status operation.

/status

Check the current state, execution statistics, and results of previously submitted jobs.
Configure time-to-live (TTL) for individual jobs by appending ?ttl=x to the request URL. For example, ?ttl=6000 sets the TTL to 6 seconds.
Replace YOUR_JOB_ID with the job ID from your /run response.
Response: Returns job status (IN_QUEUE, IN_PROGRESS, COMPLETED, FAILED) with optional output field:

/stream

Receive incremental results as they become available from jobs that generate output progressively. Best for text generation, long-running jobs where you want to show progress, and large outputs that benefit from incremental processing. Your handler must support streaming. See Streaming handlers for implementation details.
Replace YOUR_JOB_ID with the job ID from your /run response.
Maximum size for a single streamed payload chunk is 1 MB. Larger outputs are split across multiple chunks.
Response:

/cancel

Stop jobs that are no longer needed or taking too long. Stops in-progress jobs, removes queued jobs before they start, and returns immediately with the canceled status.
Replace YOUR_JOB_ID with the job ID from your /run response.
Response:

/retry

Requeue jobs that have failed or timed out without submitting a new request. Maintains the same job ID, requeues with original input parameters, and removes previous output. Only works for jobs with FAILED or TIMED_OUT status. Replace YOUR_JOB_ID with the job ID from your /run response.
Response:
Job results expire after a set period. Async jobs (/run) results are available for 30 minutes, sync jobs (/runsync) for 1 minute (up to 5 minutes with ?wait=t). Once expired, jobs cannot be retried.

/purge-queue

Remove all pending jobs from the queue. Useful for error recovery, clearing outdated requests, and resetting after configuration changes.
This operation only affects jobs waiting in the queue. Jobs already in progress continue to run.
Response:

/health

Get a quick overview of your endpoint’s operational status including worker availability and job queue status.
Response: