Accept a link request from a primary member

PUT /api/members/{secondaryMemberId}/link-requests/{primaryMemberId}

Overview

Accepts a pending link request that one member has sent to another, joining the two members into a linked group and sharing the sender's group memberships with the recipient.

Call this as the recipient of the request. secondaryMemberId is the member accepting; primaryMemberId is the member who sent the request. The request must already exist and still be pending — link requests are created by Create member links and can be withdrawn or rejected with Delete link request. A member unrelated to either party cannot accept a request on their behalf; that is rejected with 403.

The call performs two steps in sequence: it links the secondary member to the primary, then applies the primary member's shareable memberships to the newly linked member. If the second step fails, the link is rolled back so the pair are left unlinked; if that rollback itself fails, the error text returned to you has the rollback failure appended, and the two members may be left linked without shared memberships. Treat a non-success response as "state unknown" and re-read the link with a fresh request rather than assuming nothing happened.

On success the endpoint returns 204 No Content and the pending link request no longer exists, so the call is not repeatable — a second attempt returns 404. The sender does not need to have been a primary member beforehand: accepting a request from an ordinary member promotes that member to primary. The accepting member keeps any memberships they already held; shared memberships are added alongside them.

Endpoint

PUT {base_url}/api/members/{secondaryMemberId}/link-requests/{primaryMemberId}

{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.

Path parameters

NameTypeRequiredDescription
secondaryMemberIdinteger (int32)YesThe member accepting the request — the one who will become the linked, secondary member of the pair. This must be the member the request was sent to, and must be the member the access token belongs to; another member calling on their behalf is rejected with 403. Must differ from primaryMemberId.
primaryMemberIdinteger (int32)YesThe member who sent the link request, and who will become the primary of the linked pair. Their shareable group memberships are the ones applied to the secondary member. Take this value from the senderMemberId of an entry in the secondary member's received link requests; if no pending request from this member exists, the call fails with 404. Must differ from secondaryMemberId.

Sample request

cURL
curl -X PUT '{base_url}/api/members/{secondaryMemberId}/link-requests/{primaryMemberId}' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'

Errors

StatusMeaningWhen
400Bad requestprimaryMemberId and secondaryMemberId are the same value — a member cannot link to themselves. The message reads Primary member ID: {id} and secondary member ID: {id} must be different. Also returned when the platform rejects the link or the membership transfer.
401UnauthorizedThe token is anonymous rather than a member token.
403ForbiddenThe caller is neither party to the request — a member cannot accept a link request addressed to someone else.
404Not foundThe secondary member has no pending link request from primaryMemberId. The message reads The member with Id: {secondaryMemberId} did not receive any link request from member with Id: {primaryMemberId}. This is also what you get if the request was already accepted, rejected or withdrawn.
409ConflictThe link or membership service reports a conflicting state for one of the two members.
422Unprocessable entityThe platform could not apply the primary member's memberships to the secondary member. The link is rolled back; the response text carries the reason, plus a rollback failure note if the unlink also failed.
500Internal server errorAn unexpected server-side failure, including a failure in a step of the link that this endpoint does not report more specifically.

This page as markdown · All pages · llms.txt