Customers

Create a customer contact

Creates a new row in customer_contacts.

URL forms (both accepted, code is $customerId = (int)($id ?? ($body['customer_id'] ?? 0))):

  • POST /admin/customers/customer-contacts — customer_id in the body (shown here).
  • POST /admin/customers/customer-contacts/{customer_id} — customer_id in the URL path. Canonical form used by the FE / generated SDK / CustomerContactsCest::addEmail(). When using this form, the body customer_id is ignored. OpenAPI does not allow declaring this as a separate path entry because /customer-contacts/{customer_id} is structurally equivalent to the existing /customer-contacts/{id} (the latter targets a contact id for GET/PUT/DELETE).

Validation: contact_type must be email or phone; label must be one of primary, billing, additional, home, work, mobile, internal; country_code/is_whatsapp are only valid for phone rows. When is_primary=true, the previous primary for the same (customer_id, contact_type, label) tuple is demoted atomically. When the partner's authentication_field === 'email', primary emails must be unique across customers.

post/admin/customers/customer-contacts

Request

  • Base URL: https://demo.splynx.com/api/2.0
  • URL: https://demo.splynx.com/api/2.0/admin/customers/customer-contacts
  • Auth: HTTP basic

Request body

customer_idnumber required

Owning customer (or lead) ID. Maps to customer_contacts.customer_id.

contact_typestring required

Contact type: email or phone.

contact_valuestring required

Email address or phone number. Emails are stored lower-cased; phones are normalised through libphonenumber.

labelstring

Contact label: primary, billing, additional, home, work, mobile, internal. Default: primary.

is_primaryboolean

When true, any existing primary for the same (customer_id, contact_type, label) tuple is demoted atomically.

is_whatsappboolean

WhatsApp flag. Only valid for phone rows.

country_codestring

ISO 3166-1 alpha-2 country code. Only valid for phone rows. If omitted, derived from libphonenumber when possible.

contact_person_idnumber nullable

Optional link to a contact person row.

metadataobject nullable

Free-form JSON metadata (e.g. parse errors for invalid phones).

Example request

{
  "customer_id": 1,
  "contact_type": "email",
  "contact_value": "alpha@example.com",
  "label": "primary",
  "is_primary": true,
  "country_code": "UA",
  "contact_person_id": 1,
  "metadata": {}
}

Response

idnumber required

Contact row ID.

Example response

{
  "id": 1
}

Changes

No recorded changes to this operation across all 1 revision of this API.