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

# Authentication

> How to authenticate API requests

Every request must include your API key in the `X-API-Key` header. You can also use `Authorization: Bearer <key>` as an alternative.

## Get Your Key

Generate or view your key from the [dashboard](https://mogalts.win/dashboard/api).

## Usage

```bash theme={null}
curl https://mogalts.win/v1/balance \
  -H "X-API-Key: mog_your_key_here"
```

Or with Bearer auth:

```bash theme={null}
curl https://mogalts.win/v1/balance \
  -H "Authorization: Bearer mog_your_key_here"
```

## Error Response

If you send a request without a key, or with an invalid key, you'll receive a `401` response:

```json theme={null}
{
  "success": false,
  "error": "Invalid API key."
}
```

## Key Security

<Warning>
  **Keep your API key private.** Anyone with it can spend your credits. If compromised, regenerate immediately in Dashboard → API Key → Regenerate.
</Warning>
