# Delete member links

`DELETE /api/members/{memberId}/links`

- **Products:** Operator (`FOH`)
- **Features:** Front of House Generic Access (`FOHGENERIC`)

HTML version: [Delete member links](https://support.gladstonesoftware.cloud/reference/members/delete-member-links)

## Overview

Breaks the link between a secondary member and the primary member they are attached to. A *link* joins one primary member to one or more secondary members, so that the primary can act on their behalf — for example making bookings for a partner or an adult child.

The endpoint has two distinct modes, and which one you get depends entirely on whether you pass `linkedMemberId`:

- **Omit `linkedMemberId`** — the member in the path removes their own link. `memberId` must be a **secondary** (non-primary) member; passing a primary member here is rejected with `400`.
- **Pass `linkedMemberId`** — a primary member removes one specific secondary member. `memberId` must be a **primary** member and `linkedMemberId` must currently be linked to it; otherwise the request fails.

In both modes, if removing this link leaves the primary member with no remaining links, the primary member is also reset — it loses its primary flag and its link settings are cleared. A member below the tenant's age of consent cannot have its link removed through this endpoint at all.

A successful call returns `204 No Content`.

## Endpoint

`DELETE {base_url}/api/members/{memberId}/links`

`{base_url}` is the environment URL issued to your integration. See [Authenticating with Gladstone APIs](../../guides/authenticating-with-gladstone-apis.md).

## Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `memberId` | integer (int32) | Yes | The member whose link is being changed. When `linkedMemberId` is omitted this must be a **secondary** member — it is that member's own link that is removed. When `linkedMemberId` is supplied this must instead be the **primary** member that owns the link. Getting this the wrong way round is the most common cause of a `400` on this endpoint. |

## Query parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `linkedMemberId` | integer (int32) | No | The secondary member to unlink from the primary member in the path. Supply this only when `memberId` is a primary member. Must be `1` or greater — a value below `1` is rejected with `400`, because it indicates a missing or purged member record. The member you name must already be linked to `memberId`, or the call fails with `404`. Omit this parameter entirely to use the other mode, in which the member in the path removes their own link. |

## Sample request

```bash title="cURL"
curl -X DELETE '{base_url}/api/members/{memberId}/links' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | `linkedMemberId` was omitted but `memberId` is a primary member — a primary member cannot remove its own link this way. Use `linkedMemberId` to remove a specific secondary member instead. |
| `400` | Bad request | `linkedMemberId` was supplied but `memberId` is **not** a primary member. |
| `400` | Bad request | `linkedMemberId` is less than `1`, which is treated as a missing or purged member record. |
| `400` | Bad request | The member whose link is being removed is a junior — their date of birth puts them below the tenant's configured age of consent. |
| `404` | Not found | `memberId` does not exist. |
| `404` | Not found | `linkedMemberId` does not exist. |
| `404` | Not found | `linkedMemberId` exists but is not currently linked to `memberId`. |
| `500` | Internal server error | The secondary member's record points at a primary member that could not be retrieved — the link data is inconsistent and needs support intervention. |
