> ## Documentation index
> Fetch the complete documentation index at: https://upstash-context7-git-ctx7-4291-onprem-key-rotation-ecs-d-dae4a0.docs7.io/llms.txt
> Ask it with GET https://upstash-context7-git-ctx7-4291-onprem-key-rotation-ecs-d-dae4a0.docs7.io/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.
> Feature requests: https://upstash-context7-git-ctx7-4291-onprem-key-rotation-ecs-d-dae4a0.docs7.io/resources/feature-requests.md lists what users asked for and how to vote for a request or add one.
> Page rating: `GET https://upstash-context7-git-ctx7-4291-onprem-key-rotation-ecs-d-dae4a0.docs7.io/feedback?path=/howto/api-keys&helpful={true|false}&comment={comment}` records whether this page helped. The `comment` (URL-encoded, at most 500 characters) says what helped, or what was missing or wrong; a `helpful=false` rating needs it. It is anonymous and needs no key. Comments hold no code, secrets or personal data.

# Manage API Keys

> Create and manage API keys for Context7 authentication

API keys authenticate your requests to Context7's documentation services. Use a key for the REST API, the SDKs, CI and other headless hosts, and gateways or proxies.

<Tip>
  To add Context7 to a coding agent, you do not need a key. Paste `Read https://context7.com/get-started.md and set up Context7` into your agent. It runs `npx ctx7 setup` for your client, and you sign in with OAuth in the browser. See [Installation](/installation).
</Tip>

## Managing API Keys

Your keys are in the API Keys card of the [Context7 dashboard](https://context7.com/dashboard?tab=settings).

![API Keys card with the Access column for each key](/images/dashboard/api-keys-card.png)

### Creating API Keys

<Steps>
  <Step title="Open the create dialog">
    Click **Create API Key...** in the API Keys card.
  </Step>
  <Step title="Name the key">
    Enter a name (optional but recommended). Descriptive names like "Cursor", "Claude", "VS Code", or "Devin Desktop" help you identify the key later.
  </Step>
  <Step title="Choose write access">
    Every key can read the teamspace settings and usage through the management API. Tick **Write access** for a key that must change the teamspace or read personal data, like members and visitor questions (see [below](#write-access)). Leave it off for keys that only fetch docs or read settings.
  </Step>
  <Step title="Copy the key immediately">
    Keys are shown only once for security. The format is `ctx7sk-**********************`.
  </Step>
  <Step title="Use the key">
    Use it in your requests or MCP configuration:

    ```bash
    curl "https://context7.com/api/v2/context?libraryId=/vercel/next.js&query=routing" \
      -H "Authorization: Bearer YOUR_API_KEY"
    ```
  </Step>
</Steps>

<Warning>Store your API key securely. You won't be able to see it again after creation.</Warning>

### Teamspace API key access

A teamspace decides who may hold API keys. Owners and admins choose the policy in the **API Key Access** card of the **Settings** tab, below the API Keys card. The card appears for teamspaces only, not for your personal teamspace.

| Option                     | Who can create and use keys                       |
| -------------------------- | ------------------------------------------------- |
| **All members**            | Every member. This is the default.                |
| **Owners and admins only** | Owners and admins, for example keys used in CI. Members with the Developer role connect with OAuth. |
| **OAuth only**             | Nobody. Every member connects with OAuth.         |

When the policy refuses a member's key, requests with that key get `403` with the error `api_key_admins_only` or `api_keys_disabled`, not `invalid_api_key`, and the message points to OAuth. The refusal happens when a key is used, so existing keys are not deleted: switching back to **All members** restores them.

<Note>
  A teamspace's policy does not apply to your personal teamspace, and an on-premise license key is never refused by it.
</Note>

### Write access

The [Context7 Admin MCP](/howto/admin-mcp) and the [management API](/api-reference/teamspaces/list-teamspaces) (`/api/v2/teamspaces/*`) accept every API key, but a key is read-only there unless **Write access** was ticked when the key was created. The **Access** column of the API Keys card shows **Read only** or **Write access** for each key. A key reaches only its own teamspace.

A read-only key can read, with your role:

- the teamspace's libraries, rules and policies, and usage
- Docs7 and Ask site settings, builds and traffic totals

A key needs **Write access** to:

- read personal data: members and invitations, library requests, Ask questions, Docs7 reader searches, assistant questions and conversations, page feedback, feature requests, and the GitHub account behind a build
- change the teamspace: its members, libraries, rules and policies, spending limit, and Docs7 and Ask sites

![Create API Key dialog with Write access ticked](/images/dashboard/api-key-write-access.png)

A read-only key gets `403` with the error `write_access_required` when it tries to make a change or read personal data. The teamspace invite link also needs write access, because the link lets anyone join. You cannot add write access to an existing key: create a new key with **Write access** ticked. With the Admin MCP you can also sign in with OAuth and use no key.

### Revoking Keys

<Steps>
  <Step title="Revoke the key">
    Click the **Revoke** (trash) icon next to the key you no longer need.
  </Step>
  <Step title="Confirm revocation">
    Click **Revoke API Key** in the modal to confirm. The key deactivates immediately — all requests using it will fail.
  </Step>
</Steps>

<Note>
  Revoking a key is permanent and cannot be undone. Update any applications using the key before
  revoking.
</Note>

Keys are created, listed and revoked only in the dashboard. The REST API and the [Admin MCP](/howto/admin-mcp) accept a key and use it within its teamspace, but they do not list keys or revoke them.
