Skip to content
mittr

Event Filtering

Route events to endpoints based on payload content using filter expressions.

Filters use JSONPath-style expressions evaluated against the event payload:

{
"filter": [
{ "field": "$.data.amount", "operator": "gte", "value": 1000 },
{ "field": "$.data.currency", "operator": "eq", "value": "USD" }
]
}

All conditions must match (AND logic by default). An endpoint whose filter doesn’t match is skipped for that event. If that leaves no endpoint to deliver to (none subscribes to the event type, or every subscriber’s filter excludes the payload), POST /api/v1/events returns 400 NO_MATCHING_ENDPOINTS and no event is stored.

OperatorDescriptionExample
eqEqual"$.status" eq "active"
neNot equal"$.type" ne "test"
gtGreater than"$.amount" gt 100
gteGreater or equal"$.amount" gte 1000
ltLess than"$.priority" lt 5
lteLess or equal"$.retry_count" lte 3
containsString contains"$.email" contains "@company.com"
startsWithString starts with"$.path" startsWith "/api/"
endsWithString ends with"$.file" endsWith ".pdf"
existsField exists"$.metadata.tags" exists true
regexRegex match"$.code" regex "^[A-Z]{3}$"

For complex filtering, use and, or, and not:

{
"filter": {
"or": [
{ "field": "$.data.amount", "operator": "gte", "value": 10000 },
{
"and": [
{ "field": "$.data.currency", "operator": "eq", "value": "USD" },
{ "field": "$.data.priority", "operator": "eq", "value": "high" }
]
}
]
}
}

Nesting is supported up to 10 levels deep.

Terminal window
curl -X POST https://app.mittr.io/api/v1/endpoints \
-H "X-API-Key: mtr_your_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://billing.example.com/webhooks",
"eventTypes": ["order.created"],
"filter": [
{ "field": "$.data.amount", "operator": "gte", "value": 10000 }
]
}'

Only order.created events with data.amount >= 10000 are delivered to this endpoint.

Filters work alongside event type subscriptions:

  1. An event is sent with eventType: "order.created"
  2. Mittr finds all endpoints subscribed to order.created (or order.*)
  3. Each endpoint’s filter is evaluated against the payload
  4. Only matching endpoints receive the delivery

This allows fine-grained routing without duplicating events.