Upsert contact

Creates a new contact or updates an existing one.

Use Case: Use this endpoint to synchronize your customer data with Wax CRM. This is useful for:

  • Importing contacts from your e-commerce platform, CRM, or other systems
  • Updating contact information when customers update their profile, including their phone number
  • Adding custom attributes to contacts for segmentation and personalization

Matching:

  • By default the contact is matched on phone_number (or on email when no phone number is sent)
  • Send reference_key: external_id to match on your own identifier instead. The matched contact keeps its id, conversation history, attributes, tags and opt-in statuses, and its phone_number is updated when a different one is sent
  • With reference_key: external_id, a sent phone_number must be a valid mobile number, since it replaces the contact's current one
  • A phone number change resets the WhatsApp deliverability and identity fields of the contact (they describe the previous number); the contact is reachable again at the new number once it opts in or writes to you
  • When no contact matches the external_id, the contact owning the sent phone number is used if it has no external_id yet; otherwise a new contact is created
  • A phone number or an email is always required to create a contact

Technical Details:

  • email is only updated when the field is sent; omit it to keep the current value
  • Custom attributes are upserted (created or updated) individually
  • Tags are added to the contact (existing tags are preserved)
  • 422 is returned when the sent phone_number or external_id already belongs to another contact of your organization: delete that contact first or send the matching value

Errors (422): Contact must have either an email or a phone number, Invalid phone number, reference_key must be one of: phone_number, external_id, external_id is required when reference_key is external_id, Phone number already belongs to another contact, External id already belongs to another contact

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
enum
Defaults to phone_number

The column used to find the contact to update: phone_number (default) or external_id. The value is read from the body field of the same name.

Allowed:
string

The contact phone number in E.164 format. Required if email is not provided. With a non-phone reference_key, a different number updates the matched contact in place.

string

The contact email address. Required if phone_number is not provided. Only updated when the field is sent (send null to clear it).

string

The contact first name.

string

The contact last name.

string

Your own identifier for the contact, unique within your organization. Stored whenever sent; the lookup value when reference_key is external_id.

attributes
object

Custom contact attributes that will be stored in the CRM. Attribute will be created if they do not exist. Base attributes such as whatsapp_opt_in_status and sms_opt_in_status (opted_in, opted_out) are updated too.

tags
array of strings

An array of tag names to assign to the contact. Tags will be created if they do not exist.

tags
Headers
string
required

Bearer token

Responses
200

successful

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json