Skip to content

Routes API

Routes connect sources to destinations.

Endpoints

MethodPathDescription
GET/api/organizations/{orgId}/routesList routes
POST/api/organizations/{orgId}/routesCreate route
GET/api/organizations/{orgId}/routes/{id}Get route
PATCH/api/organizations/{orgId}/routes/{id}Update route
DELETE/api/organizations/{orgId}/routes/{id}Delete route

Route Object

json
{
  "id": "rte_abc123",
  "name": "GitHub to Slack",
  "description": "Forward GitHub events to Slack",
  "sourceId": "src_xyz789",
  "destinationIds": ["dst_slack1", "dst_slack2"],
  "transformId": "tfm_format123",
  "filterId": "flt_pushonly456",
  "enabled": true,
  "source": {
    "id": "src_xyz789",
    "name": "GitHub"
  },
  "destinations": [
    {"id": "dst_slack1", "name": "Slack #dev"},
    {"id": "dst_slack2", "name": "Slack #alerts"}
  ],
  "transform": {
    "id": "tfm_format123",
    "name": "Slack Formatter"
  },
  "filter": {
    "id": "flt_pushonly456",
    "name": "Push Events Only"
  },
  "eventsRouted": 1523,
  "lastEventAt": "2024-01-15T10:30:00Z",
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

List Routes

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

Query Parameters

ParameterTypeDescription
pagenumberPage number (default: 1)
pageSizenumberItems per page (default: 20, max: 100)
enabledbooleanFilter by enabled status
sourceIdstringFilter by source
destinationIdstringFilter by destination

Example

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

Response

json
{
  "data": [
    {
      "id": "rte_abc123",
      "name": "GitHub to Slack",
      "sourceId": "src_xyz789",
      "destinationIds": ["dst_slack1"],
      "enabled": true,
      "eventsRouted": 1523,
      "source": {"id": "src_xyz789", "name": "GitHub"},
      "destinations": [{"id": "dst_slack1", "name": "Slack #dev"}]
    }
  ],
  "pagination": {
    "total": 5,
    "page": 1,
    "pageSize": 20
  }
}

Create Route

http
POST /api/organizations/{orgId}/routes

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name
sourceIdstringYesSource ID to listen to
destinationIdsstring[]YesArray of destination IDs
descriptionstringNoOptional description
transformIdstringNoTransform to apply
filterIdstringNoFilter to evaluate
enabledbooleanNoActive status (default: true)

Example

bash
curl -X POST https://api.webhookrelay.com/api/organizations/org_123/routes \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "GitHub to Slack",
    "sourceId": "src_xyz789",
    "destinationIds": ["dst_slack1", "dst_slack2"],
    "transformId": "tfm_format123",
    "filterId": "flt_pushonly456"
  }'

Response

json
{
  "id": "rte_new123",
  "name": "GitHub to Slack",
  "sourceId": "src_xyz789",
  "destinationIds": ["dst_slack1", "dst_slack2"],
  "transformId": "tfm_format123",
  "filterId": "flt_pushonly456",
  "enabled": true,
  "eventsRouted": 0,
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

Get Route

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

Example

bash
curl https://api.webhookrelay.com/api/organizations/org_123/routes/rte_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

Returns the full route object with expanded source, destinations, transform, and filter.

Update Route

http
PATCH /api/organizations/{orgId}/routes/{id}

Request Body

All fields are optional. Only provided fields are updated.

FieldTypeDescription
namestringDisplay name
destinationIdsstring[]Array of destination IDs
descriptionstringOptional description
transformIdstringTransform ID (null to remove)
filterIdstringFilter ID (null to remove)
enabledbooleanActive status

WARNING

The sourceId cannot be changed after creation. Create a new route instead.

Example

bash
curl -X PATCH https://api.webhookrelay.com/api/organizations/org_123/routes/rte_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false,
    "filterId": null
  }'

Response

Returns the updated route object.

Delete Route

http
DELETE /api/organizations/{orgId}/routes/{id}

INFO

Deleting a route does not delete the source, destinations, transform, or filter.

Example

bash
curl -X DELETE https://api.webhookrelay.com/api/organizations/org_123/routes/rte_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

204 No Content

Route Statistics

Get statistics for a route:

http
GET /api/organizations/{orgId}/routes/{id}/stats

Query Parameters

ParameterTypeDescription
periodstringTime period: 1h, 24h, 7d, 30d

Response

json
{
  "eventsRouted": 1523,
  "eventsFiltered": 234,
  "deliveriesSucceeded": 1489,
  "deliveriesFailed": 34,
  "avgLatency": 245,
  "period": "24h"
}

Error Responses

400 Bad Request

Invalid source or destination:

json
{
  "error": "Bad Request",
  "message": "Source with ID src_invalid not found",
  "code": "INVALID_SOURCE"
}

404 Not Found

Route not found:

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

409 Conflict

Duplicate route:

json
{
  "error": "Conflict",
  "message": "A route with this source and destinations already exists",
  "code": "DUPLICATE_ROUTE"
}

Released under the MIT License.