API Reference

Create Contact Property

POST /contact-properties — define a custom property for your contacts.

POST/contact-properties

Creates a custom property for your contacts. A property defines a typed, named field (with an optional fallback) that you can then set per-contact and reference in templates and segments.

Body parameters
keystringrequired

The property key. Max length is 50 characters. Only alphanumeric characters and underscores are allowed. Also accepted as name (alias).

typestringoptional

The property type. Possible values: string or number. Defaults to string when omitted.

fallback_valuestring | numberoptional

The default value to use when the property is not set for a contact. Must match the type specified in the type field.

import { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.contactProperties.create({
  "key": "company_name",
  "type": "string",
  "fallback_value": "Acme Corp"
});
console.log({ data, error });

Response

{
  "object": "contact_property",
  "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e"
}