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

# API conventions

> Error format, pagination, dates, money, and idempotency.

## Errors

An error response includes `detail` and a correlation identifier:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "MAM account not found",
  "request_id": "35de3b73f5bd4d318b3fbaba4c5607f8"
}
```

For validation errors, `detail` is a list containing the location and cause of each invalid field.

## HTTP codes

| Code | Meaning for the integrator |
| - | - |
| `200` | Successful retrieval or update. |
| `201` | Resource created. |
| `202` | Asynchronous operation accepted. Retrieve its status. |
| `204` | Request processed without a response body. |
| `401` | Missing or invalid API key. |
| `404` | Resource does not exist. |
| `409` | Conflict, duplicate, limit, or insufficient funds. |
| `422` | Invalid payload or parameter. |
| `500` | Internal failure. Do not change the payload blindly. |
| `502` | An operation against MT5 could not be completed. |

## Pagination

Cursor-based listings return a structure similar to:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "items": [],
  "next_cursor": 171,
  "has_more": true
}
```

Continue with the returned `next_cursor` while `has_more` is `true`. Do not calculate the cursor manually.

## Dates and money

* Exchange dates in ISO 8601 and use UTC with the `Z` suffix.
* Treat amounts, rates, and volumes as decimal values.
* `performance_fee_rate` uses a range from `0` to `1`; for example, `0.20` represents 20%.
* Avoid binary floating-point numbers for accounting.

## Retries

> [!TIP]
>
> Generate a deterministic `idempotency_key` from the CRM transaction ID and reuse it when repeating the same operation.

* Do not retry `409` without inspecting the cause.
* Retry `500` and `502` with backoff when the operation allows it.
* Before repeating resource creation after a timeout, retrieve by login or by the leader/follower pair.


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