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

# Requests and responses

> Base URL, request format and the response envelope.

## Base URL

Every path in this documentation is relative to the base URL of the environment:

| Environment | Base URL |
| - | - |
| Production | `https://api.tunimobile.com/v1` |
| Test | `https://apitest.tunimobile.com/v1` |

Example: [Log in](https://docs.tunimobile.com/api/auth/login.md) on test is `POST https://apitest.tunimobile.com/v1/login_check`.

## Request format

* All endpoints use `POST`, except [Log out](https://docs.tunimobile.com/api/auth/logout.md), which uses `GET`.
* Send the body as JSON with `Content-Type: application/json`.
* Several endpoints are **action endpoints** (`/user/do_action`, `/terminal/do_action`, `/voucher/do_action`). The `action` field in the body picks the operation.

## Response format

Most responses are wrapped in the same envelope.

```json Success theme={null}
{
  "status": "success",
  "code": 200,
  "message": "OK",
  "data": { }
}
```

```json Error theme={null}
{
  "status": "error",
  "code": 400,
  "message": "Bad Request",
  "error": { "details": "Terminal not found" }
}
```

> [!WARNING]
>
> Rely on the **HTTP status code** of the response. In the success envelope, `code` is always `200`, even when the HTTP status is `201 Created`.

* On errors, `error.details` holds a short message: sometimes a code like `voucher_not_found`, sometimes a French sentence meant for display, like `Solde de la boutique insuffisant`. See the [error reference](https://docs.tunimobile.com/reference/errors.md).
* **Exceptions:** login, token refresh and authentication errors (expired or invalid token) are not wrapped. They return a flat object such as `{"code": 401, "message": "Invalid credentials."}`.


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