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

# Moz plugin

> SEO data with Moz - site metrics (Domain Authority, Page Authority, Spam Score, Brand Authority, histories), backlinks, linking domains, anchor texts, top pages, ranking keywords, keyword metrics, SERPs and suggestions, competitors, global top lists, and Moz Local accounts, groups, locations, listings and insights.

Use **Moz** through Corsair: one client, typed API calls, and incoming webhooks.

Generate an API token on the Moz API dashboard
([https://api.moz.com](https://api.moz.com)) and Corsair sends it in the x-moz-token header on
every call. The Moz API is JSON-RPC 2.0: one endpoint
([https://api.moz.com/jsonrpc](https://api.moz.com/jsonrpc)), one POST per operation, with the method
name in the request body.

* **Quota is per row.** Responses carry no row count; quota.lookup
  reports the usage and allowance of a bucket for free. Metrics, link and
  keyword methods charge api.limits.data.rows (one row per call, per
  returned result or per returned metric value); the competitor fetch
  draws on the separate api.limits.mozscape.rows bucket. Lists default to
  25 results, so pass a limit to control the cost.
* **Errors are JSON-RPC envelopes** with a stable `code`: -32651 is a bad
  token (401), -32670 is exhausted quota (403), -32658 and -32650 are the
  two 429 rate limits (a per-method one with Retry-After and an edge one
  without). Errors come back as core ApiErrors carrying that code; core
  retries an HTTP 429 and nothing else is retried.
* **The competitor lookup is asynchronous.** competitors.fetch answers
  with an async\_call receipt; follow it with jobs.lookup until the status
  is complete, then read async\_call.result (or .error). Poll no more than
  once every five seconds; lookups are free.
* **Two paging styles.** Link, linking-domain, anchor-text and top-page
  lists take offset.limit (1-50) and an optional offset.token; pass the
  response's offset.token for the next page (null when there is none).
  global.topDomains, global.topPages, keywords.suggestions and
  rankingKeywords.list take page.n (0 for the first page) and page.limit;
  raise page.n by one for each next page.
* **Keywords.** keywords.metrics returns difficulty, volume, organic CTR
  and priority at once (four rows); search intent is opt-in with
  options.include\_intent until December 1, 2026 and returned by default
  from that date, for one more row when available. The single-metric
  fetches cost one row each. keywords.suggestions, keywords.generateMetrics and
  keywords.generateSerp are asynchronous; the two generate methods start a
  fresh SERP collection billed per call, so they are destructive.
* **Moz Local** (local.\*) manages business listings for Moz Local
  customers; most of it is Enterprise only. Creating a location adds a
  billed listing; cancelling, closing and changing a location's level
  change billing or unpublish it, so those are destructive.
* **Webhooks.** Moz sends Moz Local location events (created, updated,
  canceled, closed) with the Standard Webhooks signature. Moz's team sets
  them up per account; save the `whsec_` secret as the account's
  webhook\_signature (or the webhookSecret option).
* **Schemas come from Moz's method reference.** Inputs follow each
  method's payload definition and reject unknown fields; Moz Local inputs
  stay open because Moz's own examples use fields its schema leaves out.
  Responses are parsed leniently.

**What you get:**

* 74 typed API operations
* 4 incoming webhook event types

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/moz better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/moz better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/moz better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/moz better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { moz } from '@corsair-dev/moz';

export const corsair = createCorsair({
	plugins: [
		moz(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> Store the Moz API key before the first call: `pnpm corsair setup --plugin=moz --tenant=acme api_key=<your-key>` (leave out `--tenant` without `multiTenancy`), or pass it as `key` in the plugin options. With Hub, each tenant enters their own key on the connect page. See [API key auth](https://docs.corsair.dev/concepts/api-key).
>
> ```ts theme={null}
> moz()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'moz',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**Read site metrics for moz.com**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.moz.api.metrics.fetch({
	site_query: { query: 'moz.com', scope: 'domain' },
});
```

**`keywords.generateMetrics`**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.moz.api.keywords.generateMetrics({});
```

See the full list on the [API](https://docs.corsair.dev/plugins/moz/api.md) page.

## Webhooks

This plugin registers **4** webhook event types. Configure the provider to POST to your Corsair HTTP handler, then use `webhookHooks` on the plugin factory.

See [Webhooks](https://docs.corsair.dev/plugins/moz/webhooks.md) for every event path and payload shape, and [Webhooks concept](https://docs.corsair.dev/concepts/webhooks.md) for routing.

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/moz/api.md)
>
> Every `moz.api.*` operation with input and output types.

> [card] [Webhooks](https://docs.corsair.dev/plugins/moz/webhooks.md)
>
> Event paths, payloads, and `webhookHooks` examples.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.