Create field

​

Creates field_name on the customer with customer_id. Field names may only contain lowercase Latin letters, numbers, and _.

Creates only — it never overwrites. If the field already exists the request fails with 412 and {"errors": {"field_name": ["The field <name> already exists"]}}; use PUT to update an existing field. To set a field without knowing whether it exists, POST first and fall back to PUT on 412.

Path Parameters

  • Identifier of the customer.

  • Name of the custom field. Only lowercase Latin letters, numbers, and _ are allowed.

Body·

required
application/json
  • date is an ISO 8601 string. datetime is a Unix timestamp. object holds arbitrary JSON — an object or an array — and round-trips as structure rather than as an escaped string; it is the type the builder canvas presents as array/list. An unrecognised type string is not rejected: the value is silently coerced and stored as string.

    values
    stringintegerfloatbooleandatedatetimeobject
  • Field value. Type must match type.

  • Optional extra metadata. Pass {} if not used.

    Properties: 1

Responses

  • application/json
  • application/json
  • application/json
  • application/json
Request Example for post/customers/{customer_id}/fields/{field_name}/
curl 'https://api.landbot.io/v1/customers/1/fields/{field_name}/' \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Token YOUR_AGENT_TOKEN' \
  --data '{
  "type": "datetime",
  "extra": {},
  "value": 1536155712.1234
}'
{
  "success": true,
  "field": {
    "name": "payment_date",
    "type": "datetime",
    "extra": {},
    "value": 1536155712.1234
  }
}