Create emergency contact for member

POST /api/members/{memberId}/emergency-contacts

Success: 201 Created

Overview

Adds one emergency contact to a member — a name, a contact number and an optional description of how they are related. Use it when a member fills in a next-of-kin field at joining, at induction, or when they update their details later. A member can have any number of contacts; each call adds one more.

Two things about the response catch people out. First, 201 Created comes back with an empty body: the contact you just created, and in particular its id, are not returned. The Location header points at Get member emergency contacts for the same member, and that is where you read the new record — including the id you will need for Update emergency contact record and Delete emergency contact record. Second, nothing is de-duplicated: send the same name and number twice and the member ends up with two identical contacts, each with its own id. If you are syncing rather than appending, read the existing contacts first and update or delete instead.

There is no partial success. If any field fails validation the whole request is rejected with 400 and nothing is stored.

When your token carries a member id it must match {memberId}, or the request is rejected with 403 and The given member ID of {memberId} does not belong to the logged in member nor any linked members. Linked members are accepted, so a parent's token can add a contact to a linked child's record. Tokens with no member id in them — staff and integration tokens — are not subject to that check.

Endpoint

POST {base_url}/api/members/{memberId}/emergency-contacts

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

Path parameters

NameTypeRequiredDescription
memberIdinteger (int32)YesThe member the contact is stored against. The member must already exist, or the call fails with 404 and Member {memberId} does not exist. It is also the id in the Location header you follow to read the created record back. When your token carries a member id, this value must be that member or one linked to them.

Request body

FieldTypeRequiredDescription
contactNamestringYesThe person to contact in an emergency, as one free-text string — there are no separate first and last name fields. Required: an absent or empty value is rejected with A contact name is required in this request, and anything over 50 characters with The contact name cannot be more than 50 characters.
contactNumberstringYesThe number to ring for that person. Stored as free text with no format, country-code or digit checking, so extensions and spacing survive as sent — and so does a typo. Required: an absent or empty value is rejected with A contact number is required in this request, and anything over 50 characters with The contact numbe cannot be more than 50 characters (the missing r is in the message the API returns, not a typo here).
relationshipstringNoHow the contact is related to the member, in free text — there is no controlled list, so Wife, Neighbour and GP are all equally valid. Limited to 25 characters, which is shorter than the two fields above; more is rejected with The relationship cannot be more than 25 characters. Omit it to store the contact with no relationship, in which case the field comes back empty when the contacts are read.

Sample request

cURL
curl -X POST '{base_url}/api/members/{memberId}/emergency-contacts' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "contactName": "string",
  "contactNumber": "string",
  "relationship": "string"
}'

Response fields

FieldTypeDescription
emergencyContactsarray of objectEvery emergency contact currently held for the member, newly created one included, in no guaranteed order. Note that this endpoint returns 201 with an empty body — the shape below is what you get from Get member emergency contacts, the endpoint named in the Location header, and it is the response you have to read to find the id of the contact you just created. An array with no entries means the member exists but has no contacts.
emergencyContacts[].idinteger (int32)The contact record's own identifier, assigned by the platform. This is the {id} in the path of Update emergency contact record and Delete emergency contact record — it is not the member id, and the two are easy to mix up because both are plain integers.
emergencyContacts[].contactNamestringThe contact's name, exactly as it was stored by this endpoint or by the update endpoint.
emergencyContacts[].contactNumberstringThe contact's telephone number as stored. It was never normalised or validated on the way in, so do not assume it is dialable without cleaning it up.
emergencyContacts[].relationshipstringHow the contact is related to the member, as free text. Empty or absent when the contact was stored without one, since the field is optional.

Sample response

201 Created
{
  "emergencyContacts": [
    {
      "id": 12345,
      "contactName": "string",
      "contactNumber": "string",
      "relationship": "string"
    }
  ]
}

Errors

StatusMeaningWhen
400Bad requestThe body failed validation: A contact name is required in this request, A contact number is required in this request, The contact name cannot be more than 50 characters, The contact numbe cannot be more than 50 characters or The relationship cannot be more than 25 characters. The response carries the failing message, and nothing is stored.
404Not foundNo member has the id in the path — Member {memberId} does not exist. The member is checked before the contact is written, so nothing is created.
500Internal server errorAn unexpected server-side failure. The response has no body; re-read the member's contacts with Get member emergency contacts before retrying, or you risk creating a duplicate.

This page as markdown · All pages · llms.txt