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

# Authentication

> Connect with OAuth from a chat assistant, or send an MCP key from any other client.

The MCP server accepts two kinds of credential. Both go in the `Authorization` header, the only place the server reads them:

```http theme={null}
Authorization: Bearer YOUR_TOKEN
```

| | Connected app (OAuth) | MCP key |
| - | - | - |
| **For** | Claude, ChatGPT, Claude Code, other OAuth clients | Cursor, VS Code, n8n, scripts, your own agent |
| **You get it** | By approving the client on a Followr page | In **Settings > MCP**, or with the API |
| **Looks like** | `mcpat_...` | `48213\|kF3v...` |
| **Lasts** | 1 hour, refreshed by the client | Until it expires (optional) or you revoke it |

Each has its own [scopes and companies](https://docs.followr.ai/mcp/permissions.md), which you can change later.

> [!NOTE]
>
> MCP credentials work only on the MCP server, and REST API keys never work on it. Both cases get `401`.

## MCP keys

A key belongs to the user who created it, with its own scopes, and optionally a company limit and an expiry date.

### Create a key in the app

**1. Open Settings > MCP**

Go to [**Settings > MCP**](https://app.followr.ai/settings/mcp) and select **Create key**.

**2. Choose what it may do**

Name it after where it runs, for example `Cursor on my laptop`. Pick the scopes, the companies and an expiry.

**3. Copy the key**

It's shown only once. If you lose it, revoke it and create another.

### Create a key with the API

Send `POST /personalAccessTokens`, authenticated like any [REST API request](https://docs.followr.ai/authentication.md).

**name** `string` *required*

Up to 255 characters.

**is\_mcp\_key** `boolean` *required*

`true`. Sending `is_api_key: true` as well is refused.

**scopes** `string[]` (default: \["read", "write"])

Any of `read`, `write`, `publish`, `inbox`, `reply`, `media`, `settings`, `admin`. See [Permissions](https://docs.followr.ai/mcp/permissions.md).

**company\_ids** `integer[]`

Up to 200 companies you belong to. Leave it out for all of them.

**expires\_at** `string`

A future ISO 8601 date, for example `2027-06-01T00:00:00Z`. Leave it out or send `null` for no expiry.

**company\_id** `integer`

Only if your own plan lacks assistant access: a company whose owner's plan has it, where you are an owner or admin.

```bash cURL theme={null}
curl https://api.followr.ai/api/personalAccessTokens \
  --request POST \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Cursor on my laptop",
    "is_mcp_key": true,
    "scopes": ["publish", "media"],
    "company_ids": [1287],
    "expires_at": "2027-06-01T00:00:00Z"
  }'
```

```json Response (abridged) theme={null}
{
  "data": {
    "id": 48213,
    "name": "Cursor on my laptop",
    "is_api_key": false,
    "is_mcp_key": true,
    "scopes": ["read", "write", "publish", "media"],
    "company_ids": [1287],
    "token": "48213|kF3vQ9zLm2RtY7wXa1BcD4eG6hJ8nP0sUvW5xZ2qa9c41f7e",
    "last_used_at": null,
    "expires_at": "2027-06-01T00:00:00.000000Z",
    "revoked_at": null,
    "created_at": "2026-12-15T09:30:00.000000Z",
    "updated_at": "2026-12-15T09:30:00.000000Z"
  }
}
```

The key is in `data.token`, in this response only. The full object also says where the key was created (`ip`, `user_agent`, `device` and more).

| Status | Cause |
| - | - |
| `402` | Neither your plan nor the plan of `company_id`'s owner includes assistant access. |
| `403` | The access comes from `company_id`, and you aren't an owner or admin there. |
| `422` | Invalid input, such as a company you don't belong to, or `inbox` or `reply` without a plan that has the social inbox. |

### Use and revoke keys

Send the whole key, number and bar included:

```http theme={null}
Authorization: Bearer 48213|kF3vQ9zLm2RtY7wXa1BcD4eG6hJ8nP0sUvW5xZ2qa9c41f7e
```

* **List:** `GET /personalAccessTokens?filter[is_mcp_key]=true`. `last_used_at` updates at most once a minute.
* **Change:** `PUT /personalAccessTokens/{id}`. See [Permissions](https://docs.followr.ai/mcp/permissions.md#change-permissions-later).
* **Revoke:** **Revoke key** in the app, or the call below. It's immediate and permanent: requests get `401`. The key stays in the list with `revoked_at`.
* **Expiry:** after `expires_at`, requests get `401`.

```bash Revoke a key theme={null}
curl https://api.followr.ai/api/personalAccessTokens/48213 \
  --request PUT \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data '{"revoke": true}'
```

> [!WARNING]
>
> Anyone with a key can act on your companies within its scopes. Give each client its own key, limit it to the companies it needs, and revoke it when you stop using that client.

## Connected apps (OAuth)

> [!NOTE]
>
> Claude, ChatGPT and Claude Code do all of this for you. Read on only if you build your own client.

The server is its own OAuth 2.1 authorization server for public clients (no client secrets). It supports PKCE (`S256`), dynamic client registration (RFC 7591), client ID metadata documents, resource indicators (RFC 8707), the issuer in the authorization response (RFC 9207) and token revocation (RFC 7009).

### Endpoints

A call without a token gets `401`, with a header that points to the metadata:

```http theme={null}
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://api.followr.ai/.well-known/oauth-protected-resource/mcp", scope="mcp:read mcp:write mcp:publish mcp:inbox mcp:reply mcp:media mcp:settings mcp:admin"
```

From there, the client uses these endpoints in order. All are on `https://api.followr.ai` and need no authentication.

| Endpoint | Step |
| - | - |
| `GET /.well-known/oauth-protected-resource/mcp` | Protected resource metadata (RFC 9728). Also at `/.well-known/oauth-protected-resource`. |
| `GET /.well-known/oauth-authorization-server` | Authorization server metadata (RFC 8414) |
| `POST /oauth/register` | [Register](#register-a-client), unless the client has a metadata document |
| `GET /oauth/authorize` | The user [approves](#authorize) in the browser |
| `POST /oauth/token` | [Exchange the code](#exchange-the-code) for tokens, and [refresh](#refresh) them |
| `POST /oauth/revoke` | [End the connection](#revoke) |

```json Protected resource metadata theme={null}
{
  "resource": "https://api.followr.ai/mcp",
  "authorization_servers": ["https://api.followr.ai"],
  "scopes_supported": ["mcp:read", "mcp:write", "mcp:publish", "mcp:inbox", "mcp:reply", "mcp:media", "mcp:settings", "mcp:admin"],
  "bearer_methods_supported": ["header"],
  "resource_name": "Followr"
}
```

```json Authorization server metadata theme={null}
{
  "issuer": "https://api.followr.ai",
  "authorization_endpoint": "https://api.followr.ai/oauth/authorize",
  "token_endpoint": "https://api.followr.ai/oauth/token",
  "revocation_endpoint": "https://api.followr.ai/oauth/revoke",
  "registration_endpoint": "https://api.followr.ai/oauth/register",
  "scopes_supported": ["mcp:read", "mcp:write", "mcp:publish", "mcp:inbox", "mcp:reply", "mcp:media", "mcp:settings", "mcp:admin"],
  "response_types_supported": ["code"],
  "response_modes_supported": ["query"],
  "grant_types_supported": ["authorization_code", "refresh_token"],
  "token_endpoint_auth_methods_supported": ["none"],
  "revocation_endpoint_auth_methods_supported": ["none"],
  "code_challenge_methods_supported": ["S256"],
  "authorization_response_iss_parameter_supported": true,
  "client_id_metadata_document_supported": true
}
```

`scopes_supported` is the authoritative list of scopes on offer.

### Register a client

Send the client's metadata as JSON. The answer is `201`.

```bash cURL theme={null}
curl https://api.followr.ai/oauth/register \
  --header "Content-Type: application/json" \
  --data '{
    "client_name": "Northside agent",
    "client_uri": "https://agent.northside.example",
    "redirect_uris": ["http://127.0.0.1:33418/callback"]
  }'
```

```json Response theme={null}
{
  "client_id": "mcpc_Qm3rT8vXk2LpW9sYd4FhJ7nB1cZ6aE0gUiO5tRwq",
  "client_id_issued_at": 1797327000,
  "client_name": "Northside agent",
  "client_uri": "https://agent.northside.example",
  "redirect_uris": ["http://127.0.0.1:33418/callback"],
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"],
  "token_endpoint_auth_method": "none",
  "scope": "mcp:read mcp:write mcp:publish mcp:inbox mcp:reply mcp:media mcp:settings mcp:admin"
}
```

* `redirect_uris` (required): 1 to 10 URIs, each `https`, `http` on a loopback address (`localhost`, `127.0.0.1`, `[::1]`), or the `cursor`, `vscode` or `vscode-insiders` scheme. They must match exactly, except a loopback port.
* `grant_types` and `response_types`, if sent, must include `authorization_code` and `code`.
* `client_name` (up to 100 characters), `client_uri` and `logo_uri` (`https`) are optional. The consent screen shows the name as unverified.
* Registration is rate limited per address per hour. A client that never starts an authorization may be removed after 30 days.

A client can skip registration with a **client ID metadata document**: a `client_id` that is the `https` URL of a JSON document (public host, 16 KB max) with the same `client_id`, a `client_name` and `redirect_uris`. The consent screen shows its host.

### Authorize

Send the user's browser to `GET /oauth/authorize` with:

**response\_type** `string` *required*

`code`.

**client\_id** `string` *required*

The registered `client_id`, or the URL of the metadata document.

**redirect\_uri** `string` *required*

A registered redirect URI.

**code\_challenge** `string` *required*

Base64url SHA-256 of the code verifier, without padding.

**code\_challenge\_method** `string` *required*

`S256`.

**state** `string`

Returned unchanged. Up to 4,096 characters.

**scope** `string`

Space-separated, for example `mcp:read mcp:write`. Unknown values are ignored. With none of this server's scopes, the app asks for all of them.

**resource** `string`

If sent, `https://api.followr.ai/mcp`.

The consent screen shows the app's name, its host (or a warning that it can't be confirmed) and the redirect. The access level starts at the highest one requested, and the requested extras start on. The request is valid for 15 minutes, once.

The user approves with their own plan's assistant access, or as an owner or admin of the company selected in the app, if that company's owner has it.

| Outcome | Redirect to `redirect_uri` with |
| - | - |
| **Allow** | `code`, `state` and `iss` (`https://api.followr.ai`) |
| **Cancel** | `error=access_denied` |
| Invalid parameter | `error` and `error_description` |
| Unknown `client_id` or `redirect_uri` | No redirect: the browser stays on Followr. |

### Exchange the code

The code is valid for 120 seconds, once. Send form-encoded parameters (JSON works too):

```bash cURL theme={null}
curl https://api.followr.ai/oauth/token \
  --data-urlencode "grant_type=authorization_code" \
  --data-urlencode "code=AUTHORIZATION_CODE" \
  --data-urlencode "client_id=YOUR_CLIENT_ID" \
  --data-urlencode "code_verifier=YOUR_CODE_VERIFIER" \
  --data-urlencode "redirect_uri=http://127.0.0.1:33418/callback" \
  --data-urlencode "resource=https://api.followr.ai/mcp"
```

```json Response theme={null}
{
  "access_token": "mcpat_V4nQ7sK2xLp9RtW3yZb6Hc1Md8Fg5Jk0NqA2eS7uTwXvYi3o",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "mcprt_8pLs3Qm6Tz1Wc9Xv4Rb7Ny2Kd5Hg0Fj3Ae6Su9Ix2Ow5Ql8Zt1Ym4Vn7Bk0Cr3Ep6Gu",
  "scope": "mcp:read mcp:write mcp:publish"
}
```

`scope` is what the user granted, which can be less than requested. `redirect_uri` and `resource` are optional here, and checked if sent.

### Refresh

When the access token expires (after 1 hour), the MCP server answers `401` with `error="invalid_token"`. Refresh it:

```bash cURL theme={null}
curl https://api.followr.ai/oauth/token \
  --data-urlencode "grant_type=refresh_token" \
  --data-urlencode "refresh_token=YOUR_REFRESH_TOKEN" \
  --data-urlencode "client_id=YOUR_CLIENT_ID"
```

The answer has a new access token **and a new refresh token**:

* Each refresh token works once. Always store the new one.
* A refresh token lasts 90 days.
* Reusing a refresh token more than 60 seconds after its first use ends the connection. The user connects again.

### Revoke

Send `POST /oauth/revoke` with `token` (access or refresh) and, optionally, `client_id`. The answer is always `200`, empty. Either token ends the whole connection, like **Disconnect** in the app.

### OAuth errors

The token, registration and revocation endpoints return JSON errors:

```json theme={null}
{
  "error": "invalid_grant",
  "error_description": "The refresh token was already used. The connection was closed for safety. Connect again."
}
```

| `error` | HTTP | Cause |
| - | - | - |
| `invalid_request` | `400` | A required parameter is missing. |
| `invalid_grant` | `400` | Bad, expired, used or foreign code or refresh token, or a wrong PKCE verifier. For a refresh token, connect again. |
| `invalid_target` | `400` | `resource` isn't `https://api.followr.ai/mcp`. |
| `unsupported_grant_type` | `400` | `grant_type` isn't `authorization_code` or `refresh_token`. |
| `invalid_redirect_uri`, `invalid_client_metadata` | `400` | Unusable registration metadata. |
| `temporarily_unavailable` | `429` | Too many token or registration requests from one address. |
| `server_error` | `500` | A fault on Followr's side. Try again. |


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