> ## 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

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

The Ahrefs plugin syncs data locally. Use `corsair.ahrefs.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>

## Domain Metrics

Path: `ahrefs.db.domainMetrics.search`

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

### Searchable filters

| Field                        | Type     | Operators                                  |
| ---------------------------- | -------- | ------------------------------------------ |
| `entity_id`                  | `string` | equals, contains, startsWith, endsWith, in |
| `target`                     | `string` | equals, contains, startsWith, endsWith, in |
| `date`                       | `string` | equals, contains, startsWith, endsWith, in |
| `ahrefs_rank`                | `number` | equals, gt, gte, lt, lte, in               |
| `domain_rating`              | `number` | equals, gt, gte, lt, lte, in               |
| `backlinks`                  | `number` | equals, gt, gte, lt, lte, in               |
| `referring_domains`          | `number` | equals, gt, gte, lt, lte, in               |
| `all_time_backlinks`         | `number` | equals, gt, gte, lt, lte, in               |
| `all_time_referring_domains` | `number` | equals, gt, gte, lt, lte, in               |
| `updatedAt`                  | `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).*

***

## Keywords

Path: `ahrefs.db.keywords.search`

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

### Searchable filters

| Field                | Type     | Operators                                  |
| -------------------- | -------- | ------------------------------------------ |
| `entity_id`          | `string` | equals, contains, startsWith, endsWith, in |
| `target`             | `string` | equals, contains, startsWith, endsWith, in |
| `country`            | `string` | equals, contains, startsWith, endsWith, in |
| `date`               | `string` | equals, contains, startsWith, endsWith, in |
| `keyword`            | `string` | equals, contains, startsWith, endsWith, in |
| `volume`             | `number` | equals, gt, gte, lt, lte, in               |
| `keyword_difficulty` | `number` | equals, gt, gte, lt, lte, in               |
| `difficulty`         | `number` | equals, gt, gte, lt, lte, in               |
| `cpc`                | `number` | equals, gt, gte, lt, lte, in               |
| `best_position`      | `number` | equals, gt, gte, lt, lte, in               |
| `best_position_url`  | `string` | equals, contains, startsWith, endsWith, in |
| `sum_traffic`        | `number` | equals, gt, gte, lt, lte, in               |
| `traffic_potential`  | `number` | equals, gt, gte, lt, lte, in               |
| `updatedAt`          | `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).*

***

## Pages

Path: `ahrefs.db.pages.search`

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

### Searchable filters

| Field               | Type     | Operators                                  |
| ------------------- | -------- | ------------------------------------------ |
| `entity_id`         | `string` | equals, contains, startsWith, endsWith, in |
| `target`            | `string` | equals, contains, startsWith, endsWith, in |
| `country`           | `string` | equals, contains, startsWith, endsWith, in |
| `date`              | `string` | equals, contains, startsWith, endsWith, in |
| `raw_url`           | `string` | equals, contains, startsWith, endsWith, in |
| `keywords`          | `number` | equals, gt, gte, lt, lte, in               |
| `referring_domains` | `number` | equals, gt, gte, lt, lte, in               |
| `sum_traffic`       | `number` | equals, gt, gte, lt, lte, in               |
| `value`             | `number` | equals, gt, gte, lt, lte, in               |
| `updatedAt`         | `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).*

***

## Rankings

Path: `ahrefs.db.rankings.search`

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

### Searchable filters

| Field               | Type     | Operators                                  |
| ------------------- | -------- | ------------------------------------------ |
| `entity_id`         | `string` | equals, contains, startsWith, endsWith, in |
| `project_id`        | `number` | equals, gt, gte, lt, lte, in               |
| `device`            | `string` | equals, contains, startsWith, endsWith, in |
| `date`              | `string` | equals, contains, startsWith, endsWith, in |
| `keyword`           | `string` | equals, contains, startsWith, endsWith, in |
| `country`           | `string` | equals, contains, startsWith, endsWith, in |
| `position`          | `number` | equals, gt, gte, lt, lte, in               |
| `previous_position` | `number` | equals, gt, gte, lt, lte, in               |
| `url`               | `string` | equals, contains, startsWith, endsWith, in |
| `updatedAt`         | `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).*

***

## Refdomains

Path: `ahrefs.db.refdomains.search`

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

### Searchable filters

| Field                 | Type     | Operators                                  |
| --------------------- | -------- | ------------------------------------------ |
| `entity_id`           | `string` | equals, contains, startsWith, endsWith, in |
| `target`              | `string` | equals, contains, startsWith, endsWith, in |
| `domain`              | `string` | equals, contains, startsWith, endsWith, in |
| `domain_rating`       | `number` | equals, gt, gte, lt, lte, in               |
| `dofollow_links`      | `number` | equals, gt, gte, lt, lte, in               |
| `dofollow_refdomains` | `number` | equals, gt, gte, lt, lte, in               |
| `links`               | `number` | equals, gt, gte, lt, lte, in               |
| `refdomains`          | `number` | equals, gt, gte, lt, lte, in               |
| `updatedAt`           | `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).*

***

## Serp Positions

Path: `ahrefs.db.serpPositions.search`

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

### Searchable filters

| Field           | Type     | Operators                                  |
| --------------- | -------- | ------------------------------------------ |
| `entity_id`     | `string` | equals, contains, startsWith, endsWith, in |
| `country`       | `string` | equals, contains, startsWith, endsWith, in |
| `keyword`       | `string` | equals, contains, startsWith, endsWith, in |
| `requestedDate` | `string` | equals, contains, startsWith, endsWith, in |
| `position`      | `number` | equals, gt, gte, lt, lte, in               |
| `url`           | `string` | equals, contains, startsWith, endsWith, in |
| `title`         | `string` | equals, contains, startsWith, endsWith, in |
| `domain_rating` | `number` | equals, gt, gte, lt, lte, in               |
| `backlinks`     | `number` | equals, gt, gte, lt, lte, in               |
| `refdomains`    | `number` | equals, gt, gte, lt, lte, in               |
| `traffic`       | `number` | equals, gt, gte, lt, lte, in               |
| `updatedAt`     | `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).*

***

## Subscription Usage

Path: `ahrefs.db.subscriptionUsage.search`

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

### Searchable filters

| Field                     | Type     | Operators                                  |
| ------------------------- | -------- | ------------------------------------------ |
| `entity_id`               | `string` | equals, contains, startsWith, endsWith, in |
| `api_key_expiration_date` | `string` | equals, contains, startsWith, endsWith, in |
| `subscription`            | `string` | equals, contains, startsWith, endsWith, in |
| `units_limit_api_key`     | `number` | equals, gt, gte, lt, lte, in               |
| `units_limit_workspace`   | `number` | equals, gt, gte, lt, lte, in               |
| `units_usage_api_key`     | `number` | equals, gt, gte, lt, lte, in               |
| `units_usage_workspace`   | `number` | equals, gt, gte, lt, lte, in               |
| `usage_reset_date`        | `string` | equals, contains, startsWith, endsWith, in |
| `updatedAt`               | `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).*

***
