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

# Authentication

> Every request carries your API key. Keep it secret and lock it to your server.

All API requests require authentication with an API key.

## Required header

```
X-Api-Key: your_api_key_here
```

## Getting your API key

**1. Sign in**

Log in to your [Wasmou account](https://myapp.wasmou.net/login).

**2. Open API access**

Go to **API access** in the sidebar. If you cannot see a key, API access is not enabled on your account yet: ask support.

**3. Copy the key**

The key is shown once on screen with a ready-made `curl` command.

**4. Allow your server (recommended)**

Add the IP address of the server that will call the API. Requests from any other address are refused.

## Example request

```bash curl theme={"dark"}
curl -X GET "https://api.wasmou.net/api/account" \
  -H "X-Api-Key: your_api_key_here"
```

```js Node.js theme={"dark"}
const res = await fetch("https://api.wasmou.net/api/account", {
  headers: { "X-Api-Key": process.env.WASMOU_API_KEY },
});
console.log(await res.json());
```

```python Python theme={"dark"}
import os, requests

r = requests.get(
    "https://api.wasmou.net/api/account",
    headers={"X-Api-Key": os.environ["WASMOU_API_KEY"]},
    timeout=30,
)
print(r.json())
```

```php PHP theme={"dark"}
$ch = curl_init("https://api.wasmou.net/api/account");
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("WASMOU_API_KEY")],
    CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);
```

`GET /api/status` is the only endpoint that works without a key.

## Security best practices

### IP allow-list

Configure allowed IP addresses in **API access**. When at least one address is set, only requests from those addresses are accepted. Wasmou reads the real client address behind Cloudflare (`CF-Connecting-IP`), so you only list your own server's public IP.

### Keep your key secret

> [!WARNING]
>
> Your key spends your wallet balance. Treat it like a password.

* Never commit keys to version control.
* Keep them in environment variables or a secrets manager.
* Never ship a key in a mobile app, a browser page or a support chat. Call Wasmou from your own backend.
* Use different keys for development and production if you have more than one.

### Rotate regularly

Generate a new key from **API access**. A new key can be generated **once every 24 hours**; the old key stops working immediately, so deploy the new one right away.

## Rate limiting

* **60 requests per minute** per API key.
* Exceeding it returns `429 Too Many Requests`.
* Implement exponential back-off ([details](https://gateway.wasmou.net/errors.md#handling-rate-limits)).

## Common authentication errors

| Error | HTTP | Description |
| - | - | - |
| `API key is required` | 401 | The `X-Api-Key` header is missing. |
| `Invalid API key` | 401 | The key is wrong, was rotated, or API access is not enabled. |
| `IP address not allowed` | 403 | The request came from an address that is not on your allow-list. |


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