Skip to content

Filters API

Filters control which webhook events are forwarded through a route based on conditions applied to the payload.

Endpoints

MethodPathDescription
GET/api/filtersList filters
POST/api/filtersCreate filter
GET/api/filters/{id}Get filter
PATCH/api/filters/{id}Update filter
DELETE/api/filters/{id}Delete filter

Filter Object

json
{
  "id": "flt_abc123",
  "name": "Push Events Only",
  "description": "Only forward push events from GitHub",
  "conditions": [
    {
      "field": "headers.X-GitHub-Event",
      "operator": "equals",
      "value": "push"
    }
  ],
  "logic": "AND",
  "routeCount": 2,
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

Condition Object

FieldTypeDescription
fieldstringJSONPath to the field in payload or headers (e.g., payload.action, headers.X-GitHub-Event)
operatorstringComparison operator (see below)
valuestringValue to compare against

Operators

OperatorDescriptionExample
equalsExact match"push"
not_equalsNot equal"delete"
containsString contains"release"
not_containsString does not contain"test"
starts_withString starts with"refs/heads/"
ends_withString ends with".json"
matchesRegex match"^v\\d+\\.\\d+"
existsField exists (value ignored)
not_existsField does not exist (value ignored)
gtGreater than (numeric)"100"
gteGreater than or equal (numeric)"100"
ltLess than (numeric)"50"
lteLess than or equal (numeric)"50"
inValue in comma-separated list"push,pull_request,release"
not_inValue not in comma-separated list"bot,automated"

Logic

ValueDescription
ANDAll conditions must match (default)
ORAny condition must match

List Filters

http
GET /api/filters

Query Parameters

ParameterTypeDescription
pagenumberPage number (default: 1)
pageSizenumberItems per page (default: 20, max: 100)
searchstringSearch by name

Example

bash
curl https://api.hookbase.app/api/filters \
  -H "Authorization: Bearer whr_your_api_key"
javascript
const response = await fetch('https://api.hookbase.app/api/filters', {
  headers: {
    'Authorization': 'Bearer whr_your_api_key'
  }
});
const data = await response.json();
python
import requests

response = requests.get(
  'https://api.hookbase.app/api/filters',
  headers={'Authorization': 'Bearer whr_your_api_key'}
)
data = response.json()

Response

json
{
  "data": [
    {
      "id": "flt_abc123",
      "name": "Push Events Only",
      "conditions": [
        {
          "field": "headers.X-GitHub-Event",
          "operator": "equals",
          "value": "push"
        }
      ],
      "logic": "AND",
      "routeCount": 2
    }
  ],
  "pagination": {
    "total": 3,
    "page": 1,
    "pageSize": 20
  }
}

Create Filter

http
POST /api/filters

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name
conditionsarrayYesArray of condition objects
descriptionstringNoOptional description
logicstringNoAND or OR (default: AND)

Example

bash
curl -X POST https://api.hookbase.app/api/filters \
  -H "Authorization: Bearer whr_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Push Events",
    "description": "Only forward push events to main branch",
    "conditions": [
      {
        "field": "headers.X-GitHub-Event",
        "operator": "equals",
        "value": "push"
      },
      {
        "field": "payload.ref",
        "operator": "equals",
        "value": "refs/heads/main"
      }
    ],
    "logic": "AND"
  }'
javascript
const response = await fetch('https://api.hookbase.app/api/filters', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer whr_your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Production Push Events',
    description: 'Only forward push events to main branch',
    conditions: [
      {
        field: 'headers.X-GitHub-Event',
        operator: 'equals',
        value: 'push'
      },
      {
        field: 'payload.ref',
        operator: 'equals',
        value: 'refs/heads/main'
      }
    ],
    logic: 'AND'
  })
});
const data = await response.json();
python
import requests

response = requests.post(
  'https://api.hookbase.app/api/filters',
  headers={
    'Authorization': 'Bearer whr_your_api_key',
    'Content-Type': 'application/json'
  },
  json={
    'name': 'Production Push Events',
    'description': 'Only forward push events to main branch',
    'conditions': [
      {
        'field': 'headers.X-GitHub-Event',
        'operator': 'equals',
        'value': 'push'
      },
      {
        'field': 'payload.ref',
        'operator': 'equals',
        'value': 'refs/heads/main'
      }
    ],
    'logic': 'AND'
  }
)
data = response.json()

