> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ocpplab.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ocpplab.io/_mcp/server.

# Authentication

All OCPPLab APIs, SDKs, CLIs and MCP servers accept the same credential:

```http
Authorization: Bearer <token>
```

## SDK tokens

Use an SDK token for code, scripts, CI and headless agents.

#### Open SDK tokens

In [Studio](https://app.ocpplab.com/dashboard/settings/sdk-tokens), open **Settings → SDK tokens**.

#### Generate a token

Select **Generate token** and give it a name that says where it runs, for example `CI pipeline`.

#### Copy it now

The token is shown once. Store it in your secret manager or an environment variable:

```bash
export OCPPLAB_TOKEN="<token>"
```

A token acts as the member who generated it and does not expire. To revoke it, delete it in **SDK tokens**: anything using it stops working at once.

> **Warning**
>
> Never commit a token. Read it from `OCPPLAB_TOKEN` or your secret manager.

## Browser sign-in (OAuth)

The CLI and MCP clients can sign you in with your OCPPLab account instead of a token. You sign in, choose the organization the app may use, and select **Allow**. The app stores and refreshes its own access.

* **CLI:** `ocpplab-cli auth login`. See [ocpplab-cli](/cli/overview#sign-in).
* **MCP:** add `https://api.ocpplab.io/mcp` to Claude Code, Cursor, VS Code, claude.ai or ChatGPT with no credentials. See [Connect a client](/mcp/connect-a-client).

Disconnect an app in Studio under **Settings → Connected apps**.

## What a token can see

* **Organization:** every result is scoped to the token's organization. An id from another organization returns `404`.
* **Role:** admin-only operations, such as removing an OCPI partner, return `403` unless the token belongs to an organization admin.

## Use the token

**`TypeScript`**

```typescript TypeScript
import { OcpplabSDK } from "ocpplab";

const client = new OcpplabSDK({ token: process.env.OCPPLAB_TOKEN! });
```

**`Python`**

```python Python
import os
from ocpplab import OcpplabSDK

client = OcpplabSDK(token=os.environ["OCPPLAB_TOKEN"])
```

**`CLI`**

```bash CLI
export OCPPLAB_TOKEN="<token>"
ocpplab-cli health live
```

**`cURL`**

```bash cURL
curl https://api.ocpplab.io/evcharger/catalog \
  -H "Authorization: Bearer $OCPPLAB_TOKEN"
```