Contacts

Create contact field

Changed on

Adds a typed field to contacts. A field gives a metadata key a type: from then on contact writes to that key are checked and stored in canonical form (dates as YYYY-MM-DD, choices as their key, numbers as decimal strings), so {{customer.fields.<key>}} in emails, the metadata[<key>] filter and the broadcast fields audience keep working. Metadata keys without a field stay free-form. billing_address is reserved. Types: text, number, money, date, boolean, url, email, and select and multi_select (need options). An account has at most 100 active contact fields. Answers 422 when the key is taken or the options do not fit the type.

post/contacts/fields

Request

  • Base URL
    https://api.crevio.co/v1
  • Auth
    API key in header Authorization

Headers

Idempotency-Key, string

Makes this write safe to retry: a repeat with the same key replays the first response instead of creating a second resource. Scoped to the account, remembered for 24 hours; reusing a key with a different payload is an error.

Request body

ContactFieldCreateRequest required
key, string required

Lowercase snake_case name of the field, such as plan_interest: the metadata key its value is stored under. It never changes.

type, 'text' | 'number' | 'money' | 'date' | 'boolean' | 'url' | 'email' | 'select' | 'multi_select' required

What the field holds. It never changes.

label, string

Display name. Defaults to the key, humanized.

options, union[]

select and multi_select only: the choices, as labels or {key, label} objects. Values are stored as the choice's key. On update this replaces the list; values already stored are kept.

currency, string

money only: a three-letter ISO currency code, such as usd. Defaults to the account's currency.

position, integer

Display order. Defaults to last.

Response

Field created

ContactField required
object, string required
id, string required
label, string required
position, number required
created_at, string date-time required
updated_at, string date-time required
type, 'text' | 'number' | 'money' | 'date' | 'boolean' | 'url' | 'email' | 'select' | 'multi_select' required
options, object[] nullable required

The choices of a select or multi_select field. A value is a choice's key.

currency, string nullable required

A money field's ISO currency code, when set.

archived, boolean required

Changes