---
title: "Search records (Database API)"
description: "The Search Records endpoint lets you filter, sort, and paginate records using a JSON request body. All three top-level fields (filter, sorting, paging) are…"
canonical: "https://docs.softr.io/api/records/search-records"
updated: "2026-12-04"
---

# Search records (Database API)

## Filtering Guide

The Search Records endpoint lets you filter, sort, and paginate records using a JSON request body. All three top-level fields (`filter`, `sorting`, `paging`) are optional.

```json
{
  "paging": {
    "offset": 0,
    "limit": 50
  },
  "sorting": [
    { "sortingField": "field-uuid", "sortType": "ASC" }
  ],
  "filter": {
    "condition": { ... }
  }
}
```

### Filter Condition Types

Filters are passed in `filter.condition`. There are four types, determined by the operator.

#### Binary Conditions

Compare a field to a value:

```json
{
  "operator": "CONTAINS",
  "leftSide": "field-uuid",
  "rightSide": "search term"
}
```

| Operator                 | Description                   | Right Side     |
| ------------------------ | ----------------------------- | -------------- |
| `IS`                     | Equals                        | single value   |
| `IS_NOT`                 | Not equals                    | single value   |
| `GREATER_THAN`           | Greater than                  | number or date |
| `GREATER_THAN_OR_EQUALS` | Greater than or equal         | number or date |
| `LESS_THAN`              | Less than                     | number or date |
| `LESS_THAN_OR_EQUALS`    | Less than or equal            | number or date |
| `CONTAINS`               | String contains               | string         |
| `DOES_NOT_CONTAIN`       | String does not contain       | string         |
| `STARTS_WITH`            | String starts with            | string         |
| `DOES_NOT_START_WITH`    | String does not start with    | string         |
| `ENDS_WITH`              | String ends with              | string         |
| `DOES_NOT_END_WITH`      | String does not end with      | string         |
| `IS_ONE_OF`              | Value is one of               | array          |
| `IS_NOT_ONE_OF`          | Value is none of              | array          |
| `HAS_ANY_OF`             | Multi-value field has any of  | array          |
| `HAS_ALL_OF`             | Multi-value field has all of  | array          |
| `HAS_NONE_OF`            | Multi-value field has none of | array          |

#### Unary Conditions

Check whether a field is empty, no `rightSide` needed:

```json
{
  "operator": "IS_EMPTY",
  "leftSide": "field-uuid"
}
```

| Operator       | Description        |
| -------------- | ------------------ |
| `IS_EMPTY`     | Field has no value |
| `IS_NOT_EMPTY` | Field has a value  |

#### Ternary Conditions

Range-based checks with `lowerBound` and `upperBound`:

```json
{
  "operator": "IS_BETWEEN",
  "leftSide": "field-uuid",
  "lowerBound": 10,
  "upperBound": 100
}
```

| Operator         | Description                         |
| ---------------- | ----------------------------------- |
| `IS_BETWEEN`     | Value is between bounds (inclusive) |
| `IS_NOT_BETWEEN` | Value is outside bounds             |
| `IS_WITHIN`      | Date is within a relative range     |
| `IS_NOT_WITHIN`  | Date is outside a relative range    |

#### Composite Conditions

Combine multiple conditions with `AND` or `OR`:

```json
{
  "operator": "AND",
  "conditions": [
    { "operator": "CONTAINS", "leftSide": "name-field", "rightSide": "acme" },
    { "operator": "GREATER_THAN", "leftSide": "amount-field", "rightSide": 1000 },
    {
      "operator": "OR",
      "conditions": [
        { "operator": "IS", "leftSide": "status-field", "rightSide": "active" },
        { "operator": "IS_EMPTY", "leftSide": "archived-field" }
      ]
    }
  ]
}
```

### Relative Date Values

For date fields, you can use relative date strings instead of fixed ISO 8601 dates:

