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

# Manage subscriptions

> Assign Investors to Masters and complete controlled unassignment.

## Assign an Investor

`POST /api/v1/investor/assign` validates both accounts, the Master's minimum deposit, open positions, and the Investor's subscription history. It creates an `ACTIVE` relationship and queues the current Investor balance for reflection in the Master.

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

<Warning>
  The fee rate is a decimal from `0` to `1`. Send `0.10` for 10%, never `10`.
</Warning>

An `ACTIVE` response does not guarantee that the initial mirrored movement has completed. Store the returned subscription `id` and poll balances when the next CRM action depends on synchronization.

<Note>
  Current account restriction: an Investor login with any prior subscription cannot subscribe again, even when the earlier subscription is `CANCELLED`. Coordinate with Codench before designing a re-subscription flow for the same login.
</Note>

## Unassign an Investor

`POST /api/v1/subscriptions/unassign` processes pending performance fees, removes the mirrored Master balance, and closes the relationship.

```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"
```

The response can be:

* `CANCELLED` immediately when no mirrored balance remains; or
* `PAUSED` while the withdrawal synchronization completes.

When the response is `PAUSED`, do not call unassign again. A repeated request can return `409` because the operation is already running. Poll `/api/v1/info/subscriptions` until the state is `CANCELLED` and `ended_at` has a value.

## State interpretation

| State       | CRM action                                                                       |
| ----------- | -------------------------------------------------------------------------------- |
| `ACTIVE`    | Relationship is enabled; confirm balances if a mirror operation was just queued. |
| `PAUSED`    | Exit is processing; poll and do not duplicate the request.                       |
| `CANCELLED` | Relationship has ended; confirm `ended_at` before finalizing locally.            |

<CardGroup cols={2}>
  <Card title="Previous: Funding" icon="arrow-left" href="/guides/funding">
    Review controlled deposits and withdrawals.
  </Card>

  <Card title="Next: Performance fees" icon="arrow-right" href="/guides/performance-fees">
    Configure rates and reconcile fee execution.
  </Card>
</CardGroup>
