Retainful Knowledge Base
  • Retainful Knowledge Base
  • Installation
    • WooCommerce
    • Shopify
    • Setting up a Sending Domain
  • Automations
    • Welcome Email Series
    • Abandoned Cart Recovery Emails
    • Thank you Email Series
    • Win Back Emails
    • Product Review Request Email
    • Order Follow Up Emails
    • Product Specific Follow Up Emails
    • Automation Workflow Settings
      • Entry Rules
      • Trigger Rules
      • Customer Rules
      • Exit Rules
      • Block / Steps
    • Smart Sending
    • Smart Delay
  • EMAIL SETTINGS
    • Email Drag and Drop Editor
    • Save as Template
    • Adding a store logo on your email template
    • Adding a Coupon Block to Your Email Template
  • Campaigns
    • Creating a Campaign
  • AUDIENCE
    • Getting started with List & Segments
    • Creating a List
    • Creating a Segment
  • Signup Forms
    • Add to Cart Popup
    • Exit-Intent Popup
    • Welcome Popup
    • Embed Form
    • Enabling Signup Forms In Retainful Settings
    • Popup Editor
    • Popup Triggers
    • Popup Targeting
  • Contacts
    • What is a Contact
    • Import Contacts From Store
    • Import Contacts From CSV File
  • Metrics & Cart Activity
    • Cart Activity
    • Conversions
    • Automation Outbox
    • Campaign Outbox
  • Teams
    • Invite Team Members
  • SETTINGS
    • Retainful Settings
      • General
      • Email
      • Suppression List
      • UTM Parameters
    • Retainful - WooCommerce Plugin Settings
  • Integrations
    • MailChimp
    • MailerLite
    • Klaviyo
    • HubSpot
    • Brevo (Formerly SendInBlue)
    • Active Campaign
    • ConvertKit
    • Zapier
    • Migrate To Improved Integrations
  • HOW TO's
    • How to Insert Retainful's Shortcodes
    • How to Resolve Cart Recovery Emails Sent After Order Placement
    • How to Create Dynamic Coupon Codes in Emails
    • How to check conversions
    • How to ensure GDPR compliance - Marketing Consent
    • What Are Opt-In Settings and How Can You Configure Them?
    • How to Manage Multiple Stores with Retainful
    • How Can You Improve Email Deliverability
    • Best Practices for Higher Deliverability & Engagement
    • Sending Domain
      • GoDaddy
      • Hostinger
    • Google & Yahoo Sender Requirements
    • How Customer's Email Address is captured?
    • How Retainful Tracks Conversions with Coupon Codes?
    • How to delete a Bounce-back email or a failed email address?
    • How Was My Store Account Deleted?
    • How to insert coupon codes in automation emails?
    • How Can You Use Google Fonts in Retainful Email Templates?
  • Developers
    • Getting started
    • Authentication
    • Contacts
    • Lists
Powered by GitBook
On this page
  • Endpoint
  • Request Body
  • Identifiers Object
  • Channels
  • Consent
  • Example Request
  • Example Responses
  • Best Practices & Notes

Was this helpful?

  1. Developers

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:

Retainful-Api-Key: <Your API Key>
Retainful-App-Id: <Your App ID>

Request Body

Field
Required?
Type
Description

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.

Field
Type
Required?
Description

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:

{
  "channels": {
    "email": {
      "status": "subscribed"
    },
    "phone": {
      "status": "unsubscribed"
    }
  }
}

Channel Key
Value
Required?
Description

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.

{
  "consent": {
    "createdAt": "2024-03-21T10:30:00.000Z",
    "ip": "192.168.1.1",
    "source": "web_form"
  }
}
Field
Type
Required?
Description

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

POST /v2/contacts
Retainful-Api-Key: YOUR_API_KEY
Retainful-App-Id: YOUR_APP_ID
Content-Type: application/json

{
  "firstName": "John",
  "lastName": "Doe",
  "birthDate": "1990-01-15T00:00:00.000Z",
  "city": "San Francisco",
  "countryCode": "US",
  "country": "United States",
  "provinceCode": "CA",
  "createdAt": "2024-03-21T10:30:00.000Z",
  "gender": "m",
  "postalCode": "96162",
  "state": "California",
  "triggerWelcomeEmail": false,
  "listIds": [
    "NdrDSPTeIvRMEtzufwDyKMWjmcOMsOxkxTCs"
  ],
  "identifiers": [
    {
      "type": "email",
      "id": "johndoe@gmail.com",
      "channels": {
        "email": {
          "status": "subscribed"
        }
      },
      "consent": {
        "createdAt": "2024-03-21T10:30:00.000Z",
        "ip": "192.168.1.1",
        "source": "web_form"
      }
    },
    {
      "type": "phone",
      "id": "+19013421324",
      "channels": {
        "phone": {
          "status": "subscribed"
        }
      },
      "consent": {
        "createdAt": "2024-03-21T10:30:00.000Z",
        "ip": "192.168.1.1",
        "source": "web_form"
      }
    }
  ]
}

Example Responses

Successful Creation or Update (200 OK)

{
  "status": true,
}

Error Responses

  • 400 Bad Request Returned if any required fields are missing or invalid.

    {
      "status": "error",
      "message": "Invalid request. 'identifiers' field is required."
    }
  • 401 Unauthorized Returned if the provided API key or App ID is missing or invalid.

    {
      "status": "error",
      "message": "Unauthorized access. Invalid or missing credentials."
    }
  • 500 Internal Server Error Returned if an unexpected error occurred on the server.

    {
      "status": "error",
      "message": "An unexpected error occurred."
    }

Best Practices & Notes

  1. Identifiers Are Mandatory Always supply at least one item in the identifiers array so Retainful can correctly locate or create the contact.

  2. ISO 8601 Date Formats Ensure date fields (birthDate, createdAt, consent.createdAt) are valid ISO 8601 strings.

  3. Consent Accuracy Provide accurate IP and timestamp in the consent object to comply with privacy regulations.

  4. Subscription Management Use the channels field to manage a contact’s subscription status for different communication channels.

  5. Welcome Email Set triggerWelcomeEmail to true if you have configured an automated welcome email flow and want it triggered for this contact.

PreviousAuthenticationNextLists

Last updated 1 month ago

Was this helpful?

Date of birth in format.

Required. An array that defines how to identify this contact (email, phone, etc.). See for detailed structure.

An object with channel-specific statuses. E.g., { "email": { "status": "subscribed" } }. See Ch

Contains details about when, how, and where consent was granted. See

ISO 8601
table below
annels object
Consent object