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

# Authentication

> How to create and use API keys to authenticate requests.

MoltSets uses API key authentication. Every request must include your API key as a Bearer token in the `Authorization` header.

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

API keys follow the format `ms_XXXXXXXXXXX`.

## Creating an API key

API keys are managed at [app.moltsets.com](https://app.moltsets.com/dashboard/api_keys).

1. To create an API Key, choose "create an API key"
2. Give it a name then click "create now"

> [!WARNING]
>
> Store your API key somewhere secure as soon as you create it!

## Using your API key

Pass the key as a Bearer token on every request:

```bash theme={null}
curl -X POST https://api.moltsets.com/api/v1/tools/get_account \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "User-Agent: YOUR_APP_NAME/1.0" \
  -d '{}'
```

## User-Agent header

Every request — REST or MCP — must also send a `User-Agent` header. MoltSets doesn't check its contents, only that it's present; any non-empty value is accepted.

Requests missing it are rejected with `403 Forbidden` (`error.code`: `forbidden`) before authentication is even checked.

Most HTTP clients and MCP clients set a `User-Agent` by default, so this usually needs no extra work. If you've built a custom client that sends bare requests (or an MCP client that lets you omit the header), set one explicitly — see [Other MCP clients](https://developer.moltsets.com/integrations/moltsets-mcp/other-clients.md) for the MCP case.

## Multiple keys

You can create as many API keys as you need. The recommended pattern is one key per environment or agent — for example, separate keys for local development, staging, and production.

This makes it easy to revoke access for a specific environment without affecting others.

## Revoking a key

You can revoke credentials individually or all at once:

1. To revoke a single API Key or Connector, click **Revoke** to the right of the credential you want to remove.
2. To revoke all credentials at once, use the **Revoke All** option on the page.

Revocation is immediate and irreversible.

## OAuth — connecting an MCP client

MCP clients authenticate with an OAuth access token instead of a raw API key. Both credential types reach the same account and the same tools; use an API key for direct REST calls, and OAuth for anything connecting over the [MCP server](https://developer.moltsets.com/integrations/moltsets-mcp.md).

Create the Client ID and Client Secret under **Connectors** at [app.moltsets.com](https://app.moltsets.com). Clients that support dynamic registration can register themselves instead.

| | |
| :- | :- |
| Authorization | `https://app.moltsets.com/oauth/authorize` |
| Token | `https://app.moltsets.com/oauth/token` |
| Dynamic registration | `https://app.moltsets.com/oauth/register` |
| Grant type | `authorization_code` |
| PKCE | `S256` |
| Scopes | `mcp`, `read`, `tokens` |

Metadata is discoverable at `https://mcp.moltsets.com/.well-known/oauth-protected-resource` and `https://app.moltsets.com/.well-known/oauth-authorization-server`.

### Redirect URIs

`https` is accepted on any host. Plain `http` is accepted **only** on a loopback host — `127.0.0.1`, `[::1]`, or `localhost` — which is what lets a CLI or desktop client complete the flow on an ephemeral local port, the native-app pattern from [RFC 8252 §7.3](https://datatracker.ietf.org/doc/html/rfc8252#section-7.3). Every other host requires `https`.

For a registered loopback URI the **port may vary** between runs; scheme, host, path, and query must still match exactly. Non-loopback URIs are matched exactly, port included.

**PKCE is mandatory for loopback redirects** and is enforced at `/oauth/authorize`, before an authorization code exists. It remains optional for `https` redirect URIs.

A granted token is used the same way as an API key:

```bash theme={null}
Authorization: Bearer YOUR_ACCESS_TOKEN
```

MCP connections need a `User-Agent` header too — see [above](#user-agent-header). Claude, Claude Desktop, and Claude Code set one automatically; other MCP clients may need to set one explicitly.

## Key permissions

All API keys have the same permissions — there are no read-only or scoped keys. Any key can call any tool on your account.

## Error responses

| Status | Code | Meaning |
| - | - | - |
| `401 Unauthorized` | `unauthorized` | Missing, invalid, or revoked API key |
| `403 Forbidden` | `forbidden` | Missing `User-Agent` header |
| `403 Forbidden` | `account_inactive` | Valid key, but the account is not active |
| `403 Forbidden` | `plan_restricted` | Valid key, but the tool isn't part of the account's plan |

```json theme={null}
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key."
  }
}
```

Every MoltSets error uses this shape — an `error` object with a `code` and a `message`. Branch on `code`; the message is for humans. The full list is in [Errors](https://developer.moltsets.com/getting-started/overview.md#errors).


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