> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pocketflows.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Filter definitions

> Fields, types and naming rules for filter definitions

A filter definition describes one customer property so that it can be used as a
filter in the embed. For background, see
[How segments and filter definitions work](https://docs.pocketflows.com/concepts/segments-and-filters.md).

## Fields

| Field | Type | Description |
| - | - | - |
| `id` | string | The ID of the filter definition. Starts with `fd_`. |
| `variable_name` | string | The property the filter reads. See [Variable names](#variable-names). |
| `label` | string | The name shown to businesses in the embed. |
| `type` | string | The kind of value the property holds. See [Types](#types). |
| `enabled` | boolean | Whether the filter is offered in the embed. |
| `options` | array | The choices for the filter. Only present for `select` and `array_of_known` |

Each entry in `options` has a `label`, shown to businesses, and a `value`,
matched against the customer's data. Both are strings.

## Variable names

A customer filter's `variable_name` must start with `customer.`. The rest names
the property:

* A built-in customer property: `customer.full_name`, `customer.first_name`,
  `customer.last_name`, `customer.email_address`, `customer.phone_number`, or
  `customer.external_id`. `customer.external_id` works in segments but not in
  trigger filters.
* Anything else is read from the customer's `metadata`. `customer.plan` reads
  `metadata.plan`.

Each part of the name after `customer.` may contain only letters, numbers and
underscores. Don't give a metadata key the same name as a built-in property:
segments read the built-in property, but trigger filters read the metadata key.

For the syntax of the filters built from these definitions, see
[Filter syntax](https://docs.pocketflows.com/reference/filter-syntax.md).

Within one business, and within the project-level definitions of one project,
each `variable_name` can be defined once.

## Types

The value you sync must match the filter's type.

| Type | Value to sync in `metadata` | Comparisons offered in the embed |
| - | - | - |
| `text` | A string | Is equal to, contains, does not contain. Not case-sensitive. |
| `number` | A number | Equal to, not equal to, greater than, at least, less than, at most. |
| `currency` | A number, in the same units you want businesses to enter | The same as `number`, entered as a `$` amount. |
| `boolean` | `true` or `false` | Is true, is false. |
| `datetime` | A date and time string, such as `2026-03-31T16:42:03Z` | Relative to now (for example, more than 30 days ago), before or after a date, between two dates, or whether it is set at all. |
| `select` | A string equal to one of the option values | Is any of the selected options. |
| `array_of_known` | An array of strings taken from the option values | Contains any of, or contains none of, the selected options. |

`select` and `array_of_known` require `options`.

## Enabled and disabled

| Created | Applies to | Starts |
| - | - | - |
| In the dashboard, for the project | Every business in the project | Disabled |
| With the API, for a business | That business | Enabled |
| With the API, for a project event | Every business in the project | Disabled |
| With the API, for a business's event | That business | Enabled |

A business's definition replaces the project-level definition with the same
`variable_name` for that business. If the business's definition is disabled, the
filter is hidden for that business.

## Endpoints

| To | Endpoint |
| - | - |
| List a business's definitions | `GET /businesses/:id/filter_definitions` |
| Create or update for a business | `POST /businesses/:id/filter_definitions` |
| Retrieve one | `GET /filter_definitions/:id` |
| Update one | `POST /filter_definitions/:id` |
| Enable one | `POST /filter_definitions/:id/enable` |
| Disable one | `POST /filter_definitions/:id/disable` |
| Delete one | `DELETE /filter_definitions/:id` |
| List an event's definitions | `GET /project_defined_events/:id/filter_definitions` |
| Create or update for an event | `POST /project_defined_events/:id/filter_definitions` |

`POST /businesses/:id/filter_definitions` requires `variable_name`, `label`,
`type` and `options`. Pass `"options": []` for types that have no options.

Event filter definitions use a `variable_name` that starts with `event.`. For
request and response schemas, see the **API Reference** tab.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.