Contacts
Learn how to send contacts to Retainful API
Creates or updates a contact in Retainful. If a contact with a matching identifier already exists (such as the same email), that contact is updated. Otherwise, a new contact is created. Email identifier is required to create a contact.
Endpoint
POST /v2/contacts
Authentication You must include your App ID and the API key in the request headers.
Example header:
Request Body
firstName
Yes
string
Contact’s first name.
lastName
No
string
Contact’s last name.
birthDate
No
string (date)
city
No
string
City of residence.
countryCode
No
string
Two-letter country code (e.g., US
, CA
).
country
No
string
Full country name (e.g., United States
).
provinceCode
No
string
Province or state code (e.g., CA
for California).
state
No
string
Full state or province name (e.g., California
).
postalCode
No
string
ZIP or postal code.
gender
No
string
Gender of the contact (m
, f
, etc.).
createdAt
No
string (date)
Contact creation date. If omitted, the current time will be used.
triggerWelcomeEmail
No
boolean
If true
, triggers a welcome email flow (if configured). Default is false
.
listIds
Yes
array of string
Array of list IDs to which the contact will be subscribed.
identifiers
Yes
array of object
Identifiers Object
Each item in the identifiers
array describes a unique identifier (such as an email or phone number) and includes the subscription status and consent details.
type
string
Yes
Type of identifier (e.g., email
, phone
). Accepted values:
email
phone
id
string or number
Yes
The actual identifier (e.g., the email address or phone number).
channels
object
Yes
consent
object
Yes
Channels
The channels
object tracks subscription statuses for each communication channel. For example:
email
object (see below)
Yes (if no phone given)
Subscription status for email channel. Example: "status": "subscribed"
or "unsubscribed"
.
phone
object (see below)
Yes (if no email given)
Subscription status for phone/SMS channel. Example: "status": "subscribed"
or "unsubscribed"
.
Within each channel’s object, the most common field is:
status
: string. Represents the subscription status. Typical values:subscribed
,unsubscribed
Consent
The consent
object captures how and when the contact gave permission for communication.
createdAt
string (date)
Yes
Date-time (in ISO 8601 format) when the contact gave consent (e.g., "2024-03-21T10:30:00.000Z"
).
ip
string
Yes
IP address from which the contact provided consent.
source
string
Yes
Source through which consent was provided (e.g., web_form
, import
, etc.).
Example Request
Example Responses
Successful Creation or Update (200 OK)
Error Responses
400 Bad Request Returned if any required fields are missing or invalid.
401 Unauthorized Returned if the provided API key or App ID is missing or invalid.
500 Internal Server Error Returned if an unexpected error occurred on the server.
Best Practices & Notes
Identifiers Are Mandatory Always supply at least one item in the
identifiers
array so Retainful can correctly locate or create the contact.ISO 8601 Date Formats Ensure date fields (
birthDate
,createdAt
,consent.createdAt
) are valid ISO 8601 strings.Consent Accuracy Provide accurate IP and timestamp in the
consent
object to comply with privacy regulations.Subscription Management Use the
channels
field to manage a contact’s subscription status for different communication channels.Welcome Email Set
triggerWelcomeEmail
totrue
if you have configured an automated welcome email flow and want it triggered for this contact.
Last updated
Was this helpful?