Skip to content
Get started
Get started
View Markdown

HTTP API: DLQ, Cron & Webhooks

HTTP DLQ, Cron & Webhooks

Inspect and replay dead letters, schedule recurring crons, and manage webhooks

/dlq/* stats · retry · purge /crons create · list · delete REST mutations /webhooks register + counters Durable Store SQLite or PG 17-19 persisted state HTTP :6790 14 ops endpoints All mutations validate payloads strictly and return actionable 400 error details
14 operational routes: triage DLQ entries with filters, create or remove cron schedules, and register HMAC-signed webhook endpoints.

All 14 endpoints for Dead Letter Queues (6), Cron schedulers (4), and Webhooks (4). See HTTP API Overview for auth and error envelopes.

Each queue has a DLQ holding jobs that exhausted maxAttempts, failed with unrecoverable: true, exceeded maxStalls, or were discarded.

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
}

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
}
}
MethodPathBodyResponse & 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/purgenonePermanently 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/purge

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}}'
FieldDefaultDescription
autoRetryfalseAuto-retry eligible DLQ entries after autoRetryInterval.
autoRetryInterval3600000Auto-retry delay in ms (1 hour).
maxAutoRetries3Max automatic retries per entry.
maxAge604800000Max entry age in ms (7 days; null disables expiry).
maxEntries10000Max DLQ entries per queue; oldest evicted when full.

Broadcasts config:dlq-changed.

MethodPathDescription
GET/cronsList all cron jobs ({ "ok": true, "crons": [...] }).
POST/cronsCreate or update a cron job (reusing name updates it). Broadcasts cron:created or cron:updated.
GET/crons/:nameGet a single cron job (404 if not found).
DELETE/crons/:nameDelete 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:

FieldTypeRequiredDescription
namestringYesUnique cron name; existing names are updated in place.
queuestringYesTarget queue name.
dataanyYesPayload pushed on every tick.
schedulestring*Cron expression ("*/5 * * * *"). Takes precedence if both schedule and repeatEvery are valid.
repeatEverynumber*Positive safe-integer interval in ms (alternative to schedule).
jobNamestringNoGenerated job name (default "default").
timezonestringNoIANA timezone (defaults to server/system timezone on raw HTTP).
prioritynumberNoPriority for generated jobs.
maxLimitnumberNoMax total executions before auto-removal.
immediatelybooleanNoFire once immediately upon creation (default false).
skipIfNoWorkerbooleanNoSkip tick if no worker is registered on queue (default false).
preventOverlapbooleanNoSkip tick while the previous generated job is still pending or active (default true).
uniqueKeystringNoDeduplication key for generated jobs.
dedupobjectNo{ ttl?, extend?, replace? } (ttl must be finite).
skipMissedOnRestartbooleanNoSkip ticks missed during downtime (default true).
jobOptionsobjectNoPer-job options: maxAttempts, backoff, timeout, delay, stallTimeout, removeOnComplete, removeOnFail.

* At least one of schedule or repeatEvery is required.

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).

MethodPathBodyResponse & Event
GET/webhooksnoneLists 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/:idnoneDeletes 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 of job.pushed, job.started, job.completed, job.failed, job.progress.
  • queue / secret (optional): Restrict to one queue; HMAC signing secret for payload verification.