For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Help CenterOpenAPI SpecStatus
OverviewInquiriesTransactionsAPI ReferenceChangelog
OverviewInquiriesTransactionsAPI ReferenceChangelog
  • Getting Started
    • Introduction
    • Quickstart Tutorial
  • API Overview
    • API Keys
      • Key Inflection
      • API Attribute Blocklists
      • Payload Filters
    • Authentication
    • Protocol
    • Response Body
    • Idempotence
    • Pagination
    • Rate Limiting
    • Downloading Files
    • API Logs
    • Request IDs
  • Versioning
    • API Changelog
    • Versioning
  • Troubleshooting
    • Error Handling
  • API Reference
    • OpenAPI Specification
    • Cases
    • Connect
    • Documents
    • Inquiries
    • List Items
    • Lists
    • OAuth
    • Reports
    • Transactions
    • Verifications
    • Workflows
  • Webhooks
LogoLogo
Help CenterOpenAPI SpecStatus
On this page
  • Enterprise support
  • Configuring a payload filter
  • Examples
  • Filtering by status
  • Filtering by relationship
  • Designing a payload filter
  • Matching against arrays
  • $or operator
  • $or on array fields
  • Pagination
API OverviewAPI Keys

Payload Filters

Restrict which records are visible through an API key
Was this page helpful?
Previous

Authentication

Next
Built with

Enterprise support

This feature is restricted to customers on the Enterprise plan. Please reach out to your Account Team or contact us if you are interested in enabling and setting up this feature.

Payload filters restrict which records are visible through a given API key. When a payload filter is configured, the serialized JSONAPI response for each record is matched against the filter:

  • List endpoints: Non-matching records are filtered out of the response.
  • Single-resource endpoints: A 403 Forbidden status is returned if the record does not match the filter.

If the payload filter is empty or not set, the API key behaves normally and all records are returned.

Configuring a payload filter

You can configure a payload filter for an API key in the Dashboard. Navigate to API Keys, click into a specific key, and select the Payload filter tab. The filter is a JSON object that you can edit directly.

api-key-payload-filters

Examples

The examples below assume a key using kebab-case key inflection.

Filtering by status

To restrict an API key to only return completed Inquiries, you would set the following payload filter:

json
1{
2 "data": {
3 "attributes": {
4 "status": "completed"
5 }
6 }
7}

When listing Inquiries with this filter, only those with "status": "completed" in their serialized payload will appear. Retrieving a single Inquiry that is not completed will return a 403.

Filtering by relationship

To restrict an API key to only return records associated with a specific Inquiry Template:

json
1{
2 "data": {
3 "relationships": {
4 "inquiry-template": {
5 "data": {
6 "id": "itmpl_abc123def456"
7 }
8 }
9 }
10 }
11}

Designing a payload filter

Start by looking at the API response for the resource you want to filter. For example, retrieving an Inquiry (via Retrieve an Inquiry) might return:

json
1{
2 "data": {
3 "type": "inquiry",
4 "id": "inq_XN8jxMoEhUeihzNypSaFKFfo",
5 "attributes": {
6 "status": "completed",
7 "reference-id": null,
8 "...": "...",
9 "tags": ["INBOUND", "CAMPAIGN ABC"],
10 "fields": {
11 "address-country-code": {
12 "type": "string",
13 "value": "US"
14 },
15 "...": "..."
16 }
17 },
18 "relationships": {
19 "inquiry-template": {
20 "data": {
21 "type": "inquiry-template",
22 "id": "itmpl_abc123def456"
23 }
24 },
25 "...": "..."
26 }
27 }
28}

Pick the value you want to filter on and keep only the keys in the path leading to that value. For example, to filter for Inquiries with country code US:

json
1{
2 "data": {
3 "attributes": {
4 "fields": {
5 "address-country-code": {
6 "value": "US"
7 }
8 }
9 }
10 }
11}

Fields with null values cannot be matched by a payload filter. For example, filtering on "address-country-code": { "value": "US" } will only return records where that field is explicitly "US" — records where the field is null will not match.

Matching against arrays

To match against an array value in the payload, provide an array in the filter containing the elements you want to check for. All elements in the filter array must be present in the payload array for the record to match.

Matching on Inquiries with a tag named “INBOUND”:

json
1{
2 "data": {
3 "attributes": {
4 "tags": [
5 "INBOUND"
6 ]
7 }
8 }
9}

Matching on Inquiries with both “INBOUND” and “CAMPAIGN ABC” tags:

json
1{
2 "data": {
3 "attributes": {
4 "tags": [
5 "INBOUND",
6 "CAMPAIGN ABC"
7 ]
8 }
9 }
10}

$or operator

To allow for multiple criteria, use the $or operator. It can be used on a list of values or JSON object literals.

Value example — match Inquiries with either of two Inquiry Templates:

json
1{
2 "data": {
3 "relationships": {
4 "inquiry-template": {
5 "data": {
6 "id": {
7 "$or": [
8 "itmpl_abc123def456",
9 "itmpl_ghi789jkl012"
10 ]
11 }
12 }
13 }
14 }
15 }
16}

Object example — match Inquiries that are either approved or completed:

json
1{
2 "data": {
3 "attributes": {
4 "$or": [
5 {
6 "status": "approved"
7 },
8 {
9 "status": "completed"
10 }
11 ]
12 }
13 }
14}

$or on array fields

When using $or to match against a field whose value is an array (like tags), the $or must be placed at the parent level, not directly on the array field. Each option should wrap the array field with the value(s) to match.

This will not work — $or directly on an array field:

json
1{
2 "data": {
3 "attributes": {
4 "tags": { "$or": ["US 1", "CAN 1"] }
5 }
6 }
7}

Instead, place $or at the parent level with each option wrapping the array:

json
1{
2 "data": {
3 "attributes": {
4 "$or": [
5 { "tags": ["US 1"] },
6 { "tags": ["CAN 1"] }
7 ]
8 }
9 }
10}

This also composes with other filters using AND semantics. For example, to match (tag “US 1” OR tag “CAN 1”) AND (one of several templates):

json
1{
2 "data": {
3 "attributes": {
4 "$or": [
5 { "tags": ["US 1"] },
6 { "tags": ["CAN 1"] }
7 ]
8 },
9 "relationships": {
10 "inquiry-template": {
11 "data": {
12 "id": {
13 "$or": ["itmpl_aaa", "itmpl_bbb", "itmpl_ccc"]
14 }
15 }
16 }
17 }
18 }
19}

Key rules for $or:

  • $or on a scalar field (like id, status) works directly: { "id": { "$or": ["a", "b"] } }
  • $or on an array field (like tags) must be lifted to the parent object, with each option as { "field": ["value"] }
  • Multiple array values in a single option use AND semantics: { "tags": ["US 1", "CAN 1"] } means “has both tags”
  • Sibling keys at the same level are ANDed together

Pagination

Payload filtering is applied after pagination. This means a page may return fewer results than the requested page[size], including empty pages with valid pagination cursors. Clients should continue paginating until no next cursor is returned.