Skip to content

Deliveries API

Deliveries represent attempts to send webhooks to destinations.

Endpoints

MethodPathDescription
GET/api/organizations/{orgId}/deliveriesList deliveries
GET/api/organizations/{orgId}/deliveries/{id}Get delivery
POST/api/organizations/{orgId}/deliveries/{id}/retryRetry delivery

Delivery Object

json
{
  "id": "dlv_abc123",
  "eventId": "evt_xyz789",
  "destinationId": "dst_api123",
  "routeId": "rte_main456",
  "status": "delivered",
  "attemptCount": 1,
  "maxAttempts": 5,
  "latency": 245,
  "statusCode": 200,
  "requestHeaders": {
    "Content-Type": "application/json",
    "Authorization": "Bearer ***",
    "X-Webhook-ID": "evt_xyz789"
  },
  "responseHeaders": {
    "Content-Type": "application/json",
    "X-Request-ID": "req_abc"
  },
  "responseBody": "{\"received\": true}",
  "error": null,
  "event": {
    "id": "evt_xyz789",
    "sourceId": "src_github"
  },
  "destination": {
    "id": "dst_api123",
    "name": "Production API",
    "url": "https://api.yourapp.com/webhooks"
  },
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:01Z",
  "deliveredAt": "2024-01-15T10:30:01Z"
}

Status Values

StatusDescription
pendingAwaiting delivery
deliveredSuccessfully delivered
failedAll retry attempts exhausted
retryingWaiting to retry

List Deliveries

http
GET /api/organizations/{orgId}/deliveries

Query Parameters

ParameterTypeDescription
pagenumberPage number (default: 1)
pageSizenumberItems per page (default: 20, max: 100)
eventIdstringFilter by event
destinationIdstringFilter by destination
routeIdstringFilter by route
statusstringFilter by status
fromstringStart date (ISO 8601)
tostringEnd date (ISO 8601)

Example

bash
curl "https://api.webhookrelay.com/api/organizations/org_123/deliveries?status=failed&destinationId=dst_api" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

json
{
  "data": [
    {
      "id": "dlv_abc123",
      "eventId": "evt_xyz789",
      "destinationId": "dst_api123",
      "status": "failed",
      "attemptCount": 5,
      "maxAttempts": 5,
      "statusCode": 500,
      "error": "Internal Server Error",
      "createdAt": "2024-01-15T10:30:00Z"
    }
  ],
  "pagination": {
    "total": 34,
    "page": 1,
    "pageSize": 20
  }
}

Get Delivery

http
GET /api/organizations/{orgId}/deliveries/{id}

Query Parameters

ParameterTypeDescription
includeAttemptsbooleanInclude all attempt details (default: false)

Example

bash
curl "https://api.webhookrelay.com/api/organizations/org_123/deliveries/dlv_abc123?includeAttempts=true" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

json
{
  "id": "dlv_abc123",
  "eventId": "evt_xyz789",
  "destinationId": "dst_api123",
  "status": "delivered",
  "attemptCount": 2,
  "maxAttempts": 5,
  "latency": 180,
  "statusCode": 200,
  "attempts": [
    {
      "attemptNumber": 1,
      "startedAt": "2024-01-15T10:30:00Z",
      "completedAt": "2024-01-15T10:30:01Z",
      "statusCode": 503,
      "error": "Service Unavailable",
      "latency": 5023
    },
    {
      "attemptNumber": 2,
      "startedAt": "2024-01-15T10:30:02Z",
      "completedAt": "2024-01-15T10:30:02Z",
      "statusCode": 200,
      "error": null,
      "latency": 180
    }
  ],
  "requestHeaders": {
    "Content-Type": "application/json"
  },
  "responseHeaders": {
    "Content-Type": "application/json"
  },
  "responseBody": "{\"received\": true}",
  "deliveredAt": "2024-01-15T10:30:02Z"
}

Retry Delivery

Manually retry a failed delivery:

http
POST /api/organizations/{orgId}/deliveries/{id}/retry

INFO

This resets the attempt count and queues the delivery for immediate retry.

Example

bash
curl -X POST https://api.webhookrelay.com/api/organizations/org_123/deliveries/dlv_abc123/retry \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

json
{
  "message": "Delivery queued for retry",
  "deliveryId": "dlv_abc123",
  "status": "pending"
}

Dead Letter Queue

Failed deliveries are moved to the dead letter queue for manual review.

List Dead Letter Items

http
GET /api/organizations/{orgId}/deliveries/dead-letter

Query Parameters

ParameterTypeDescription
pagenumberPage number
pageSizenumberItems per page
destinationIdstringFilter by destination
fromstringStart date
tostringEnd date

Example

bash
curl https://api.webhookrelay.com/api/organizations/org_123/deliveries/dead-letter \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

json
{
  "data": [
    {
      "id": "dlq_abc123",
      "deliveryId": "dlv_xyz789",
      "eventId": "evt_main123",
      "destinationId": "dst_api",
      "error": "Connection timeout after 30000ms",
      "attemptCount": 5,
      "failedAt": "2024-01-15T10:35:00Z",
      "event": {
        "id": "evt_main123",
        "receivedAt": "2024-01-15T10:30:00Z"
      },
      "destination": {
        "id": "dst_api",
        "name": "Production API"
      }
    }
  ],
  "pagination": {
    "total": 12,
    "page": 1,
    "pageSize": 20
  }
}

Requeue Dead Letter Item

http
POST /api/organizations/{orgId}/deliveries/dead-letter/{id}/requeue

Example

bash
curl -X POST https://api.webhookrelay.com/api/organizations/org_123/deliveries/dead-letter/dlq_abc123/requeue \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

json
{
  "message": "Item requeued for delivery",
  "deliveryId": "dlv_new456"
}

Delete Dead Letter Item

http
DELETE /api/organizations/{orgId}/deliveries/dead-letter/{id}

Example

bash
curl -X DELETE https://api.webhookrelay.com/api/organizations/org_123/deliveries/dead-letter/dlq_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

204 No Content

Delivery Statistics

http
GET /api/organizations/{orgId}/deliveries/stats

Query Parameters

ParameterTypeDescription
periodstring1h, 24h, 7d, 30d
destinationIdstringFilter by destination

Response

json
{
  "total": 5230,
  "delivered": 5152,
  "failed": 78,
  "pending": 0,
  "successRate": 98.5,
  "avgLatency": 245,
  "p50Latency": 180,
  "p95Latency": 450,
  "p99Latency": 890,
  "period": "24h"
}

Error Responses

404 Not Found

Delivery not found:

json
{
  "error": "Not Found",
  "message": "Delivery with ID dlv_xyz not found",
  "code": "RESOURCE_NOT_FOUND"
}

409 Conflict

Cannot retry delivery:

json
{
  "error": "Conflict",
  "message": "Delivery is already pending or delivered",
  "code": "INVALID_STATE"
}

Released under the MIT License.