Response

json
{
  "id": "flt_new123",
  "name": "Production Push Events",
  "description": "Only forward push events to main branch",
  "conditions": [
    {
      "field": "headers.X-GitHub-Event",
      "operator": "equals",
      "value": "push"
    },
    {
      "field": "payload.ref",
      "operator": "equals",
      "value": "refs/heads/main"
    }
  ],
  "logic": "AND",
  "routeCount": 0,
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

Get Filter

http
GET /api/filters/{id}

Example

bash
curl https://api.hookbase.app/api/filters/flt_abc123 \
  -H "Authorization: Bearer whr_your_api_key"
javascript
const response = await fetch('https://api.hookbase.app/api/filters/flt_abc123', {
  headers: {
    'Authorization': 'Bearer whr_your_api_key'
  }
});
const data = await response.json();
python
import requests

response = requests.get(
  'https://api.hookbase.app/api/filters/flt_abc123',
  headers={'Authorization': 'Bearer whr_your_api_key'}
)
data = response.json()

Response

Returns the full filter object.

Update Filter

http
PATCH /api/filters/{id}

Request Body

All fields are optional. Only provided fields are updated.

FieldTypeDescription
namestringDisplay name
conditionsarrayArray of condition objects (replaces existing)
descriptionstringOptional description
logicstringAND or OR

Example

bash
curl -X PATCH https://api.hookbase.app/api/filters/flt_abc123 \
  -H "Authorization: Bearer whr_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "conditions": [
      {
        "field": "headers.X-GitHub-Event",
        "operator": "in",
        "value": "push,pull_request,release"
      }
    ]
  }'
javascript
const response = await fetch('https://api.hookbase.app/api/filters/flt_abc123', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer whr_your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    conditions: [
      {
        field: 'headers.X-GitHub-Event',
        operator: 'in',
        value: 'push,pull_request,release'
      }
    ]
  })
});
const data = await response.json();
python
import requests

response = requests.patch(
  'https://api.hookbase.app/api/filters/flt_abc123',
  headers={
    'Authorization': 'Bearer whr_your_api_key',
    'Content-Type': 'application/json'
  },
  json={
    'conditions': [
      {
        'field': 'headers.X-GitHub-Event',
        'operator': 'in',
        'value': 'push,pull_request,release'
      }
    ]
  }
)
data = response.json()

Response

Returns the updated filter object.

Delete Filter

http
DELETE /api/filters/{id}

WARNING

A filter cannot be deleted while it is assigned to active routes. Remove it from all routes first.

Example

bash
curl -X DELETE https://api.hookbase.app/api/filters/flt_abc123 \
  -H "Authorization: Bearer whr_your_api_key"
javascript
const response = await fetch('https://api.hookbase.app/api/filters/flt_abc123', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer whr_your_api_key'
  }
});
python
import requests

response = requests.delete(
  'https://api.hookbase.app/api/filters/flt_abc123',
  headers={'Authorization': 'Bearer whr_your_api_key'}
)

Response

204 No Content

Inline Filters vs Saved Filters

Routes support two approaches to filtering:

  1. Saved filters — Create a filter via this API and reference it by filterId in the route. Reusable across multiple routes.
  2. Inline filters — Define filterConditions and filterLogic directly on the route. Simpler for one-off conditions.
bash
# Using a saved filter
curl -X POST .../routes \
  -d '{"name": "My Route", "sourceId": "src_1", "destinationIds": ["dst_1"], "filterId": "flt_abc123"}'

# Using inline conditions
curl -X POST .../routes \
  -d '{
    "name": "My Route",
    "sourceId": "src_1",
    "destinationIds": ["dst_1"],
    "filterConditions": [
      {"field": "headers.X-GitHub-Event", "operator": "equals", "value": "push"}
    ],
    "filterLogic": "AND"
  }'

Error Responses

400 Bad Request

Invalid condition:

json
{
  "error": "Bad Request",
  "message": "Invalid operator 'like'. Must be one of: equals, not_equals, contains, ...",
  "code": "INVALID_CONDITION"
}

409 Conflict

Filter in use:

json
{
  "error": "Conflict",
  "message": "Filter is assigned to 2 active routes",
  "code": "RESOURCE_IN_USE"
}

Released under the MIT License.