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

# Authentication

> Authenticate your requests to the Monirates API using your API key.

All requests to the Monirates REST API must be authenticated using your **API key**. You can generate and manage your API key from the Monirates business portal.

***

## How It Works

Pass your API key in the request headers using the `x-api-key` key:

```text theme={null}
x-api-key: YOUR_API_KEY
```

This applies to both sandbox and production environments. The only difference between the two is **which API key you use** and **which base URL you target**.

***

## Example Request

```bash cURL theme={null}
curl https://dev.interface.monirates.com/your-endpoint \
  -H "x-api-key: MR_v1_xxx" \
  -H "Accept: application/json"
```

```javascript Node.js theme={null}
const response = await fetch("https://dev.interface.monirates.com/your-endpoint", {
  headers: {
    "x-api-key": "MR_v1_xxx",
    "Accept": "application/json",
  },
});

const data = await response.json();
console.log(data);
```

```python Python theme={null}
import requests

response = requests.get(
    "https://dev.interface.monirates.com/your-endpoint",
    headers={
        "x-api-key": "MR_v1_xxx",
        "Accept": "application/json",
    },
)

print(response.json())
```

***

## Getting Your API Key

1. Log in to your Monirates business portal:
   * **Production:** [business.monirates.com](https://business.monirates.com)
   * **Sandbox:** [dev.business.monirates.com](https://dev.business.monirates.com)
2. Go to the **Settings** section.
3. Create or copy your API key.

***

## Sandbox vs. Production Keys

| Environment | Base URL | Portal |
| - | - | - |
| **Sandbox** | `https://dev.interface.monirates.com` | `dev.business.monirates.com` |
| **Production** | `https://interface.monirates.com` | `business.monirates.com` |

> [!WARNING]
>
> Your sandbox and production API keys are **separate and not interchangeable**. Always use the correct key for each environment. Never hardcode your API key in source code — use environment variables instead.

***

## Security Best Practices

* Store your API key in environment variables (e.g., `MONIRATES_API_KEY`).
* Never commit your API key to version control.
* Rotate your key immediately if it is ever exposed.
* Use your **sandbox key** for development and testing, and your **production key** only for live traffic.


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