# Get started with the API

From your first request to your first key, in a few minutes.

Updated on 4 November 2026

## Before you start

You need an account with MozOut, with an active service or domain. The API answers at:

```text
https://api.mozout.com/v1
```

It speaks JSON over HTTPS, and field names are in English.

## Check that the API responds

This operation does not need a key, so it is the best first test:

**curl**

```bash
curl "https://api.mozout.com/v1/ping" \
  -H "Accept-Language: en"
```

**PHP**

```php
<?php
$ch = curl_init('https://api.mozout.com/v1/ping');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Accept-Language: en',
    ],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo $status, PHP_EOL, $body, PHP_EOL;
```

**Python**

```python
import os
import requests

headers = {
    "Accept-Language": "en",
}
r = requests.get("https://api.mozout.com/v1/ping", headers=headers, timeout=30)
print(r.status_code)
print(r.text)
```

**JavaScript**

```javascript
const response = await fetch("https://api.mozout.com/v1/ping", {
  headers: {
    "Accept-Language": "en",
  },
});
console.log(response.status);
console.log(await response.text());
```


Response:

```json
{
  "data": {
    "status": "ok",
    "version": "v1",
    "time": "2026-11-04T21:30:00+02:00"
  },
  "meta": {}
}
```

The Python example uses the `requests` library, and the JavaScript one runs on Node.js 18 or later.

## Create a key

1. Sign in to My MozOut and open the [API](https://www.my.mozout.com/api-center.php?language=english&currency=1) page.
2. Name the key and choose its type. To begin, choose Sandbox mode (`sandbox_`).
3. Choose the permissions and the validity.
4. Confirm with your password and the 6-digit code you receive by email.
5. Copy the key. It is shown only this once.

The details are in [Authentication and keys](https://docs.mozout.com/en/authentication.md).

## Save the key

Keep the key in an environment variable, outside your code:

```bash
export RLX_API_KEY="sandbox_..."
```

The examples in this documentation read the key from `RLX_API_KEY`.

## Make your first request with a key

This operation shows the permissions, validity and limits of the key that made the request:

**curl**

```bash
curl "https://api.mozout.com/v1/token" \
  -H "Authorization: Bearer $RLX_API_KEY" \
  -H "Accept-Language: en"
```

**PHP**

```php
<?php
$ch = curl_init('https://api.mozout.com/v1/token');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RLX_API_KEY'),
        'Accept-Language: en',
    ],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo $status, PHP_EOL, $body, PHP_EOL;
```

**Python**

```python
import os
import requests

headers = {
    "Authorization": "Bearer " + os.environ["RLX_API_KEY"],
    "Accept-Language": "en",
}
r = requests.get("https://api.mozout.com/v1/token", headers=headers, timeout=30)
print(r.status_code)
print(r.text)
```

**JavaScript**

```javascript
const response = await fetch("https://api.mozout.com/v1/token", {
  headers: {
    Authorization: `Bearer ${process.env.RLX_API_KEY}`,
    "Accept-Language": "en",
  },
});
console.log(response.status);
console.log(await response.text());
```


Response:

```json
{
  "data": {
    "id": 12,
    "name": "Example key",
    "type": "sandbox",
    "mode": "sandbox",
    "writes_simulated": true,
    "suffix": "AbCd",
    "permissions": [
      "dns:read"
    ],
    "allowed_ips": [
      "198.51.100.0/24"
    ],
    "expires_at": "2027-02-02T10:00:00+02:00",
    "created_at": "2026-11-04T10:00:00+02:00",
    "last_used_at": "2026-11-04T21:30:00+02:00",
    "rate_limit": {
      "limit": 90,
      "remaining": 89,
      "reset": 1793820660,
      "window_seconds": 60
    },
    "spending": {
      "limit": 0,
      "spent": 0,
      "currency": "USD",
      "window_days": 30
    }
  },
  "meta": {}
}
```

## Response format

A successful response always has `data` and `meta`, except `GET /v1/openapi.json`, which returns the document without this envelope:

```json
{
  "data": {},
  "meta": {}
}
```

An error response has `error`, with a stable code. See [Errors](https://docs.mozout.com/en/api-rules.md).

Every response has the `X-Correlation-ID` header. Include it when you report a problem to support.

## Message language

Send `Accept-Language: pt` or `Accept-Language: en` to choose the language of error messages. Without this header, messages are in English. The `code` field never changes with the language.

## Long-running operations

Operations that take time answer `202` with an `action_id`. Instead of repeating the request, follow the result with [`GET /v1/actions/{id}`](https://docs.mozout.com/en/key-status.md). The states are `queued`, `running`, `done` and `failed`.

> **Note:**
>
> In this version, registering, renewing and transferring domains answer `202`.

## Next steps

- [Permissions](https://docs.mozout.com/en/permissions.md): give each key only what it needs.
- [Limits](https://docs.mozout.com/en/api-rules.md): how many requests you can make per minute.
- [Sandbox and Production](https://docs.mozout.com/en/api-rules.md): what `sandbox_` and `prod_` keys do.
- [Reference](https://docs.mozout.com/en/reference.md): every operation, with a filter, linking to the page of each area.
