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

# API

> API reference for Ahrefs: every `ahrefs.api.*` operation with input and output types.

Every `ahrefs.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

<Info>
  **New to Corsair?** See [API access](/concepts/api), [authentication](/concepts/auth), and [error handling](/concepts/error-handling).
</Info>

## Keywords Explorer

### overview

`keywordsExplorer.overview`

Get keyword metrics such as volume, difficulty, CPC, clicks, and traffic potential

**Risk:** `read`

```ts theme={null}
await corsair.ahrefs.api.keywordsExplorer.overview({});
```

**Input**

| Name                       | Type                                      | Required | Description |
| -------------------------- | ----------------------------------------- | -------- | ----------- |
| `timeout`                  | `number`                                  | No       | —           |
| `limit`                    | `number`                                  | No       | —           |
| `order_by`                 | `string`                                  | No       | —           |
| `where`                    | `string`                                  | No       | —           |
| `select`                   | `string`                                  | Yes      | —           |
| `volume_monthly_date_to`   | `string`                                  | No       | —           |
| `volume_monthly_date_from` | `string`                                  | No       | —           |
| `target_mode`              | `exact \| prefix \| domain \| subdomains` | No       | —           |
| `target`                   | `string`                                  | No       | —           |
| `target_position`          | `in_top10 \| in_top100`                   | No       | —           |
| `country`                  | `string`                                  | Yes      | —           |
| `keywords`                 | `string \| string[]`                      | No       | —           |
| `keyword_list_id`          | `number`                                  | No       | —           |
| `output`                   | `json`                                    | No       | —           |

**Output**

| Name       | Type       | Required | Description |
| ---------- | ---------- | -------- | ----------- |
| `keywords` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="keywords full type">
    ```ts theme={null}
    {
      clicks?: number | null,
      cpc?: number | null,
      cps?: number | null,
      difficulty?: number | null,
      first_seen?: string | null,
      global_volume?: number | null,
      intents?: {
        informational?: boolean,
        navigational?: boolean,
        commercial?: boolean,
        transactional?: boolean,
        branded?: boolean,
        local?: boolean
      } | null,
      keyword: string,
      parent_topic?: string | null,
      parent_volume?: number | null,
      searches_pct_clicks_organic_and_paid?: number | null,
      searches_pct_clicks_organic_only?: number | null,
      searches_pct_clicks_paid_only?: number | null,
      serp_features?: string[],
      serp_last_update?: string | null,
      traffic_potential?: number | null,
      volume?: number | null,
      volume_desktop_pct?: number | null,
      volume_mobile_pct?: number | null,
      volume_monthly?: number | null,
      volume_monthly_history?: {
      }[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

## Rank Tracker

### overview

`rankTracker.overview`

Get Rank Tracker keyword overview data for a project and device

**Risk:** `read`

```ts theme={null}
await corsair.ahrefs.api.rankTracker.overview({});
```

**Input**

| Name            | Type                 | Required | Description |
| --------------- | -------------------- | -------- | ----------- |
| `timeout`       | `number`             | No       | —           |
| `limit`         | `number`             | No       | —           |
| `order_by`      | `string`             | No       | —           |
| `where`         | `string`             | No       | —           |
| `select`        | `string`             | Yes      | —           |
| `date_compared` | `string`             | No       | —           |
| `date`          | `string`             | Yes      | —           |
| `device`        | `desktop \| mobile`  | Yes      | —           |
| `project_id`    | `number`             | Yes      | —           |
| `volume_mode`   | `monthly \| average` | No       | —           |
| `output`        | `json`               | No       | —           |

**Output**

| Name        | Type       | Required | Description |
| ----------- | ---------- | -------- | ----------- |
| `overviews` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="overviews full type">
    ```ts theme={null}
    {
      keyword?: string | null,
      country?: string,
      device?: string,
      position?: number | null,
      previous_position?: number | null,
      best_position_kind?: string | null,
      clicks?: number | null,
      volume?: number | null,
      traffic?: number | null,
      url?: string | null
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

## Serp

### overview

`serp.overview`

Get SERP positions for a keyword and country, including ranking page metrics

**Risk:** `read`

```ts theme={null}
await corsair.ahrefs.api.serp.overview({});
```

**Input**

| Name            | Type     | Required | Description |
| --------------- | -------- | -------- | ----------- |
| `select`        | `string` | Yes      | —           |
| `top_positions` | `number` | No       | —           |
| `date`          | `string` | No       | —           |
| `country`       | `string` | Yes      | —           |
| `keyword`       | `string` | Yes      | —           |
| `output`        | `json`   | No       | —           |

**Output**

| Name        | Type       | Required | Description |
| ----------- | ---------- | -------- | ----------- |
| `positions` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="positions full type">
    ```ts theme={null}
    {
      position: number,
      url?: string | null,
      title?: string | null,
      type?: string[],
      domain_rating?: number | null,
      ahrefs_rank?: number | null,
      backlinks?: number | null,
      refdomains?: number | null,
      traffic?: number | null,
      value?: number | null,
      update_date?: string | null
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

## Site Explorer

### backlinksStats

`siteExplorer.backlinksStats`

Get live and all-time backlink and referring-domain counts for a target

**Risk:** `read`

```ts theme={null}
await corsair.ahrefs.api.siteExplorer.backlinksStats({});
```

**Input**

| Name       | Type                                      | Required | Description |
| ---------- | ----------------------------------------- | -------- | ----------- |
| `protocol` | `both \| http \| https`                   | No       | —           |
| `target`   | `string`                                  | Yes      | —           |
| `date`     | `string`                                  | Yes      | —           |
| `output`   | `json`                                    | No       | —           |
| `mode`     | `exact \| prefix \| domain \| subdomains` | No       | —           |

**Output**

| Name      | Type     | Required | Description |
| --------- | -------- | -------- | ----------- |
| `metrics` | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="metrics full type">
    ```ts theme={null}
    {
      all_time?: number | null,
      all_time_refdomains?: number | null,
      live?: number | null,
      live_refdomains?: number | null
    }
    ```
  </Accordion>
</AccordionGroup>

***

### getDomainRating

`siteExplorer.getDomainRating`

Get Ahrefs Domain Rating and Ahrefs Rank for a target

**Risk:** `read`

```ts theme={null}
await corsair.ahrefs.api.siteExplorer.getDomainRating({});
```

**Input**

| Name       | Type                    | Required | Description |
| ---------- | ----------------------- | -------- | ----------- |
| `protocol` | `both \| http \| https` | No       | —           |
| `target`   | `string`                | Yes      | —           |
| `date`     | `string`                | Yes      | —           |
| `output`   | `json`                  | No       | —           |

**Output**

| Name            | Type     | Required | Description |
| --------------- | -------- | -------- | ----------- |
| `domain_rating` | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="domain_rating full type">
    ```ts theme={null}
    {
      ahrefs_rank?: number | null,
      domain_rating?: number | null
    }
    ```
  </Accordion>
</AccordionGroup>

***

### organicKeywords

`siteExplorer.organicKeywords`

List organic keywords a target ranks for, including positions and traffic metrics

**Risk:** `read`

```ts theme={null}
await corsair.ahrefs.api.siteExplorer.organicKeywords({});
```

**Input**

| Name            | Type                                      | Required | Description |
| --------------- | ----------------------------------------- | -------- | ----------- |
| `protocol`      | `both \| http \| https`                   | No       | —           |
| `target`        | `string`                                  | Yes      | —           |
| `date`          | `string`                                  | Yes      | —           |
| `output`        | `json`                                    | No       | —           |
| `timeout`       | `number`                                  | No       | —           |
| `limit`         | `number`                                  | No       | —           |
| `order_by`      | `string`                                  | No       | —           |
| `where`         | `string`                                  | No       | —           |
| `select`        | `string`                                  | Yes      | —           |
| `mode`          | `exact \| prefix \| domain \| subdomains` | No       | —           |
| `country`       | `string`                                  | Yes      | —           |
| `date_compared` | `string`                                  | No       | —           |
| `volume_mode`   | `monthly \| average`                      | No       | —           |

**Output**

| Name       | Type       | Required | Description |
| ---------- | ---------- | -------- | ----------- |
| `keywords` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="keywords full type">
    ```ts theme={null}
    {
      keyword?: string | null,
      keyword_country?: string,
      best_position?: number | null,
      best_position_url?: string | null,
      keyword_difficulty?: number | null,
      volume?: number | null,
      cpc?: number | null,
      sum_traffic?: number | null,
      serp_features?: string[],
      last_update?: string | null,
      status?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### refdomains

`siteExplorer.refdomains`

List referring domains linking to a target

**Risk:** `read`

```ts theme={null}
await corsair.ahrefs.api.siteExplorer.refdomains({});
```

**Input**

| Name       | Type                                      | Required | Description |
| ---------- | ----------------------------------------- | -------- | ----------- |
| `protocol` | `both \| http \| https`                   | No       | —           |
| `target`   | `string`                                  | Yes      | —           |
| `date`     | `string`                                  | Yes      | —           |
| `output`   | `json`                                    | No       | —           |
| `timeout`  | `number`                                  | No       | —           |
| `limit`    | `number`                                  | No       | —           |
| `order_by` | `string`                                  | No       | —           |
| `where`    | `string`                                  | No       | —           |
| `select`   | `string`                                  | Yes      | —           |
| `mode`     | `exact \| prefix \| domain \| subdomains` | No       | —           |
| `history`  | `string`                                  | No       | —           |

**Output**

| Name         | Type       | Required | Description |
| ------------ | ---------- | -------- | ----------- |
| `refdomains` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="refdomains full type">
    ```ts theme={null}
    {
      domain: string,
      domain_rating?: number | null,
      dofollow_links?: number | null,
      dofollow_refdomains?: number | null,
      links?: number | null,
      refdomains?: number | null,
      first_seen?: string | null,
      last_visited?: string | null
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### topPages

`siteExplorer.topPages`

List top organic pages for a target with traffic, keyword, and link metrics

**Risk:** `read`

```ts theme={null}
await corsair.ahrefs.api.siteExplorer.topPages({});
```

**Input**

| Name            | Type                                      | Required | Description |
| --------------- | ----------------------------------------- | -------- | ----------- |
| `protocol`      | `both \| http \| https`                   | No       | —           |
| `target`        | `string`                                  | Yes      | —           |
| `date`          | `string`                                  | Yes      | —           |
| `output`        | `json`                                    | No       | —           |
| `timeout`       | `number`                                  | No       | —           |
| `limit`         | `number`                                  | No       | —           |
| `order_by`      | `string`                                  | No       | —           |
| `where`         | `string`                                  | No       | —           |
| `select`        | `string`                                  | Yes      | —           |
| `mode`          | `exact \| prefix \| domain \| subdomains` | No       | —           |
| `country`       | `string`                                  | Yes      | —           |
| `date_compared` | `string`                                  | No       | —           |
| `volume_mode`   | `monthly \| average`                      | No       | —           |

**Output**

| Name    | Type       | Required | Description |
| ------- | ---------- | -------- | ----------- |
| `pages` | `object[]` | Yes      | —           |

<AccordionGroup>
  <Accordion title="pages full type">
    ```ts theme={null}
    {
      raw_url: string,
      keywords?: number | null,
      referring_domains?: number | null,
      sum_traffic?: number | null,
      value?: number | null,
      page_type?: string | null,
      status?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

## Subscription Info

### limitsAndUsage

`subscriptionInfo.limitsAndUsage`

Get Ahrefs subscription limits and API unit usage

**Risk:** `read`

```ts theme={null}
await corsair.ahrefs.api.subscriptionInfo.limitsAndUsage({});
```

**Input**

| Name     | Type   | Required | Description |
| -------- | ------ | -------- | ----------- |
| `output` | `json` | No       | —           |

**Output**

| Name               | Type     | Required | Description |
| ------------------ | -------- | -------- | ----------- |
| `limits_and_usage` | `object` | Yes      | —           |

<AccordionGroup>
  <Accordion title="limits_and_usage full type">
    ```ts theme={null}
    {
      api_key_expiration_date: string,
      subscription: string,
      units_limit_api_key?: number | null,
      units_limit_workspace?: number | null,
      units_usage_api_key: number,
      units_usage_workspace?: number | null,
      usage_reset_date: string
    }
    ```
  </Accordion>
</AccordionGroup>

***
