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

# Quickstart

> Enable the Headless API, get your public key and send your first request in 5 minutes.

## 1. Enable the Headless API

**1. Open the admin panel**

Sign in at `https://your-site.com/dashboard`. This page requires the **MANAGE\_SETTINGS** permission.

**2. Open Settings → Headless API**

Turn on **Headless API Status**. The change is saved immediately.

**3. Copy the public key**

Use the **Copy** button to take the key that starts with `pk_live_`. The page also shows the **API URL**: `https://your-site.com/headless/v1`

> [!NOTE]
>
> While the Headless API is off, every request returns `404 HEADLESS_DISABLED`. See [Dashboard settings](https://developer.leaderos.net/headless/en/dashboard-settings.md) for the details of each setting.

## 2. Send your first request

```bash theme={null}
curl -H "X-LeaderOS-Key: pk_live_XXXXXXXX" \
     -H "X-Locale: en" \
     https://your-site.com/headless/v1/site/config
```

A successful response contains the site name, version, active modules, currencies, captcha settings and the branding rule:

```json theme={null}
{
  "success": true,
  "data": {
    "name": "My Server",
    "version": "6.4.0",
    "modules": { "store": { "active": true }, "forum": { "active": true } },
    "branding": { "canRemove": false }
  }
}
```

## 3. Log in

```bash theme={null}
curl -X POST https://your-site.com/headless/v1/auth/login \
  -H "X-LeaderOS-Key: pk_live_XXXXXXXX" \
  -H "Content-Type: application/json" \
  -d '{"username":"player","password":"secret"}'
```

Send `data.token` from the response in later requests:

```bash theme={null}
curl -H "X-LeaderOS-Key: pk_live_XXXXXXXX" \
     -H "Authorization: Bearer <token>" \
     https://your-site.com/headless/v1/auth/me
```

## 4. The same with the SDK

```ts theme={null}
import { createClient } from '@leaderos/headless-sdk';

const leaderos = createClient({
  baseUrl: 'https://your-site.com',
  publicKey: 'pk_live_XXXXXXXX',
});

const { data: config } = await leaderos.site.config();
console.log(config.name);
```

## 5. If you call the API from a browser

Browser requests carry an `Origin` header and are accepted **only from allowed origins**. While developing, add `http://localhost:3000` to **Settings → Headless API → Allowed Origins**. Server-side requests (for example Next.js Server Components) carry no `Origin` and are always accepted.

## Common errors

| Code | Cause | Fix |
| - | - | - |
| `HEADLESS_DISABLED` | Headless API is off | Turn it on in the panel |
| `MISSING_API_KEY` | `X-LeaderOS-Key` not sent | Add the header |
| `INVALID_API_KEY` | Key is wrong or was regenerated | Copy the current key from the panel |
| `ORIGIN_NOT_ALLOWED` | Browser origin is not allowed | Add the origin to the list |
| `LICENSE_INVALID` | Domain is not licensed | Check your license |

See [API basics](https://developer.leaderos.net/headless/en/api-basics.md) for the full picture.

## Next step

> [card] [Set up a ready theme](https://developer.leaderos.net/headless/en/create-leaderos-theme.md)
>
> Don't start from scratch: create a working Next.js theme with one command.


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