Skip to content

Create Contact

Required scope: contact:create

Creates a contact from the supplied fields. At least one of name, email, or phone is required.

This operation is get-or-create: if the email or phone already identifies a contact in the workspace, the existing contact is returned instead of creating a duplicate. That makes create idempotent by identifier and safe to retry. phone is accepted in local or international form and normalized to E.164; pass phoneCountry (an ISO 3166-1 alpha-2 code such as NL) to resolve a local number.

Generated Reference
POST /public-api/publicapi.v1.Contact/CreateContact

Creates a contact, or returns the existing contact when the supplied email or phone already identifies one. At least one of name, email, or phone is required. Because a matching identifier returns the existing contact, this operation is idempotent by identifier.

Request CreateContactRequest
Response CreateContactResponse

CreateContactRequest

Field Type Description
name string Display name. At least one of name, email, or phone is required.
email string Email address. Matching an existing contact by email returns that contact.
phone string Phone number in any common format; normalized to E.164 server-side. Matching an existing contact by phone returns that contact.
phone_country string Two-letter ISO 3166-1 country code used to normalize a national phone number, for example "NL". Ignored when phone is already in E.164 format.
locale string BCP 47 locale tag, for example "en" or "nl-NL".

CreateContactResponse

Field Type Description
contact Contact The created or matched contact.
{
"name": "Alex Jansen",
"email": "[email protected]",
"phone": "0612345678",
"phoneCountry": "NL",
"locale": "nl-NL"
}
Terminal window
curl https://portal.heyx.app/public-api/publicapi.v1.Contact/CreateContact \
-H "Authorization: Bearer hx_sk_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Alex Jansen",
"email": "[email protected]",
"phone": "0612345678",
"phoneCountry": "NL"
}'

Successful requests return 201 Created with the created (or matched) contact.

{
"contact": {
"id": "<contact-id>",
"name": "Alex Jansen",
"email": "[email protected]",
"phoneE164": "+31612345678",
"locale": "nl-NL",
"createdAt": 1726300000,
"updatedAt": 1726300000
}
}