# API keys

Source: https://www.scanner.net/docs/api/keys

> Create secret API keys, authenticate server-side requests, and understand endpoint scopes, expiry, errors, rate limits, billing, rotation, and IP allowlists.

The Scanner API runs the same scans, traces and lookups as the dashboard, from your own servers, using a secret API key you create.

Eligibility [#who-gets-access]

API access comes with the **Scale** and **Enterprise** plans. Your plan is checked on every request.

* An active plan qualifies, with up to 3 days of grace for a renewal to go through.
* A cancelled plan keeps working until the end of the period you paid for.
* When the plan lapses, or moves to one without API access, keys pause and return `API_PLAN_REQUIRED`. They start working again as soon as the plan does, and you can still view and revoke them meanwhile.

See [pricing](/pricing).

Create a key [#create-a-key]

1. Open [API](/dashboard/api), select **Create key**, and name it (for example after the service or environment that uses it).
2. Optionally narrow it. A new key has full access, never expires and uses your plan's rate limit. You can limit its [endpoint groups](#endpoint-scopes), set an [expiry](#expiry), lower its [requests per minute](#rate-limits), or add an [IP allowlist](#ip-allowlist). An allowlist also stops the key working on the [Indexer](#indexer).
3. Copy the secret into a secret manager.

Keys look like `sk_live_` followed by 43 letters and numbers. The full key is shown once, when you create or roll it; Scanner stores only a hash, so a lost key can't be shown again. Roll it instead.

Limit: 5 active keys per account. Keys in their 24-hour rotation grace period don't count; a key with an expiry counts until it expires.

Authenticate [#authenticate]

Use either header:

```bash
curl -X POST "https://api.scanner.net/scan" \
  -H "Authorization: Bearer $SCANNER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"address":"WALLET_ADDRESS","depth":0}'
```

```bash
curl "https://api.scanner.net/v1/whoami" \
  -H "x-api-key: $SCANNER_API_KEY"
```

Send one credential per request. Multiple credential headers, or a secret key plus an embed key, return `400 INVALID_INPUT`.

* **Never put a key in a URL.** URLs end up in logs, proxies and browser history, so a key in the query string or path is rejected with `API_KEY_IN_URL`. If that happens, roll the key.
* **Never use a key in a browser.** Browser requests (an `Origin` header with `Sec-Fetch-Mode: cors`/`navigate` or `Sec-Fetch-Site`) are rejected with `API_KEY_BROWSER_NOT_ALLOWED`. Call the API from your backend; for a browser widget, use the [Embed API](/docs/embed/overview).

Server clients sending `Origin` without browser `Sec-Fetch-*` headers are accepted.

Endpoints [#endpoints]

Solana and Robinhood scanning/lookups:

| Group                       | Paths                                              |
| --------------------------- | -------------------------------------------------- |
| Wallet/token scans          | `/scan`, `/contracts`, `/rh/scan`, `/rh/contracts` |
| Funding/cross-chain         | `/funding-chain`, `/cross-chain`                   |
| Explorer                    | `/explorer`, `/rh/explorer`                        |
| Detection/identity/holdings | `/detect`, `/identities`, `/holdings`              |
| Wallet Finder               | `/wallet-finder`, `/rh/wallet-finder`              |
| Traders/KOLs/bundles        | `/alpha`, `/kol`, `/bundles`                       |

These are path prefixes. The [Scanner API reference](/docs/api/reference/conventions) lists every route under them, with parameters, examples, responses and errors.

Account, billing, and admin routes return `API_KEY_ROUTE_NOT_ALLOWED`. For the Robinhood Chain Indexer, see [Indexer](#indexer).

Endpoint scopes [#endpoint-scopes]

A key can call every group above by default. Limit it to some groups when you create it, or later with **Edit** on the [API](/dashboard/api) page. Switching back to full access removes the limit, and a full-access key picks up groups added later.

The team can also limit a key, or every key on an account, on request. Those limits win: you can narrow a key further but not past them, and the dashboard only offers the groups they allow. The **Access** column shows what each key can call now and who set each limit.

A call outside a key's groups returns `403 API_KEY_SCOPE_NOT_ALLOWED`, lists the allowed groups in `allowedRouteGroups`, and doesn't count toward the rate limit. `/v1/whoami` and `/v1/usage` always work. Scope changes appear in the key's activity list.

Expiry [#expiry]

Keys never expire unless you pick an expiry at creation: 30 days, 90 days, a year, or a date up to two years out. After it, the key returns `API_KEY_REVOKED`. The expiry can't be changed later, so create a new key when it runs out. Rolling a key keeps its expiry.

Check a key [#check-a-key]

Both routes consume rate-limit requests, without spending scans.

| Route            | Response                                                                                            |
| ---------------- | --------------------------------------------------------------------------------------------------- |
| `GET /v1/whoami` | Account, key, plan, effective requests/minute                                                       |
| `GET /v1/usage`  | Remaining scans, effective limit, daily requests by endpoint/status class. `days`: 1–90; default 30 |

```bash
curl "https://api.scanner.net/v1/usage?days=7" \
  -H "Authorization: Bearer $SCANNER_API_KEY"
```

Errors [#errors]

```json
{ "error": "Invalid API key", "code": "API_KEY_INVALID", "requestId": "..." }
```

| Status | Code                          | Meaning                                                                                 |
| ------ | ----------------------------- | --------------------------------------------------------------------------------------- |
| 400    | `API_KEY_IN_URL`              | Key sent in a URL; use a header and roll the key.                                       |
| 400    | `INVALID_INPUT`               | More than one credential; send one key in one header.                                   |
| 401    | `API_KEY_INVALID`             | Unknown key; check for typos or whitespace.                                             |
| 401    | `API_KEY_REVOKED`             | Key revoked, expired, or past its rotation grace period.                                |
| 403    | `API_KEY_BROWSER_NOT_ALLOWED` | Browser request (`Origin` plus browser `Sec-Fetch-*`); call from a server.              |
| 403    | `API_KEY_ROUTE_NOT_ALLOWED`   | Route isn't available with an API key.                                                  |
| 403    | `API_KEY_IP_NOT_ALLOWED`      | Request IP isn't on the key's allowlist.                                                |
| 403    | `API_PLAN_REQUIRED`           | Plan has no API access; the body includes `upgradeUrl`.                                 |
| 403    | `API_KEY_SCOPE_NOT_ALLOWED`   | Key is limited to other endpoint groups, listed in `allowedRouteGroups`.                |
| 403    | `FORBIDDEN`                   | API access is switched off for the account; contact us through [Help](/dashboard/help). |
| 402    | `INSUFFICIENT_CREDITS`        | Not enough scans left for this request.                                                 |
| 429    | `API_KEY_RATE_LIMITED`        | Key's per-minute limit reached; wait `Retry-After` seconds.                             |
| 429    | `RATE_LIMITED`                | Too many invalid keys from your IP (30/minute); wait `Retry-After` seconds.             |
| 503    | `INTERNAL_ERROR`              | Key verification briefly unavailable; retry after a short delay.                        |

Rate limits [#rate-limits]

Rolling per-minute limits are shared across servers. Every request checks key and account buckets.

| Plan       | Requests/minute                     |
| ---------- | ----------------------------------- |
| Scale      | 120                                 |
| Enterprise | 600 default; adjustable by contract |

Keys share the account ceiling: five Scale keys still total 120 requests/minute, not 120 each. `X-RateLimit-Limit` reports the lower of the two buckets for the key that made the request.

You can set a lower limit on any key, when you create it or with **Edit**, for example so one service can't use the whole account's budget. Leave it blank for the default. It can't go above the plan's limit or a limit the team set, and the account bucket stays the same.

Successful responses include `X-RateLimit-Limit` and `X-RateLimit-Remaining`. The window is rolling, so `X-RateLimit-Remaining` is an estimate under concurrent requests. A `429` includes `Retry-After` seconds; wait that long before retrying.

Billing [#billing]

Requests spend plan scans exactly like the dashboard: Quick 1, Standard 2, Max 4, token 1 ([scan costs](/docs/scanner#scan-depth-and-cost)). A funding chain trace and a live cross-chain lookup spend 1 each; [Cost](/docs/api/reference/conventions#cost) in the reference lists every route. Cached results and dashboard-free lookups are free; failed scans refund automatically.

[API](/dashboard/api) shows daily/per-key requests and scans for 30 days; reporting may lag one minute.

Rotation [#rotation]

**Roll** replaces the secret and keeps the key's name, IP allowlist, endpoint groups, rate limit and expiry. Choose **Keep old key working for 24 hours** for routine rotation (the old key stops after 24 hours, or at its own expiry if sooner), or **Revoke old key now** when a key has leaked.

**Revoke** stops one key; **Revoke all** stops every key on the account. Revocation, rolls and plan changes apply on every server as soon as they're saved; if the servers briefly lose contact, a change can take up to 5 seconds.

Creating, rolling, revoking and revoke-all email the account with the key name, time and IP. Renames and allowlist, endpoint group and rate limit edits appear only in the activity list. Wallet-only accounts without an email get the activity list alone.

IP allowlist [#ip-allowlist]

One IPv4/IPv6 address or CIDR per line, e.g. `203.0.113.10` or `198.51.100.0/24`. Empty accepts all IPs; non-matches return `API_KEY_IP_NOT_ALLOWED`.

* At most 50 entries per key. `/0` is rejected: it would match every address.
* A single address is stored as `/32` (IPv4) or `/128` (IPv6).
* Ranges are stored by network address: `10.0.0.5/8` is saved as `10.0.0.0/8`. Check saved ranges.
* The [Indexer](#indexer) refuses any key with an allowlist, since it can't check the caller's IP. Use a separate key without one there.

Indexer [#indexer]

The [Robinhood Chain Indexer](/docs/indexer/api#authentication-and-limits) is at `https://rh-indexer.scanner.net`, under `/index/v1/robinhood/`. Where Scanner key verification is on, a Scale or Enterprise `sk_live_` key works there too, in `x-api-key` or as `Authorization: Bearer`. It gets the indexer routes its plan includes, narrowed by the key's **Indexer** endpoint groups, and the key's per-minute limit. Revocation, expiry and plan changes reach the indexer within about 10 seconds. A key with an IP allowlist gets `403 ip_allowlist_unsupported`.

Stream, live RPC and add-on routes need an indexer key, issued by hand: email [payments@scanner.net](mailto:payments@scanner.net) with the routes you need.

Activity list [#activity-list]

[API activity](/dashboard/api) records key changes and blocked attempts: IPs outside the allowlist, revoked keys, plans without API access, and calls outside a key's scopes. Blocked attempts log at most once per 10 minutes per key and kind, so an entry means it happened, not how often; use daily usage for volume.

Security practices [#security-practices]

* Store secrets in a secret manager or environment, outside source control.
* One key per service or environment, with only the endpoint groups it needs and an expiry for short-lived uses.
* Add an IP allowlist when your egress IPs are fixed.
* Roll keys on a schedule and when someone with access leaves; check the activity list for blocked attempts.
* If a key leaks, roll it with **Revoke old key now** and check usage for requests you don't recognize.
