Skip to content

Sources API

Sources are endpoints that receive incoming webhooks.

Endpoints

MethodPathDescription
GET/api/organizations/{orgId}/sourcesList sources
POST/api/organizations/{orgId}/sourcesCreate source
GET/api/organizations/{orgId}/sources/{id}Get source
PATCH/api/organizations/{orgId}/sources/{id}Update source
DELETE/api/organizations/{orgId}/sources/{id}Delete source

Source Object

json
{
  "id": "src_abc123",
  "name": "GitHub Webhooks",
  "slug": "github",
  "description": "Production GitHub webhooks",
  "webhookUrl": "https://api.webhookrelay.com/ingest/myorg/github",
  "verificationConfig": {
    "type": "github",
    "secret": "********"
  },
  "enabled": true,
  "eventsCount": 1523,
  "lastEventAt": "2024-01-15T10:30:00Z",
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

List Sources

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

Query Parameters

ParameterTypeDescription
pagenumberPage number (default: 1)
pageSizenumberItems per page (default: 20, max: 100)
enabledbooleanFilter by enabled status
searchstringSearch by name or slug

Example

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

Response

json
{
  "data": [
    {
      "id": "src_abc123",
      "name": "GitHub Webhooks",
      "slug": "github",
      "webhookUrl": "https://api.webhookrelay.com/ingest/myorg/github",
      "enabled": true,
      "eventsCount": 1523
    }
  ],
  "pagination": {
    "total": 5,
    "page": 1,
    "pageSize": 20
  }
}

Create Source

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

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name
slugstringYesURL-safe identifier
descriptionstringNoOptional description
verificationConfigobjectNoSignature verification settings
enabledbooleanNoActive status (default: true)

Verification Config Options

GitHub

json
{
  "verificationConfig": {
    "type": "github",
    "secret": "your-webhook-secret"
  }
}

Stripe

json
{
  "verificationConfig": {
    "type": "stripe",
    "secret": "whsec_..."
  }
}

Slack

json
{
  "verificationConfig": {
    "type": "slack",
    "secret": "your-signing-secret"
  }
}

Generic HMAC

json
{
  "verificationConfig": {
    "type": "hmac",
    "secret": "your-secret",
    "algorithm": "sha256",
    "header": "X-Signature",
    "encoding": "hex",
    "prefix": "sha256="
  }
}

None

json
{
  "verificationConfig": {
    "type": "none"
  }
}

Example

bash
curl -X POST https://api.webhookrelay.com/api/organizations/org_123/sources \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "GitHub Production",
    "slug": "github-prod",
    "description": "Production GitHub webhooks",
    "verificationConfig": {
      "type": "github",
      "secret": "my-secret-key"
    }
  }'

Response

json
{
  "id": "src_def456",
  "name": "GitHub Production",
  "slug": "github-prod",
  "description": "Production GitHub webhooks",
  "webhookUrl": "https://api.webhookrelay.com/ingest/myorg/github-prod",
  "verificationConfig": {
    "type": "github"
  },
  "enabled": true,
  "eventsCount": 0,
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

Get Source

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

Example

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

Response

json
{
  "id": "src_abc123",
  "name": "GitHub Webhooks",
  "slug": "github",
  "description": "Production GitHub webhooks",
  "webhookUrl": "https://api.webhookrelay.com/ingest/myorg/github",
  "verificationConfig": {
    "type": "github"
  },
  "enabled": true,
  "eventsCount": 1523,
  "lastEventAt": "2024-01-15T10:30:00Z",
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

Update Source

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

Request Body

All fields are optional. Only provided fields are updated.

FieldTypeDescription
namestringDisplay name
descriptionstringOptional description
verificationConfigobjectSignature verification settings
enabledbooleanActive status

WARNING

The slug cannot be changed after creation as it's part of the webhook URL.

Example

bash
curl -X PATCH https://api.webhookrelay.com/api/organizations/org_123/sources/src_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "GitHub Production (Updated)",
    "enabled": false
  }'

Response

json
{
  "id": "src_abc123",
  "name": "GitHub Production (Updated)",
  "slug": "github",
  "enabled": false,
  "updatedAt": "2024-01-15T11:00:00Z"
}

Delete Source

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

DANGER

Deleting a source also deletes all associated events and deliveries.

Example

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

Response

204 No Content

Error Responses

400 Bad Request

Invalid input data:

json
{
  "error": "Bad Request",
  "message": "Slug must be lowercase alphanumeric with hyphens",
  "code": "INVALID_SLUG"
}

404 Not Found

Source not found:

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

409 Conflict

Duplicate slug:

json
{
  "error": "Conflict",
  "message": "A source with slug 'github' already exists",
  "code": "DUPLICATE_SLUG"
}

Released under the MIT License.