> ## 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.

# Subscription endpoints

> Contracts for assigning, unassigning, and querying PAMM relationships.

## Assign an Investor

`POST /api/v1/investor/assign`

| Body field         | Type    | Required | Description                                           |
| ------------------ | ------- | -------- | ----------------------------------------------------- |
| `master_login`     | string  | Yes      | Master trading MT5 login.                             |
| `investor_login`   | string  | Yes      | Investor MT5 login.                                   |
| `perf_fee.rate`    | decimal | Yes      | Rate from `0` to `1`.                                 |
| `perf_fee.enabled` | boolean | Yes      | Enables or disables fee collection for this Investor. |

```json theme={null}
{
  "master_login": "146512",
  "investor_login": "146600",
  "perf_fee": {
    "rate": 0.30,
    "enabled": true
  }
}
```

```json theme={null}
{
  "id": 980,
  "master_id": 375,
  "investor_id": 410,
  "status": "ACTIVE",
  "in_pool": true,
  "started_at": "2026-07-21T13:20:00",
  "balance_baseline_op_id": 445001,
  "ended_at": null,
  "created_at": "2026-07-21T13:20:00"
}
```

The Investor balance must meet the Master's `min_deposit`, the Investor cannot have open positions, and the initial mirror can still be queued after the response.

## Unassign an Investor

`POST /api/v1/subscriptions/unassign`

| Query parameter  | Type   | Required | Description              |
| ---------------- | ------ | -------- | ------------------------ |
| `master_login`   | string | Yes      | Active Master MT5 login. |
| `investor_login` | string | Yes      | Investor MT5 login.      |

```bash theme={null}
curl -X POST \
  "https://pamm-api.example.com/api/v1/subscriptions/unassign?master_login=146512&investor_login=146600" \
  -H "Authorization: Bearer YOUR_CRM_API_KEY"
```

```json theme={null}
{
  "subscription": {
    "id": 980,
    "master_login": "146512",
    "investor_login": "146600",
    "status": "PAUSED",
    "in_pool": false,
    "started_at": "2026-07-21T13:20:00",
    "ended_at": null
  },
  "payout_enqueued": true,
  "mt5_transfer_id": 7410,
  "amount": -980.0
}
```

The operation can be blocked by open Master positions. Pending performance fees settle first. If mirrored balance remains, poll until `CANCELLED`; a second command while `PAUSED` returns `409`.

## List subscriptions

`GET /api/v1/info/subscriptions`

| Query parameter  | Type   | Required | Description                         |
| ---------------- | ------ | -------- | ----------------------------------- |
| `master_login`   | string | No       | Filter by Master MT5 login.         |
| `investor_login` | string | No       | Filter by Investor MT5 login.       |
| `status`         | enum   | No       | `ACTIVE`, `PAUSED`, or `CANCELLED`. |

```json theme={null}
[
  {
    "id": 980,
    "status": "ACTIVE",
    "in_pool": true,
    "started_at": "2026-07-21T13:20:00",
    "ended_at": null,
    "master_login": "146512",
    "investor_login": "146600"
  }
]
```

## List active Investors for a Master

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

```json theme={null}
[
  {
    "id": 410,
    "mt5_login": "146600",
    "name": "Investor Demo"
  }
]
```

Only subscriptions with `ACTIVE`, `in_pool=true`, and no `ended_at` are included.

## Resolve the active Master

`GET /api/v1/info/investor/{investor_login}/master`

```json theme={null}
{
  "master_login": "146512",
  "name": "Momentum Weekly",
  "started_at": "2026-07-21T13:20:00"
}
```

When there is no active Master, the response fields are `null`.

<CardGroup cols={2}>
  <Card title="Previous: Investor endpoints" icon="arrow-left" href="/reference/investors">
    Return to Investor account contracts.
  </Card>

  <Card title="Next: Financial operations" icon="arrow-right" href="/reference/operations">
    Open deposit, withdrawal, and balance contracts.
  </Card>
</CardGroup>
