Skip to main content

Attribute Based Filters API

Manage attribute based filters for the active Organizational Unit. Attribute based filters suppress events whose metadata matches a set of key/value conditions, excluding them from scoring, session creation, and lead creation before velocity checks run.

These endpoints correspond to the Configure > Filters > Attribute Based tab in the kenbun UI.

For velocity based (inorganic activity) filter endpoints, see Velocity Based Filters.


GET /metadata-filters

List all attribute based filters for the active Organizational Unit.

Response

200 OK

Returns an array of filter objects, sorted with enabled filters first and most recently updated first.

FieldTypeDescription
idstringUnique filter identifier
namestringHuman-readable name for the filter
event_typestringEvent type this filter is scoped to. Empty string means the filter applies to all event types
conditionsarrayList of key/value conditions (see Condition Object)
enabledbooleanWhether the filter is currently active
suppressed_countintegerTotal number of events suppressed by metadata attribute filters in this OU
created_attimestampWhen the filter was created
updated_attimestampWhen the filter was last modified
created_bystringEmail of the user who created the filter
updated_bystringEmail of the user who last modified the filter

Example

curl -X GET "https://api.kenbun.io/metadata-filters" \
-H "Authorization: Bearer <token>"
[
{
"id": "mf-abc123",
"name": "Block Search Crawlers",
"event_type": "Page View",
"conditions": [
{ "key": "user_agent", "operator": "contains", "value": "bot" }
],
"enabled": true,
"suppressed_count": 482,
"created_at": "2026-01-10T09:00:00Z",
"updated_at": "2026-01-10T09:00:00Z",
"created_by": "ops@example.com",
"updated_by": "ops@example.com"
}
]

POST /metadata-filters

Create a new attribute based filter.

Request Body

FieldTypeRequiredDescription
namestringYesHuman-readable name for the filter
event_typestringNoScope this filter to one event type. Omit or send empty string to apply to all event types
conditionsarrayNoList of condition objects (see Condition Object). A filter with no conditions will match nothing
enabledbooleanNoSet to false to create the filter in a disabled state (default: true)

Response

201 Created — Returns the created filter object.

Example

curl -X POST "https://api.kenbun.io/metadata-filters" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Block Search Crawlers",
"event_type": "Page View",
"conditions": [
{ "key": "user_agent", "operator": "contains", "value": "bot" }
],
"enabled": true
}'

Common Errors

StatusMeaningSolution
400Missing name or invalid regexProvide a name and check any matches_regex conditions for valid patterns
401UnauthorizedCheck your API credentials

GET /metadata-filters/{id}

Retrieve a single attribute based filter by ID.

Request

ParameterTypeRequiredDescription
idstringYesFilter identifier (path parameter)

Response

200 OK — Returns the filter object.

Example

curl -X GET "https://api.kenbun.io/metadata-filters/mf-abc123" \
-H "Authorization: Bearer <token>"

Common Errors

StatusMeaningSolution
404Not FoundVerify the filter ID and that it belongs to the active OU

PUT /metadata-filters/{id}

Update an existing attribute based filter. All fields in the request body replace the current values.

Request

ParameterTypeRequiredDescription
idstringYesFilter identifier (path parameter)

Request Body

FieldTypeRequiredDescription
namestringYesUpdated name
event_typestringNoUpdated event type scope. Send empty string to remove scoping
conditionsarrayNoReplacement list of condition objects
enabledbooleanNoEnable or disable the filter

Response

200 OK — Returns the updated filter object.

Example

curl -X PUT "https://api.kenbun.io/metadata-filters/mf-abc123" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Block All Bot Traffic",
"event_type": "",
"conditions": [
{ "key": "user_agent", "operator": "contains", "value": "bot" },
{ "key": "user_agent", "operator": "contains", "value": "crawler" }
],
"enabled": true
}'

Common Errors

StatusMeaningSolution
400Missing name or invalid regexProvide a name and check matches_regex conditions
404Not FoundVerify the filter ID

DELETE /metadata-filters/{id}

Delete an attribute based filter. This action cannot be undone. To temporarily stop a filter without losing its configuration, use PUT to set enabled: false instead.

Request

ParameterTypeRequiredDescription
idstringYesFilter identifier (path parameter)

Response

204 No Content

Example

curl -X DELETE "https://api.kenbun.io/metadata-filters/mf-abc123" \
-H "Authorization: Bearer <token>"

Common Errors

StatusMeaningSolution
404Not FoundVerify the filter ID

POST /metadata-filters/preview

Preview how many existing events would be suppressed by a set of conditions, without saving any changes. Use this before creating or updating a filter to verify scope.

Request Body

FieldTypeRequiredDescription
event_typestringNoScope the preview to a specific event type. Omit to check all event types
conditionsarrayYesList of condition objects to evaluate (see Condition Object)

Response

200 OK

{ "count": 482 }
FieldTypeDescription
countintegerNumber of existing events that match the provided conditions

Example

curl -X POST "https://api.kenbun.io/metadata-filters/preview" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"event_type": "Page View",
"conditions": [
{ "key": "user_agent", "operator": "contains", "value": "bot" }
]
}'

Condition Object

Each condition in the conditions array has the following shape:

FieldTypeRequiredDescription
keystringYesThe metadata field name to evaluate (e.g., user_agent, source, environment)
operatorstringYesComparison operator (see table below)
valuestringNoThe value to compare against. Not required for is_empty and is_not_empty operators

Operators

OperatorDescription
equalsExact match
not_equalsDoes not match
containsField value includes the string (case-insensitive)
not_containsField value does not include the string
starts_withField value begins with the string
ends_withField value ends with the string
matches_regexField value matches the regular expression
is_emptyField is absent or blank
is_not_emptyField is present and non-blank

All conditions in a filter must match for an event to be suppressed (AND logic).

Example Condition

{ "key": "user_agent", "operator": "contains", "value": "Googlebot" }

Notes

  • Filters are scoped to the active Organizational Unit. Filters created in one OU are not visible in others.
  • Attribute based filters evaluate before velocity based filters. An event suppressed by a metadata condition never enters the velocity pipeline.
  • Suppressed events are stored but excluded from scoring, session creation, and lead creation. Their suppression_reason field is set to "metadata_filter".
  • Filters apply to new events only. Previously ingested events are not retroactively re-evaluated when a filter is created or updated.