# Copy Groups

> Copy trading groups: list, read, create, update, delete; replace the member set.
> Source: https://help.tradavity.com/api-docs/copy-groups
> Category: Resources

---

Copy trading groups link multiple accounts so a single decision can flow to all of them. Members carry a quantity multiplier; the master account drives the group when `copy_mode=master`.

## GET /copy-groups

**Scope:** `read:copy_groups`

List your copy trading groups with member counts and copy mode (`master`, `any_to_all`, `manual`).

## GET /copy-groups/{id}

**Scope:** `read:copy_groups`

Single group with `members[]`. Each member row carries the membership row `id`, the underlying `account_id` + `account_name` + `is_archived`, the `quantity_multiplier` applied to copied trades, and `sort_order`.

---

## POST /copy-groups

**Scope:** `write:copy_groups` · **Plan gate:** Pro

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string (1–100) | yes |  |
| `copy_mode` | enum | no | `master` (default), `any_to_all`, `manual`. |
| `scale_fees` | bool | no | Defaults to `true`. |

You set the `master_account_id` via PATCH after adding members — the master must already be in the group.

```bash
curl -X POST https://app.tradavity.com/api/v1/copy-groups \
  -H "Authorization: Bearer tvty_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"name": "TopStep XFA Multi", "copy_mode": "master"}'
```

## PATCH /copy-groups/{id}

**Scope:** `write:copy_groups`

Update `name`, `copy_mode`, `master_account_id`, `scale_fees`, `is_active`. Pass `master_account_id: null` to clear the master. The `master_account_id` must point at an account currently in the group; otherwise `400`.

## DELETE /copy-groups/{id}

**Scope:** `write:copy_groups`

Hard delete. Cascades:

- Member rows in `set_copy_group_accounts` (FK CASCADE).
- Goals scoped to this group + their snapshots.
- Strategies bound to this group have `copy_group_id` nulled (the strategy survives, becomes global).

## PUT /copy-groups/{id}/members

**Scope:** `write:copy_groups`

Replace the entire member set. Up to 50 members per group.

| Member field | Type | Notes |
| --- | --- | --- |
| `account_id` | int | Required. Must be an account you own. |
| `quantity_multiplier` | decimal | Defaults to 1.0. Range 0 < multiplier ≤ 999.99. |
| `sort_order` | int | Defaults to the array index. |

If an account is already a member of a different copy group, the request returns `409 conflict` with `error.details.conflicting_account_ids`. Each account can only belong to one group at a time.

If the existing `master_account_id` is removed by this PUT (no longer a member), the master is auto-cleared. Set a new master via PATCH afterward.

```bash
curl -X PUT "https://app.tradavity.com/api/v1/copy-groups/7/members" \
  -H "Authorization: Bearer tvty_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "members": [
      {"account_id": 192, "quantity_multiplier": 1.0, "sort_order": 0},
      {"account_id": 229, "quantity_multiplier": 0.5, "sort_order": 1}
    ]
  }'
```
