Filtering Records
Filtering Records - Simple and Advanced
Learn how to filter records using the Tadabase REST API, from simple single-condition filters to complex nested queries with multiple conditions.
⚠️ Important: Filter Parameter Names
Pay close attention to the parameter names used in filtering. Using incorrect names will cause filters to silently fail:
condition- Used at the filter GROUP level ("AND", "OR", "any", "all")operator- Used at the individual FILTER ITEM level ("is", "contains", etc.)val- The value to compare against (NOT "value")
HTTP Methods for Filtering
You can filter records using either GET or POST methods:
| Method | Best For | Example |
|---|---|---|
| POST | Complex filters with multiple conditions | JSON in request body |
| GET | Simple filters | Query parameters in URL |
💡 Recommendation
Use POST with JSON body for filtering. It's cleaner, easier to read, and works better with complex nested filters.
Simple Filter (Single Condition)
Filter records with a single condition.
POST Request (Recommended)
POST /api/v1/data-tables/{tableId}/records
Headers:
X-Tadabase-App-id: your_app_id
X-Tadabase-App-Key: your_app_key
X-Tadabase-App-Secret: your_app_secret
Content-Type: application/json
Body:
{
"filters": {
"condition": "AND",
"items": [
{
"field_id": "status",
"operator": "is",
"val": "Active"
}
]
},
"page": 1,
"limit": 50
}
This returns all records where status equals "Active".
GET Request (Alternative)
GET /api/v1/data-tables/{tableId}/records?filters[items][0][field_id]=status&filters[items][0][operator]=is&filters[items][0][val]=Active
Multiple Conditions (AND)
Filter records that match ALL conditions.
POST /api/v1/data-tables/{tableId}/records
Content-Type: application/json
{
"filters": {
"condition": "AND",
"items": [
{
"field_id": "status",
"operator": "is",
"val": "Active"
},
{
"field_id": "age",
"operator": "higher than",
"val": 25
},
{
"field_id": "email",
"operator": "contains",
"val": "@example.com"
}
]
}
}
Returns records where:
- Status is "Active" AND
- Age is greater than 25 AND
- Email contains "@example.com"
Multiple Conditions (OR)
Filter records that match ANY condition.
{
"filters": {
"condition": "any",
"items": [
{
"field_id": "status",
"operator": "is",
"val": "Active"
},
{
"field_id": "status",
"operator": "is",
"val": "Pending"
}
]
}
}
Returns records where status is either "Active" OR "Pending".
Complex Nested Filters
Combine AND and OR logic using nested groups with the child array.
{
"filters": {
"condition": "AND",
"items": [
{
"field_id": "status",
"operator": "is",
"val": "Active"
}
],
"child": [
{
"condition": "any",
"items": [
{
"field_id": "email",
"operator": "contains",
"val": "@example.com"
},
{
"field_id": "email",
"operator": "contains",
"val": "@test.com"
}
]
}
]
}
}
Returns records where:
- Status is "Active" AND
- (Email contains "@example.com" OR Email contains "@test.com")
Complete Operator Reference
Text Field Operators
| Operator | Description | Example |
|---|---|---|
is |
Exact match (case insensitive) | "operator": "is", "val": "Active" |
is exact |
Exact match (case sensitive) | "operator": "is exact", "val": "Active" |
is not |
Not equal (case insensitive) | "operator": "is not", "val": "Inactive" |
is not exact |
Not equal (case sensitive) | "operator": "is not exact", "val": "Inactive" |
contains |
Substring match | "operator": "contains", "val": "keyword" |
does not contain |
Does not contain substring | "operator": "does not contain", "val": "spam" |
starts with |
Starts with value | "operator": "starts with", "val": "Dr." |
ends with |
Ends with value | "operator": "ends with", "val": ".com" |
is blank |
Field is empty or NULL | "operator": "is blank" |
is not blank |
Field has a value | "operator": "is not blank" |
Numeric Field Operators
| Operator | Description | Example |
|---|---|---|
is |
Equal to | "operator": "is", "val": 100 |
is not |
Not equal to | "operator": "is not", "val": 0 |
higher than |
Greater than | "operator": "higher than", "val": 100 |
higher than or equal to |
Greater than or equal to | "operator": "higher than or equal to", "val": 100 |
lower than |
Less than | "operator": "lower than", "val": 50 |
lower than or equal to |
Less than or equal to | "operator": "lower than or equal to", "val": 50 |
is blank |
Field is empty or NULL | "operator": "is blank" |
is not blank |
Field has a value | "operator": "is not blank" |
⚠️ Important: No "between" Operator
Tadabase does NOT support a between operator. To filter for values in a range, use two separate conditions:
{
"filters": {
"condition": "AND",
"items": [
{
"field_id": "price",
"operator": "higher than or equal to",
"val": 100
},
{
"field_id": "price",
"operator": "lower than or equal to",
"val": 1000
}
]
}
}
Date and Date/Time Field Operators
| Operator | Description | Example |
|---|---|---|
is |
Exact date match | "operator": "is", "val": "2024-01-27" |
is not |
Not this date | "operator": "is not", "val": "2024-01-27" |
is before |
Date is before specified date | "operator": "is before", "val": "2024-01-01" |
is on or before |
Date is on or before specified date | "operator": "is on or before", "val": "2024-01-01" |
is after |
Date is after specified date | "operator": "is after", "val": "2024-01-01" |
is on or after |
Date is on or after specified date | "operator": "is on or after", "val": "2024-01-01" |
is before today |
Date is before current date | "operator": "is before today" |
is after today |
Date is after current date | "operator": "is after today" |
is before current time |
Time is before current time (for Time fields) | "operator": "is before current time" |
is after current time |
Time is after current time (for Time fields) | "operator": "is after current time" |
is blank |
Field is empty or NULL | "operator": "is blank" |
is not blank |
Field has a value | "operator": "is not blank" |
Boolean and Checkbox Operators
| Operator | Description | Example |
|---|---|---|
is checked |
Checkbox is checked | "operator": "is checked" |
is unchecked |
Checkbox is unchecked | "operator": "is unchecked" |
User and Authentication Operators
These operators require bearer token authentication to work correctly.
| Operator | Description | Example |
|---|---|---|
is logged in user |
Matches currently authenticated user | "operator": "is logged in user" |
is not logged in user |
Does not match authenticated user | "operator": "is not logged in user" |
is connected to logged in user |
For join fields, checks connection to user | "operator": "is connected to logged in user" |
is not connected to logged in user |
For join fields, checks no connection to user | "operator": "is not connected to logged in user" |
Join (Connection) Field Operators
| Operator | Description | Example |
|---|---|---|
is |
Record is connected to specified ID | "operator": "is", "val": "record_id" |
is not |
Record is not connected to specified ID | "operator": "is not", "val": "record_id" |
contains |
Contains specific value in joined field | "operator": "contains", "val": "search" |
is blank |
No connections exist | "operator": "is blank" |
is not blank |
Has at least one connection | "operator": "is not blank" |
is connected with current record |
Connected to current page record | "operator": "is connected with current record" |
is connected with current record's field |
Connected via specific field | "operator": "is connected with current record's field" |
Field Identifiers
The field_id parameter accepts either:
- Field IDs: The internal field ID like
field_40 - Field Slugs: The slug name assigned to the field
Sub-Field Syntax
For complex field types (Name, Address), reference sub-fields using a hyphen:
{
"field_id": "full_name-first",
"operator": "contains",
"val": "John"
}
Common sub-fields:
- Name:
-title,-first,-middle,-last - Address:
-address,-address2,-city,-state,-zip,-country
Date Filtering Examples
Exact Date
{
"field_id": "created_at",
"operator": "is",
"val": "2024-01-27"
}
Date Range (Between Two Dates)
Use two conditions with AND logic:
{
"filters": {
"condition": "AND",
"items": [
{
"field_id": "created_at",
"operator": "is on or after",
"val": "2024-01-01"
},
{
"field_id": "created_at",
"operator": "is on or before",
"val": "2024-01-31"
}
]
}
}
After Specific Date
{
"field_id": "created_at",
"operator": "is after",
"val": "2024-01-01"
}
Before Specific Date
{
"field_id": "created_at",
"operator": "is before",
"val": "2024-12-31"
}
Important Warnings
⚠️ Silent Filter Failures
When a filter references a field that doesn't exist in the table, the API silently removes that filter instead of returning an error. This means:
- If you have a typo in
field_id, the filter will be ignored - If the field doesn't exist, you won't receive an error message
- The request will succeed with HTTP 200, but return unfiltered results
Solution: Use the /data-tables/{tableId}/fields endpoint to verify field IDs before filtering.
Debugging Filter Issues
If your filters aren't working as expected:
- Verify field IDs: Use
GET /api/v1/data-tables/{tableId}/fieldsto list all valid field IDs - Check parameter names: Use
operator(notcondition) in filter items - Check value parameter: Use
val(notvalue) for filter values - Ensure field exists: The field must actually exist in the data table
- Use field ID or slug: Not the display name
- Test simple first: Start with a single-filter query before adding complexity
- Check response: Look at
total_itemsto see if filters are working
Complete Working Examples
Example 1: Active customers from specific domains
POST /api/v1/data-tables/lGArg7rmR6/records
Content-Type: application/json
{
"filters": {
"condition": "AND",
"items": [
{
"field_id": "status",
"operator": "is",
"val": "Active"
}
],
"child": [
{
"condition": "any",
"items": [
{
"field_id": "email",
"operator": "ends with",
"val": "@example.com"
},
{
"field_id": "email",
"operator": "ends with",
"val": "@test.com"
}
]
}
]
},
"limit": 50,
"order": "created_at",
"order_by": "desc"
}
Example 2: Orders in price range with recent dates
{
"filters": {
"condition": "AND",
"items": [
{
"field_id": "total_amount",
"operator": "higher than or equal to",
"val": 100
},
{
"field_id": "total_amount",
"operator": "lower than or equal to",
"val": 1000
},
{
"field_id": "order_date",
"operator": "is on or after",
"val": "2024-01-01"
},
{
"field_id": "status",
"operator": "is not",
"val": "Cancelled"
}
]
}
}
JavaScript Example
async function filterRecords(tableId, filters) {
const response = await fetch(
`https://api.tadabase.io/api/v1/data-tables/${tableId}/records`,
{
method: 'POST',
headers: {
'X-Tadabase-App-id': 'your_app_id',
'X-Tadabase-App-Key': 'your_app_key',
'X-Tadabase-App-Secret': 'your_app_secret',
'Content-Type': 'application/json'
},
body: JSON.stringify({ filters })
}
);
const data = await response.json();
return data.items;
}
// Usage
const filters = {
condition: "AND",
items: [
{
field_id: "status",
operator: "is",
val: "Active"
},
{
field_id: "age",
operator: "higher than",
val: 18
}
]
};
const records = await filterRecords('lGArg7rmR6', filters);
console.log(records);
Next Steps
Master sorting and pagination to complete your data retrieval skills:
Learn how to sort results and efficiently paginate through large datasets.
We'd love to hear your feedback.