HTTP API: DLQ, Cron & Webhooks
Inspect and replay dead letters, schedule recurring crons, and manage webhooks
All 14 endpoints for Dead Letter Queues (6), Cron schedulers (4), and Webhooks (4). See HTTP API Overview for auth and error envelopes.
Dead Letter Queue (DLQ)
Section titled “Dead Letter Queue (DLQ)”Each queue has a DLQ holding jobs that exhausted maxAttempts, failed with unrecoverable: true, exceeded maxStalls, or were discarded.
List DLQ Entries
Section titled “List DLQ Entries”GET /queues/:queue/dlq[?limit=100&offset=0] (omit both for all entries; returns DlqEntry[] and total):
{ "ok": true, "entries": [ { "job": { "id": "...", "data": {}, "attempts": 3 }, "enteredAt": 1700000000000, "reason": "max_attempts_exceeded", "error": "SMTP timeout", "attempts": [{ "attempt": 1, "startedAt": 1700000000000, "failedAt": 1700000001000, "reason": "explicit_fail", "error": "SMTP timeout", "duration": 1000 }], "retryCount": 0 } ], "total": 1}DLQ Statistics
Section titled “DLQ Statistics”GET /queues/:queue/dlq/stats
{ "ok": true, "stats": { "total": 12, "byReason": { "explicit_fail": 4, "max_attempts_exceeded": 6, "timeout": 1, "stalled": 1, "ttl_expired": 0, "worker_lost": 0, "unknown": 0 }, "byQueue": { "emails": 12 }, "pendingRetry": 0, "expired": 0, "oldestEntry": 1700000000000, "newestEntry": 1700003600000 }}Retry & Purge DLQ
Section titled “Retry & Purge DLQ”| Method | Path | Body | Response & Event |
|---|---|---|---|
POST | /queues/:queue/dlq/retry | { "jobId"?: "..." } | Re-queues one entry (or all when jobId omitted) and resets attempts. Returns { "ok": true, "count": N }. Broadcasts dlq:retried / dlq:retry-all. |
POST | /queues/:queue/dlq/purge | none | Permanently deletes all DLQ entries for :queue. Returns { "ok": true, "count": N }. Broadcasts dlq:purged. |
curl -X POST http://localhost:6790/queues/emails/dlq/retry \ -H "Content-Type: application/json" -d '{"jobId": "019ce9d7-..."}'curl -X POST http://localhost:6790/queues/emails/dlq/purgeDLQ Configuration
Section titled “DLQ Configuration”GET /queues/:queue/dlq-config · PUT /queues/:queue/dlq-config
curl -X PUT http://localhost:6790/queues/emails/dlq-config \ -H "Content-Type: application/json" \ -d '{"config": {"autoRetry": true, "autoRetryInterval": 3600000, "maxAutoRetries": 3, "maxAge": 604800000, "maxEntries": 10000}}'| Field | Default | Description |
|---|---|---|
autoRetry | false | Auto-retry eligible DLQ entries after autoRetryInterval. |
autoRetryInterval | 3600000 | Auto-retry delay in ms (1 hour). |
maxAutoRetries | 3 | Max automatic retries per entry. |
maxAge | 604800000 | Max entry age in ms (7 days; null disables expiry). |
maxEntries | 10000 | Max DLQ entries per queue; oldest evicted when full. |
Broadcasts config:dlq-changed.
Cron Schedulers
Section titled “Cron Schedulers”| Method | Path | Description |
|---|---|---|
GET | /crons | List all cron jobs ({ "ok": true, "crons": [...] }). |
POST | /crons | Create or update a cron job (reusing name updates it). Broadcasts cron:created or cron:updated. |
GET | /crons/:name | Get a single cron job (404 if not found). |
DELETE | /crons/:name | Delete a cron job (404 if not found). Broadcasts cron:deleted. |
curl -X POST http://localhost:6790/crons -H "Content-Type: application/json" \ -d '{"name": "daily-cleanup", "queue": "maintenance", "data": {"task": "cleanup-stale-sessions"}, "schedule": "0 2 * * *", "timezone": "America/New_York"}'POST /crons request body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique cron name; existing names are updated in place. |
queue | string | Yes | Target queue name. |
data | any | Yes | Payload pushed on every tick. |
schedule | string | * | Cron expression ("*/5 * * * *"). Takes precedence if both schedule and repeatEvery are valid. |
repeatEvery | number | * | Positive safe-integer interval in ms (alternative to schedule). |
jobName | string | No | Generated job name (default "default"). |
timezone | string | No | IANA timezone (defaults to server/system timezone on raw HTTP). |
priority | number | No | Priority for generated jobs. |
maxLimit | number | No | Max total executions before auto-removal. |
immediately | boolean | No | Fire once immediately upon creation (default false). |
skipIfNoWorker | boolean | No | Skip tick if no worker is registered on queue (default false). |
preventOverlap | boolean | No | Skip tick while the previous generated job is still pending or active (default true). |
uniqueKey | string | No | Deduplication key for generated jobs. |
dedup | object | No | { ttl?, extend?, replace? } (ttl must be finite). |
skipMissedOnRestart | boolean | No | Skip ticks missed during downtime (default true). |
jobOptions | object | No | Per-job options: maxAttempts, backoff, timeout, delay, stallTimeout, removeOnComplete, removeOnFail. |
* At least one of schedule or repeatEvery is required.
Webhooks
Section titled “Webhooks”HTTP callbacks triggered on job events. Failed deliveries retry up to 3 total attempts (WEBHOOK_MAX_RETRIES) with linear backoff (WEBHOOK_RETRY_DELAY_MS * attempt, default 1s then 2s).
| Method | Path | Body | Response & Event |
|---|---|---|---|
GET | /webhooks | none | Lists all registered webhooks. |
POST | /webhooks | { "url", "events", "queue"?, "secret"? } | Registers a webhook and returns { "ok": true, "data": { "webhookId", "url", "events", "queue", "createdAt" } }. Broadcasts webhook:added. |
DELETE | /webhooks/:id | none | Deletes a webhook (404 if missing). Broadcasts webhook:removed. |
PUT | /webhooks/:id/enabled | { "enabled": false } | Pauses or resumes deliveries without deleting config. Broadcasts webhook:disabled / webhook:enabled. |
curl -X POST http://localhost:6790/webhooks -H "Content-Type: application/json" \ -d '{"url": "https://example.com/hooks/bunqueue", "events": ["job.completed", "job.failed"], "queue": "emails", "secret": "whsec_abc123"}'url(required): HTTP(S) URL. Literal localhost, private IPs, and cloud metadata addresses are rejected at registration (DNS resolution and redirect targets are not validated; pair with network egress controls).events(required): Subset ofjob.pushed,job.started,job.completed,job.failed,job.progress.queue/secret(optional): Restrict to one queue; HMAC signing secret for payload verification.