POST Register new group member

Overview

The Group Member Registration endpoint creates and returns a new group member. A valid request body is required. The group UUID in the path must match the group of the invite code.

Base path

/api/v1/groups/GROUP_UUID/members

Path parameters

GROUP_UUID

(string) The unique identifier for a group.

POST body

See the example below. Of the fields shown, user and inviteCode are mandatory. The value of inviteCode must be a real invite code that has been defined on a plan. The email value of the user object must be a valid email address that is not yet registered to Pattern Health. The gender value of the user object must be one of: male, female, other, preferNotToSay.

{
    "inviteCode": "EXAMPLE123",
    "groupMember": {
        "user": {
            "birthDate": "2000-01-01",
            "email": "example_user@example.org",
            "firstName": "John",
            "gender": "male",
            "lastName": "Doe",
            "locale": "en-US",
            "mobileNumber": "+19195551212",
            "timeZone": "America/New_York"
        },
        "tags": [
            "ExampleTag"
        ],
        "attributes": {
            "ExampleAttribute": "example value"
        },
        "planSettings": {
            "startDate": "2022-06-14",
            "endDate": "2023-06-14"
        }
    }
}

Curl example

curl -L -X POST 'https://API_HOSTNAME/api/v1/users' \
-H 'Authorization: Bearer BEARER_TOKEN' \
-H 'Content-Type: application/json' \
--data-raw '{
    "inviteCode": "EXAMPLE123",
    "groupMember": {
        "user": {
            "birthDate": "2000-01-01",
            "email": "example_user@example.org",
            "firstName": "John",
            "gender": "male",
            "lastName": "Doe",
            "locale": "en-US",
            "mobileNumber": "+19195551212",
            "timeZone": "America/New_York"
        },
        "tags": [
            "ExampleTag"
        ],
        "attributes": {
            "ExampleAttribute": "example value"
        },
        "planSettings": {
            "startDate": "2022-06-14",
            "endDate": "2023-06-14"
        }
    }
}'

Response

The response is a new user object, including default values for fields that were not specified in the request body.

Response body

{
    "group": {
        "href": "/api/v1/groups/GROUP_UUID",
        "title": "Group 1"
    },
    "href": "/api/v1/groups/GROUP_UUID/users/USER_UUID",
    "plan": {
        "href": "/api/v1/groups/GROUP_UUID/plans/PLAN_UUID",
        "title": "Plan 1"
    },
    "planSettings": {
        "startDate": "2022-06-14",
        "endDate": "2023-06-14"
    },
    "tags": [
        "ExampleTag"
    ],
    "user": {
        "birthDate": "2000-01-01",
        "email": "example_user@example.org",
        "firstName": "John",
        "gender": "male",
        "lastName": "Doe",
        "locale": "en-US",
        "mobileNumber": "+19195551212",
        "timeZone": "America/New_York",
        "uuid": "USER_UUID"
    },
    "attributes": {
        "ExampleAttribute": "example value"
    }
}

Result attributes

email

(string) A unique and valid email address.

mobileNumber

(string) A valid phone number, complete with country code.

firstName

(string) The user’s first name.

lastName

(string) The user’s last name

timezone

(string) The group member’s current time zone, expressed in IANA standard format. Example: America/New_York

locale

(string) The group member’s current locale, expressed in accordance with IETF BCP 47.

gender

(string) One of: male, female, other, preferNotToSay

settings

(json) Settings that control certain aspects of how the system interacts with the user.

notificationSettings

(json) Settings that control how and when the system is able to send notifications and messages to the user.

birthDate

(date) The user’s date of birth.

accountStatus

(string) One of: pendingInvite, invited, inviteBounced, active

locked

(boolean) Identifies whether a user account has been locked.

verified

(boolean) Identifies whether a user account has been verified.

type

(string) One of: endUser, guest, api

mobileNumberVerified

(boolean) Identifies whether a user’s mobile number has been verified via text message exchange.

attributes

(json) Custom attributes that provide a more detailed description of the user.

created

(timestamp) The instant that the user was created.

modified

(timestamp) The instant of the most recent change to the user record.

href

(string) A URL fragment that can be used to retrieve details about the specific user.

uuid

(string) A unique identifier for the user.

passwordAssigned

(boolean) Identifies whether the user has a password.

guest

(boolean) Identifies whether the user is a guest or is fully registered.

Data types

href

A URL fragment that can be used to retrieve details about a specific object.

link

A JSON subdocument that contains an href and a title. It is used within an object to refer to another related object.

totalCount

The total number of objects that are available from a given query, not limited to the current page.

timestamp

A time expressed in ISO 8601 format (yyyy-MM-ddThh:mm:ss.sssZ), in UTC timezone. Example: 2021-05-20T15:13:38.515Z