> ## 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.

# What is the Plugin API?

> An overview of the LeaderOS Plugin API: the server-to-server API for game-server plugins, Discord bots and your own integrations.

## What is the Plugin API?

The **Plugin API** is the **server-to-server** API of your LeaderOS website. The official LeaderOS plugins (Minecraft, Hytale, FiveM, Rust, ARK, Unturned, Garry's Mod, CS2) and the Discord bot talk to your site through it. You can use it too, to write your own plugin, bot or backend integration.

> [card] In-game login and registration
>
> Authenticate players in game with their website account, register them, check 2FA codes.

> [card] Store and credits
>
> In-game store menus, buying with credits, adding/removing/sending credits.

> [card] Command delivery
>
> Run the commands of purchased products on your game server with LeaderOS Connect.

> [card] Discord and support
>
> Discord role syncing, support tickets, AI commands.

## Plugin API vs Headless API

| | Plugin API | Headless API |
| - | - | - |
| Address | `https://your-site.com/api` | `https://your-site.com/headless/v1` |
| Used by | Game plugins, bots, your backend | Web/mobile frontends (themes) |
| Key | `X-Api-Key`, **secret** | `X-LeaderOS-Key`, public |
| Power | Admin level (change credits, give roles…) | Player level (with a Bearer token) |
| Panel setting | **Settings → API** | **Settings → Headless API** |

> [!WARNING]
>
> The Plugin API key has **admin power**: it can change any player's credits, give roles and make purchases. **Never** use it in browser code, a mobile app, a public repository or a file you hand out to players. Keep it on the server only.

## Basics

* **Base URL:** `https://your-site.com/api`
* **Authentication:** the `X-Api-Key: <api key>` header on every request
* **Request body:** `application/x-www-form-urlencoded` (or `multipart/form-data`). **JSON bodies are not validated**; send form data.
* **Arrays:** sent as form arrays, e.g. `commands[]=15&commands[]=16`, `products[0][id]=12&products[0][quantity]=1`

## Response format

Endpoints that perform an action return this envelope:

```json theme={null}
{ "status": true, "data": { "token": "…" } }
```

```json theme={null}
{ "status": false, "error": "USER_NOT_FOUND", "message": "User not found!" }
```

On a validation error, `error` is `VALIDATION` and `message` is a list of messages:

```json theme={null}
{ "status": false, "error": "VALIDATION", "message": ["The Username is required"] }
```

> [!NOTE]
>
> Some read endpoints (e.g. `GET /store/products`, `GET /users`, `GET /credits`) return the **object or array directly**, without the envelope. The API reference shows the response shape of every endpoint.

**Always branch on the `error` code**, not on `message`.

## HTTP status codes

| Code | Meaning |
| - | - |
| `200` | Success |
| `400` | Bad request, validation error or business-rule error (e.g. `INSUFFICIENT_BALANCE`) |
| `401` | `INVALID_API_KEY` (missing/wrong key), `WRONG_PASSWORD`, `WRONG_CODE` |
| `403` | `REGISTER_LIMIT` |
| `404` | Record not found (`USER_NOT_FOUND`…) **or the API is off** (404 with an empty body) |
| `409` | `USERNAME_ALREADY_EXIST`, `EMAIL_ALREADY_EXIST` |

## Endpoints

| Group | What it does |
| - | - |
| Auth | Login, registration, session check/creation, in-game login state, 2FA |
| Store | Store tree, products, categories, buying with credits, donors, community goal |
| Credits | Read, add, remove, set balance; send between players |
| Users | User info, orders, support tickets, roles (give/change/remove) |
| Bazaar | Player bazaar storage (add/remove items), bazaar servers |
| Support | Tickets, messages, categories, canned answers |
| Vote | Voting links |
| Discord | User by Discord ID, Discord settings, Discord roles |
| Integrations | LeaderOS ID in-game verification, LeaderOS AI commands |
| Command logs | LeaderOS Connect command queue and validation |

See the **API reference** group on the left for every parameter and response.

## Where to start

**1. Enable the API**

Turn on the API in the panel and get your key → [Setup](https://developer.leaderos.net/plugin-api/en/setup.md)

**2. Write your own integration**

Start with the sample requests → [Usage examples](https://developer.leaderos.net/plugin-api/en/usage.md)


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