> For the complete documentation index, see [llms.txt](https://docs.gradient.works/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gradient.works/kb/api-and-mcp/api-keys.md).

# API Keys & Connections

API keys and MCP connections are how you grant external tools access to your Gradient Works account. Both are managed in **Settings → Security** and can be revoked at any time.

{% hint style="info" %}
Only account admins can create and revoke API keys or disconnect MCP connections.
{% endhint %}

## API keys

API keys give direct, programmatic access to the Gradient Works API. They are best for scripts, automations, and integrations that run without a human in the loop — for example, a nightly job that runs a distribution or syncs data to another system.

### Create an API key

1. Go to **Settings → Security → API Keys**.
2. Click **Create API Key**.
3. Enter a descriptive name (e.g., "Data Sync Script").
4. Choose your access level:
   * **Read-only** — can query and read data; cannot make changes
   * **Full access** — can read and write data (create, update records)
5. Click **Generate Key**.
6. **Copy the key immediately** — it will not be shown again.

Use the key in API requests as a bearer token:

```
Authorization: Bearer <your-api-key>
```

### Revoke an API key

1. Go to **Settings → Security → API Keys**.
2. Click **Revoke** next to the key you want to remove.
3. Confirm the revocation.

Revocation takes effect immediately — any request using that key is rejected.

## MCP connections

When you connect an AI assistant (Claude, ChatGPT, etc.) using the setup guides, it goes through an OAuth flow that creates an MCP connection. Each connection is backed by a Gradient Works API key whose access level is capped by your user role: **admins can choose read-only or full access; all other users are limited to read-only**. A connection can never exceed the permissions of the user who created it.

You can see all active connections and disconnect any of them from Settings → Security.

### Disconnect an MCP connection

1. Go to **Settings → Security → Connections**.
2. Click **Disconnect** next to the connection you want to remove.

Disconnecting revokes the underlying API key immediately. The AI assistant will need to reconnect and re-authorize to regain access.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gradient.works/kb/api-and-mcp/api-keys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
