Skip to main content
The Penbox API provides two powerful filtering methods to query and retrieve exactly the data you need. Both methods are available on GET (list) and GET /count endpoints.

Two Filtering Methods

Method 1: Direct Query Parameters

The simplest way to filter is by adding query parameters directly to the URL:
Benefits:
  • Simple and readable
  • Easy to construct manually
  • Good for basic filtering needs
Example:

Method 2: Advanced JSON Filter

For complex queries, use the filter parameter with a JSON object containing operators:
Benefits:
  • Powerful operator-based filtering
  • Support for complex conditions
  • Filter on attributes and relationships
  • Combine multiple criteria with operators
Example:

Filter Operators

When using the JSON filter method, you can use the following operators:
The $like and $ilike operators support SQL-style wildcards: % matches any characters
Comparison operators ($gt, $lt, $ge, $le) can be used for numbers and dates.

Filter Structure

The JSON filter object has two main sections:

Attributes

Filter on the resource’s direct attributes:

Relationships

Filter on related resources:

Examples by Resource

Filtering Cases

Direct Parameters:
JSON Filter:

Filtering Case Templates

Direct Parameters:
JSON Filter:

Filtering Forms

Direct Parameters:
JSON Filter:

Common Filtering Patterns

Time-Based Filtering

Status Filtering

Multiple Criteria

Available Filters by Endpoint

Cases (/v1/cases)

Direct Parameters:
  • template[id] - Filter by template UUID
  • status - Custom status value
  • parent_status - Parent status (draft, pending, in_progress, closed)
  • archived - Boolean (true/false)
  • waiting_for - Who the case is waiting for (none, owner, contact)
  • reference - Custom reference number
  • owner[id] - Owner UUID
  • owner[email] - Owner email
  • workspace[id] - Workspace UUID
  • workspace[slug] - Workspace slug
  • contact[given_name] - Contact first name
  • contact[family_name] - Contact last name
  • contact[email] - Contact email

Case Templates (/v1/case_templates)

Direct Parameters:
  • title - Search by title (partial match)
  • reference - Custom reference
  • archived - Boolean (true/false)
  • owner[id] - Owner UUID
  • owner[email] - Owner email
  • workspace[id] - Workspace UUID
  • workspace[slug] - Workspace slug

Forms (/v1/forms)

Direct Parameters:
  • workspace[slug] - Workspace slug
  • flow[slug] - Form template slug (single value or array)
  • flow[customization] - Template customization UUID
  • owner[email] - Owner email
  • user[given_name] - User first name
  • user[family_name] - User last name
  • user[email] - User email
  • user[phone] - User phone
  • archived - Boolean (true/false)
  • active - Boolean (true/false)
  • completed - Boolean (true/false)
  • processed - Boolean (true/false)

Best Practices

For basic filtering needs (workspace, status, owner), use direct query parameters. They’re easier to read and debug.
When you need operators, date comparisons, or pattern matching, use the JSON filter method.
When passing JSON in the filter parameter, always use encodeURIComponent() to properly encode special characters.
Always use pagination when expecting many results to avoid timeouts and improve performance.
To check for null values, use { $eq: null } or { $ne: null } in your filter.
When searching text fields, use $ilike instead of $like for case-insensitive matching.

Real-World Examples

Dashboard: Active Cases by Team Member

Search Case Templates

Multi-Workspace Reporting

Error Handling

Invalid filters return a 400 Bad Request error:
Common Issues:
  • Invalid JSON format in filter parameter
  • Unrecognized filter fields
  • Type mismatches (e.g., string instead of boolean)
  • Invalid operator usage
Solution:

Next Steps

Pagination and Sorting

Control result size and order

OpenAPI Specification

Complete API specification with all available filters

List Cases

Apply filters to the Cases endpoint

List Forms

Filter forms with advanced queries

Case Templates

Search and filter case templates