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

# Master endpoints

> Contracts for listing, provisioning, registering, retrieving, and updating PAMM Masters.

## List Masters

`GET /api/v1/master/directory`

| Query parameter | Type    | Required | Description                                                        |
| --------------- | ------- | -------- | ------------------------------------------------------------------ |
| `engine`        | enum    | Yes      | Send `PAMM`. `ALL` also includes MAM and is outside this workflow. |
| `limit`         | integer | No       | From 1 to 100; recommended value is 50.                            |
| `cursor`        | string  | No       | Opaque cursor returned by the previous page.                       |

```bash theme={null}
curl "https://pamm-api.example.com/api/v1/master/directory?engine=PAMM&limit=50" \
  -H "Authorization: Bearer YOUR_CRM_API_KEY"
```

```json theme={null}
{
  "items": [
    {
      "engine": "PAMM",
      "id": 375,
      "mt5_login": "146512",
      "name": "Momentum Weekly",
      "strategy_name": "Momentum",
      "strategy": "Trend-following strategy",
      "investors_count": 12,
      "payment_account_login": "146513",
      "min_deposit": 500,
      "created_at": "2026-07-20T19:57:46.590732"
    }
  ],
  "next_cursor": null,
  "has_more": false
}
```

Use `id` with the single-Master `GET` and `PATCH` routes.

## Register existing accounts

`POST /api/v1/master/add`

| Body field              | Type   | Required | Description                                 |
| ----------------------- | ------ | -------- | ------------------------------------------- |
| `mt5_login`             | string | Yes      | Existing Master trading login.              |
| `name`                  | string | No       | Visible strategy name.                      |
| `strategy_name`         | string | No       | Short commercial strategy name.             |
| `strategy`              | string | No       | Strategy description.                       |
| `payment_account_login` | string | Yes      | Separate existing login that receives fees. |
| `min_deposit`           | string | Yes      | Minimum subscription amount in USD.         |

```json theme={null}
{
  "mt5_login": "146512",
  "name": "Momentum Weekly",
  "strategy_name": "Momentum",
  "strategy": "Trend-following strategy",
  "payment_account_login": "146513",
  "min_deposit": "500"
}
```

The API rejects an already registered trading login, a payment account equal to the Master login, or a payment account already assigned elsewhere.

## Create a new Master

`POST /api/v1/master/create`

| Body field       | Type   | Required | Description                                       |
| ---------------- | ------ | -------- | ------------------------------------------------- |
| `first_name`     | string | Yes      | MT5 holder first name.                            |
| `last_name`      | string | Yes      | MT5 holder last name.                             |
| `name`           | string | Yes      | Master alias.                                     |
| `username`       | email  | Yes      | Email associated with MT5 provisioning.           |
| `platform_group` | string | Yes      | Broker-agreed Master MT5 group.                   |
| `leverage`       | string | No       | Defaults to `100`.                                |
| `min_deposit`    | string | Yes      | Minimum Investor balance required for assignment. |
| `strategy_name`  | string | No       | Short strategy name.                              |
| `strategy`       | string | No       | Strategy description.                             |

```json theme={null}
{
  "first_name": "Laura",
  "last_name": "Gomez",
  "name": "Momentum Weekly",
  "username": "laura.gomez@example.com",
  "platform_group": "<MT5_MASTER_GROUP>",
  "leverage": "100",
  "min_deposit": "500",
  "strategy_name": "Momentum",
  "strategy": "Trend-following strategy"
}
```

```json theme={null}
{
  "id": 375,
  "mt5_login": "146512",
  "name": "Momentum Weekly",
  "strategy_name": "Momentum",
  "strategy": "Trend-following strategy",
  "created_at": "2026-07-20T19:57:46.590732",
  "password": "<MT5_MAIN_PASSWORD>",
  "investor_password": "<MT5_INVESTOR_PASSWORD>",
  "payment_account_login": "146513"
}
```

The payment account is created in the payment group configured by Codench; its group is not part of this request.

## Retrieve by internal ID

`GET /api/v1/master/{master_id}`

`master_id` is the numeric internal PAMM ID, not the MT5 login.

```bash theme={null}
curl "https://pamm-api.example.com/api/v1/master/375" \
  -H "Authorization: Bearer YOUR_CRM_API_KEY"
```

```json theme={null}
{
  "id": 375,
  "mt5_login": "146512",
  "name": "Momentum Weekly",
  "strategy_name": "Momentum",
  "strategy": "Trend-following strategy",
  "created_at": "2026-07-20T19:57:46.590732"
}
```

## Update a Master

`PATCH /api/v1/master/{master_id}`

Send at least one of `name`, `strategy_name`, `strategy`, or `min_deposit`. Omitted fields keep their current value.

```json theme={null}
{
  "name": "Momentum Weekly v2",
  "min_deposit": 750
}
```

Changing `min_deposit` affects later assignment validation and does not credit or debit existing balances.

## Retrieve sensitive Master details

`GET /api/v1/info/master/{master_login}`

```json theme={null}
{
  "id": 375,
  "mt5_login": "146512",
  "name": "Momentum Weekly",
  "mt5_password": "<MT5_MAIN_PASSWORD>",
  "mt5_investor_password": "<MT5_INVESTOR_PASSWORD>",
  "strategy_name": "Momentum",
  "strategy": "Trend-following strategy",
  "payment_account_login": "146513",
  "min_deposit": 500,
  "created_at": "2026-07-20T19:57:46.590732",
  "investors_count": 12
}
```

<Warning>
  This response contains MT5 secrets. Restrict it to authorized backend and administrative processes and exclude the body from logs.
</Warning>

<CardGroup cols={2}>
  <Card title="Previous: Endpoint index" icon="arrow-left" href="/reference/endpoint-index">
    Return to the route catalog.
  </Card>

  <Card title="Next: Investor endpoints" icon="arrow-right" href="/reference/investors">
    Open Investor provisioning contracts.
  </Card>
</CardGroup>