| Format                          | Examples                                                                                                                                                                                                                                                                     |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PREDEFINED:<token>`            | `PREDEFINED:TODAY`, `PREDEFINED:YESTERDAY`, `PREDEFINED:TOMORROW`, `PREDEFINED:THIS_WEEK`, `PREDEFINED:LAST_WEEK`, `PREDEFINED:THIS_MONTH`, `PREDEFINED:THIS_YEAR`, `PREDEFINED:NEXT_MONTH`, `PREDEFINED:PAST_MONTH`, `PREDEFINED:7_DAYS_AGO`, `PREDEFINED:30_DAYS_FROM_NOW` |
| `RELATIVE_DATE:<period>:<unit>` | `RELATIVE_DATE:THIS:WEEK`, `RELATIVE_DATE:PAST:MONTH`, `RELATIVE_DATE:NEXT:QUARTER`, `RELATIVE_DATE:PAST:7` (7 days ago)                                                                                                                                                     |
| ISO 8601                        | `"2025-05-21"`, `"2025-05-21T20:00:00.000Z"`                                                                                                                                                                                                                                 |

### Complete Example

Find active contacts named "acme" with an amount over 1000, created this month:

```json
{
  "paging": { "offset": 0, "limit": 50 },
  "sorting": [
    { "sortingField": "amount-field-uuid", "sortType": "DESC" }
  ],
  "filter": {
    "condition": {
      "operator": "AND",
      "conditions": [
        { "operator": "CONTAINS", "leftSide": "name-field-uuid", "rightSide": "acme" },
        { "operator": "GREATER_THAN", "leftSide": "amount-field-uuid", "rightSide": 1000 },
        { "operator": "IS", "leftSide": "status-field-uuid", "rightSide": "active" },
        { "operator": "IS_WITHIN", "leftSide": "created-at-field-uuid", "lowerBound": "RELATIVE_DATE:THIS:MONTH", "upperBound": "PREDEFINED:TODAY" }
      ]
    }
  }
}
```

```http
POST https://tables-api.softr.io/api/v1/databases/{databaseId}/tables/{tableId}/records/search
```

## Authorizations

- `Softr-Api-Key` (API key, in header, required)

## Path parameters

- `databaseId` (`string`, required)
- `tableId` (`string`, required)

## Query parameters

- `fieldNames` (`boolean`, default: `false`): If true, use field names as keys in the fields object instead of field IDs.

## Body

`application/json`

- `filter` (`object`)
- `filter.condition` (`object`): A condition for filtering records. Text-related conditions are case-insensitive.
- `filter.condition.operator` (`enum<string>`, one of: `AND, OR, IS_EMPTY, IS_NOT_EMPTY, IS_BETWEEN, IS_NOT_BETWEEN, IS_WITHIN, IS_NOT_WITHIN, IS, IS_NOT, GREATER_THAN, GREATER_THAN_OR_EQUALS, LESS_THAN, LESS_THAN_OR_EQUALS, CONTAINS, DOES_NOT_CONTAIN, STARTS_WITH, DOES_NOT_START_WITH, ENDS_WITH, DOES_NOT_END_WITH, IS_ONE_OF, IS_NOT_ONE_OF, HAS_ANY_OF, HAS_ALL_OF, HAS_NONE_OF`)
- `filter.condition.leftSide` (`string`): The Field ID to apply the operator on.
- `filter.condition.rightSide` (`string | number | boolean | string[]`): The value to compare against. Can be a string, number, or an array for operators like IS_ONE_OF.
- `filter.condition.lowerBound` (`string`): Lower bound for IS_BETWEEN operator.
- `filter.condition.upperBound` (`string`): Upper bound for IS_BETWEEN operator.
- `filter.condition.conditions` (`object[]`): Used for AND/OR operators to nest conditions.
- `sorting` (`object[]`)
- `sorting.sortingField` (`string`): The Field ID to apply the sorting on
- `sorting.sortType` (`enum<string>`, one of: `ASC, DESC`)
- `paging` (`object`)
- `paging.offset` (`integer`, default: `0`)
- `paging.limit` (`integer`, default: `10`)

## Response

**200**: A paginated list of matching records.

- `data` (`object[]`)
- `data.id` (`string`)
- `data.tableId` (`string`)
- `data.fields` (`Record<string, unknown>`): A map of Field IDs to their values for this record.
- `data.createdAt` (`string<date-time>`)
- `data.updatedAt` (`string<date-time>`)
- `metadata` (`object`)
- `metadata.offset` (`integer`)
- `metadata.limit` (`integer`)
- `metadata.total` (`integer`)

```json
{
  "data": [
    {
      "id": "<string>",
      "tableId": "<string>",
      "fields": {},
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-01T00:00:00Z"
    }
  ],
  "metadata": {
    "offset": 123,
    "limit": 123,
    "total": 123
  }
}
```

**429**: Rate limit exceeded.

No response body.

**Example request**

```bash
curl --request POST \
  --url 'https://tables-api.softr.io/api/v1/databases/<databaseId>/tables/<tableId>/records/search' \
  --header 'Softr-Api-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "filter": {
    "condition": {
      "operator": "AND",
      "leftSide": "<string>",
      "rightSide": "<string>",
      "lowerBound": "<string>",
      "upperBound": "<string>",
      "conditions": [
        {}
      ]
    }
  },
  "sorting": [
    {
      "sortingField": "<string>",
      "sortType": "ASC"
    }
  ],
  "paging": {
    "offset": 0,
    "limit": 10
  }
}'
```
