# Update member link details

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

- **Products:** Operator (`FOH`), Consumer (`CONSUMER`) (any one of these products, not all)
- **Features:** Online Bookings (`ONLINEBOOK`), Online Joining (`ONLINEJOIN`), Front of House Generic Access (`FOHGENERIC`) (any one of these features, not all)

HTML version: [Update member link details](https://support.gladstonesoftware.cloud/reference/members/update-member-link-details)

## Overview

Changes how a member participates in a family or group link: whether they are the primary member, whether they may book on behalf of the members linked to them, whom they book for by default, and whether linked members may book on their behalf.

This endpoint does not create or remove links. It only adjusts settings on a member who is already part of a link, and every rule it enforces depends on the links the member currently has.

**Every field is optional and omitted fields are left alone** — a boolean setting you omit keeps its current value. But `memberIsPrimary` is not a simple setter, it is a request that is validated against the member's links, and it can fail the whole call:

- A member **with** links can be made primary (`true`), which also detaches them from whoever they were linked to. Setting `false` on a member who is currently primary is rejected — demote them only by relinking.
- A member **with no links** cannot be made primary at all. Be aware that this branch also inspects the member's primary-address indicator, so an unlinked member whose *work* address is marked primary is rejected with the same message even when you did not ask for a primary change.

Nothing is written if any check fails.

Linked members are permitted — a token issued for a member linked to `{memberId}` may call this endpoint.

## Endpoint

`PUT {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 settings change. Must match the member id in your access token, or be a member linked to it. |

## Request body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `memberIsPrimary` | boolean | No | Makes this member the primary of their link group. `true` requires the member to have at least one link, and also clears the record of whom they are linked to, since a primary is linked to by others rather than linking to someone. `false` is rejected outright if the member is currently the primary and still has links. Omit the field to leave the primary status alone — though see the Overview for the unlinked-member case, which can fail regardless. |
| `memberCanBookForOthers` | boolean | No | Whether this member may make bookings on behalf of the members linked to them — for example a parent booking for a child. Omit or send `null` to leave the current setting unchanged. |
| `defaultLinkingMemberIdToMakeBookingsFor` | integer (int32) | No | The linked member this member books for by default, so booking journeys can preselect them. Must be 1 or greater, and must be one of the members currently linked to `{memberId}` — an id outside that list is rejected with `400 Id not found`. Omit or send `null` to leave the current default in place; **there is no way to clear the default through this endpoint**, since a value of 0 or less fails validation. |
| `blockLinkFromMakingBookings` | boolean | No | Whether linked members are blocked from booking on this member's behalf — the opposite direction to `memberCanBookForOthers`. Set it to stop, for example, a teenager's account being booked for by the rest of the family. Omit or send `null` to leave the current setting unchanged. |

## Sample request

```bash title="cURL"
curl -X PUT '{base_url}/api/members/{memberId}/links' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "memberIsPrimary": true,
  "memberCanBookForOthers": true,
  "defaultLinkingMemberIdToMakeBookingsFor": 12345,
  "blockLinkFromMakingBookings": true
}'
```

## Errors

A successful call returns `204 No Content`.

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | `defaultLinkingMemberIdToMakeBookingsFor` is not one of the member's linked members: `Id not found` |
| `400` | Bad request | `defaultLinkingMemberIdToMakeBookingsFor` is 0 or negative: `Member Id for default linking member is not valid`. Returned as a model-state object rather than a plain string. |
| `400` | Bad request | `memberIsPrimary` is `false` for a member who is currently primary and still linked: `Cannot remove member as primary while they are linked to other members` |
| `400` | Bad request | The member has no links and either `memberIsPrimary` is `true` or their work address is flagged as primary: `Cannot make member a primary while they have no links` |
| `404` | Not found | No member exists with that id: `Member does not exist` |
| `500` | Internal server error | Saving the change failed, or another unexpected server-side failure occurred. No detail is returned in the body. |
