c0dcbcafc495
Upsert up to 50 users at a time based on nectar_id (recommended), email, or employee_id
Creates or updates users. Supports inviting users via the user_invited field and send_invites query parameter.
Invite behavior:
-
Setting user_invited: true on a user in the request body will mark that user as invited in the database.
-
Invite emails are only sent when send_invites=true is passed as a query parameter.
-
When send_invites=true, invite emails are sent to all users that have user_invited: true in the current request body, including users that were already invited previously.
-
When send_invites=false or omitted, user_invited: true still updates the database, but no emails are sent.
-
user_invited can only be set to true. Setting it to false is not allowed and will return an error.
-
The response includes an invite_email_sent field for each user indicating whether an invite email was sent during this request.
Duplicate identifiers:
-
When multiple users in the request share the same email, employee_id, or phone_number, the request still returns 200 but the response warnings array describes which duplicates were detected and how they were handled.
-
Duplicate email or employee_id: all users sharing that value are skipped (not created or updated).
-
Duplicate phone_number: if the user has another identifier (email, employee_id, nectar_id), the phone number is stripped and the user is still processed; otherwise the user is skipped.
-
Callers should inspect warnings after every upsert to reconcile their source data.
Query parameters
Returns the created/updated users base or expanded data
The keys to use to lookup users. If none are provided, defaults to the behavior below.
When set to true, invite emails will be sent to all users with user_invited: true in the request body, including users that were already invited previously. When set to false or omitted, user_invited: true will still update the user in the database but no invite emails will be sent.
Request body
Example request
[
{
"phone_number": "123-456-7890",
"custom_properties": {
"custom_property_1": "string",
"custom_property_2": 1,
"custom_property_3": true,
"custom_property_4": null
}
}
]Response
OK
Example response
{
"data": {
"users": [
{
"phone_number": "123-456-7890"
}
]
}
}