HTTP API reference
Routes, capabilities, and operation parameters exposed by @queuebert/nest.
Base path and queue keys#
Routes below are relative to /admin/queue, or your configured path plus any Nest global prefix. Replace :queue with the registered queue's statsKey (the queue name by default), URL-encoded as a path segment. All routes inherit your configured auth guards and decorators.
This reference covers the library's current 0.0.1 controller, not additional endpoints your application may implement.
Monitoring#
| Method | Route | Capability | Description |
|---|---|---|---|
| GET | /stats | Always enabled | Statistics for all registered queues and available capabilities. |
| GET | /:queue/stats | Always enabled | One queue's statistics, plus Redis stats unless disabled. |
| GET | /:queue/metrics | metrics | Detailed queue counts and processor metrics when available. |
curl --fail \
-H "Authorization: Bearer $QUEUEBERT_TOKEN" \
http://localhost:3000/admin/queue/emails/statsProcessor duration and throughput are in-process measurements, not a persisted history of all workers. Retained failed/completed counts come from BullMQ and depend on retention settings. Job-type discovery uses sampling above its configured threshold.
Queue controls#
These routes are disabled by default. Enabling them can change processing or delete data; confirm the environment and target queue before sending requests.
| Method | Route | Capability | Effect |
|---|---|---|---|
| POST | /pause | pause | Pause all configured queues. |
| POST | /resume | resume | Resume all configured queues. |
| POST | /:queue/pause | pause | Pause one queue. |
| POST | /:queue/resume | resume | Resume one queue. |
| POST | /:queue/clean | clean | Remove old completed and failed jobs. |
| POST | /:queue/drain | drain | Remove waiting jobs. |
clean accepts query parameters grace (non-negative milliseconds, default 300000) and limit (positive integer, default 10000, applied separately to completed and failed jobs). Parameters are passed in the query string, not a JSON request body. These are destructive actions, not a way to retry failed jobs or reset in-process processor statistics.
Pause notes (next release)#
Check capabilities.canPauseWithReason before offering note controls. When true,
both pause routes accept an optional JSON body:
{ "reason": "Deploying API v2.3; waiting for health checks" }The reason is trimmed and limited to 200 UTF-16 code units (JavaScript string
length). Reposting pause updates the note without resuming; a bare POST clears
the note. Queue stats include pause: { reason?, pausedAt?, source } only while
paused. Resume clears the saved note. Redis keys follow the queue's configured
prefix and connection, including when statsKey differs from the queue name.
workerPauses[] contains live worker-local notes with workerId, reason,
pausedAt, and source: "worker". These do not change the queue-wide paused
flag: other workers may still process jobs. Worker notes disappear on resume or
close, or after 90 seconds without a heartbeat. They are not a durable audit log
or a request to pause a restarted worker. Avoid secrets in operational notes.
Automatic resume is not supported in this release: canPauseUntil is false,
and a request containing until is rejected rather than silently ignored.
Older servers without canPauseWithReason should receive a bare pause request.
Queue migrations#
All migration routes require the migrations capability. See the migration guide before starting a migration.
| Method | Route | Purpose |
|---|---|---|
| GET | /migrations/queues | Discover queues available for migration. |
| GET | /migrations | List tracked migrations. |
| GET | /migrations/preview | Preview a source and target migration. |
| GET | /migrations/:migrationId | Inspect progress. |
| POST | /migrations/start | Start in the background and return an ID. |
| POST | /migrations/execute | Execute and wait for a result. |
| POST | /migrations/:migrationId/pause | Pause the migration. |
| POST | /migrations/:migrationId/resume | Resume the migration. |
| POST | /migrations/:migrationId/cancel | Cancel the migration. |
Start and execute take query parameters: required sourceQueue and targetQueue (actual BullMQ names, not statsKey), plus optional sourceRedis, targetRedis, jobType, states, limit, batchSize, and delayMs. states is a comma-separated list; waiting and delayed are the defaults, failed is an explicit opt-in. Use registered Redis IDs when selecting between deployments.
Cache migrations#
Managed caches come from processors' getCacheConfigs(). All of these routes also require migrations:
| Method | Route | Purpose |
|---|---|---|
| GET | /cache/list | List registered managed caches. |
| GET | /cache/migrations | List cache migrations. |
| GET | /cache/migrations/preview | Preview a cache migration. |
| GET | /cache/migrations/:migrationId | Inspect progress. |
| POST | /cache/migrations/start | Start a cache migration. |
| POST | /cache/migrations/:migrationId/pause | Pause a cache migration. |
| POST | /cache/migrations/:migrationId/resume | Resume a cache migration. |
| POST | /cache/migrations/:migrationId/cancel | Cancel a cache migration. |
Troubleshooting#
- 401: Your application's guard rejected or did not receive the credentials.
- 403: Check application authorization; your guard may forbid an authenticated user from acting.
- 404: Check the controller path, global prefix, queue
statsKey, migration ID, andendpointsallowlist. Disabled capabilities return 404. Expired or process-local migration records may no longer exist. - Missing duration metrics: Register an instrumented processor provider and associate it with the queue. Counts alone do not imply processor instrumentation.
- Browser requests fail but curl works: Check CORS, HTTPS/mixed content, and the browser's access to the API host.