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

# Database

> WhatsApp local sync: searchable entities, `.search()` filters, and operators.

The WhatsApp plugin syncs data locally. Use `corsair.whatsapp.db.<entity>.search({ data, limit?, offset? })` with the filters listed per entity.

<Info>
  **New to Corsair?** See [database operations](/concepts/database), [data synchronization](/concepts/integrations), and [multi-tenancy](/concepts/multi-tenancy).
</Info>

## Business Profiles

Path: `whatsapp.db.businessProfiles.search`

```ts theme={null}
const rows = await corsair.whatsapp.db.businessProfiles.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field                 | Type     | Operators                                  |
| --------------------- | -------- | ------------------------------------------ |
| `entity_id`           | `string` | equals, contains, startsWith, endsWith, in |
| `id`                  | `string` | equals, contains, startsWith, endsWith, in |
| `phoneNumberId`       | `string` | equals, contains, startsWith, endsWith, in |
| `about`               | `string` | equals, contains, startsWith, endsWith, in |
| `address`             | `string` | equals, contains, startsWith, endsWith, in |
| `description`         | `string` | equals, contains, startsWith, endsWith, in |
| `email`               | `string` | equals, contains, startsWith, endsWith, in |
| `profile_picture_url` | `string` | equals, contains, startsWith, endsWith, in |
| `vertical`            | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`           | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Contacts

Path: `whatsapp.db.contacts.search`

```ts theme={null}
const rows = await corsair.whatsapp.db.contacts.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field       | Type     | Operators                                  |
| ----------- | -------- | ------------------------------------------ |
| `entity_id` | `string` | equals, contains, startsWith, endsWith, in |
| `id`        | `string` | equals, contains, startsWith, endsWith, in |
| `waId`      | `string` | equals, contains, startsWith, endsWith, in |
| `name`      | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt` | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Messages

Path: `whatsapp.db.messages.search`

```ts theme={null}
const rows = await corsair.whatsapp.db.messages.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field               | Type     | Operators                                  |
| ------------------- | -------- | ------------------------------------------ |
| `entity_id`         | `string` | equals, contains, startsWith, endsWith, in |
| `id`                | `string` | equals, contains, startsWith, endsWith, in |
| `from`              | `string` | equals, contains, startsWith, endsWith, in |
| `to`                | `string` | equals, contains, startsWith, endsWith, in |
| `type`              | `string` | equals, contains, startsWith, endsWith, in |
| `text`              | `string` | equals, contains, startsWith, endsWith, in |
| `status`            | `string` | equals, contains, startsWith, endsWith, in |
| `timestamp`         | `string` | equals, contains, startsWith, endsWith, in |
| `phoneNumberId`     | `string` | equals, contains, startsWith, endsWith, in |
| `businessAccountId` | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`         | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Phone Numbers

Path: `whatsapp.db.phoneNumbers.search`

```ts theme={null}
const rows = await corsair.whatsapp.db.phoneNumbers.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field                      | Type     | Operators                                  |
| -------------------------- | -------- | ------------------------------------------ |
| `entity_id`                | `string` | equals, contains, startsWith, endsWith, in |
| `id`                       | `string` | equals, contains, startsWith, endsWith, in |
| `display_phone_number`     | `string` | equals, contains, startsWith, endsWith, in |
| `verified_name`            | `string` | equals, contains, startsWith, endsWith, in |
| `quality_rating`           | `string` | equals, contains, startsWith, endsWith, in |
| `code_verification_status` | `string` | equals, contains, startsWith, endsWith, in |
| `platform_type`            | `string` | equals, contains, startsWith, endsWith, in |
| `createdAt`                | `date`   | equals, before, after, between             |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***
