> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gainflow.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> API keys for your code, OAuth for AI apps.

Every request needs a bearer token in the `Authorization` header. Gainflow accepts two kinds.

| Token | Looks like | Use it for |
| - | - | - |
| API key | `gf_live_...` | Your code, scripts, servers, Claude Code |
| OAuth access token | A signed JWT | Claude, ChatGPT and Cursor connectors. They get it for you when you sign in. |

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
Authorization: Bearer gf_live_...
```

## API keys

Create and revoke keys in the [dashboard](https://gainflow.ai/dashboard). A key is shown once, when you create it. We keep only its hash, so a lost key cannot be recovered: revoke it and create a new one.

Revoking a key takes effect at once.

> [!WARNING]
>
> Treat keys like passwords. Keep them in environment variables or a secret
> manager, never in client-side code or a public repo.

## OAuth for AI apps

The MCP server at `https://mcp.gainflow.ai/mcp` supports OAuth 2.1. When you add Gainflow as a connector, the app opens a Gainflow sign-in window and receives a token for your account. See [Connect AI apps](https://docs.gainflow.ai/mcp.md).

Managing API keys and billing (`/v1/account/api-keys`, `/v1/billing/*`) needs a signed-in OAuth session. An API key cannot create or revoke other keys.


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