type and format decide what a contact write accepts. Read both from GET /api/fields for the organization you are calling. The workflow around that call is Custom contact data.
The type list is the field registry: int, bool, string, date, email, list, textarea, time, related_contacts, image, relation, user_list, id_number, related_custom_object, and secret. There is no select type. An allowed-option list is values on whatever type has values_enabled.
Types
The vanity word is what a type error says (The field {label} should be of type {vanity}). An int that is not numeric says The field {label} should be a non-negative number instead. A numeric integer, including a negative one, is accepted and stored as an integer.
On create, a value that fails its type fails the whole request inside
failed to create contact. On update, the first failure stops the save with HTTP 400 and The contact can not be edited.
When values_enabled is true, the value must also be one of values. Matching is case-sensitive. Empty string and null skip the list.
Formats
format validates and normalizes. It is not a display hint. These are the formats the API publishes, and the contact types each one allows:
us_ssn is marked sensitive. GET /api/helpers/formats returns this same catalog as data, with message formats, including each format’s label and description. It has no reference page of its own. Call it when you need that text.
Formatters run on update. Create does not run them.
For us_date_mdy on update, a real MM/DD/YYYY value (one or two digits for the month and day) is stored as Y-m-d. A value that is already Y-m-d, or a 10-digit timestamp, is left as-is. The formatter’s error messages are US date is required, US date must be a complete MM/DD/YYYY date, and US date is not a valid calendar date.
On read, date values are Y-m-d and time values are ISO 8601, except created_at, last_seen, last_reply, and any field whose suffix is First or Last: those are Unix timestamps.
Lists
list and relation share these write rules:
- A string is split on characters other than letters, digits, underscore, and hyphen. Each piece is trimmed and lowercased. Duplicates and empty pieces are dropped.
addandremoveget that same treatment.- On update, a JSON array is merged into the current values. It does not replace the list. Send
addandremovewhen you need to name the change.
user_list must already be an array. On update, its add and remove values are lowercased. The type check itself does not lowercase a flat array.
related_contacts supports add and remove and does not lowercase ids.
Related contacts
Send a list of contact ids, or a single id string (it is stored as a one-element list), under the field’s machine name. Ids that are not ObjectIds are dropped with no error. On update, an id equal to the contact you are editing fails with{label} cannot be set to the contact itself.
The read model adds {name}_child_cnt on both the flat list and the bucketed get. The count is an integer, and it is 0 when the field is empty. On get, that count is on the root of data, next to the bucket ids.
Related custom objects
This isrelated_custom_object, not relation.
One record. Send the record id as {name} or {name}_id. It is stored as {name}_id. A blank value is allowed. Any other value must be an ObjectId for a custom-object record in this organization.
Many records. The field’s machine name is treated as {name}_ids. Send either a full list of ids, or an object:
sites is a sample field name. Use the name from GET /api/fields, then append _ids when the field holds many records.The field {label} cannot link more than 50 records. A value that is neither a list of ids nor {add, remove} fails with The field {label} must be a list of record ids or {add, remove}.
An id that is not a record in this organization fails the write. It is not dropped. The message includes Related custom object record id is invalid. On an {add, remove} object, that check runs for add.
Update also requires permission to custom objects, as described in Custom contact data. Create does not apply that permission check.