Create a custom field

SDK platic.customFields.create()

Define a value you want to store for workspace contacts. Send name and type; fieldId is generated from the name. For select, also send the available options.

Example

await platic.customFields.create({ name: "Plan", type: "text" });

If your credential covers several workspaces, add ?workspace=<id> to say which one you work in (list workspaces); without it the answer is 400. A single-workspace credential never needs it.

Request body

{
  "name": "Membership level",
  "type": "text",
  "description": "Current membership type of the customer",
  "automatic": true,
  "overwritable": false
}

Body parameters

ParameterTypeDescriptionRequiredDefault
namestringField name (1-100 characters)✓—
typestringField type. One of: text, textList, number, numberList, date, email, phone, imageUrl, imageUrlList, fileUrl, fileUrlList, select✓—
descriptionstringField description (max 500 characters)—""
automaticbooleanWhether the AI should fill the field automatically from the conversation—false
overwritablebooleanWhether the AI can overwrite the field's existing value—false
optionsarrayselect only. Option catalog (required and non-empty for select). Each option: { "label": string, "id"?: string, "color"?: string, "order"?: number, "archived"?: boolean }. Up to 50 options.Conditional—
orderedbooleanselect only. Whether the options are an ordered sequence (stages/steps). Only affects display order; it does not restrict which option can be assigned.—false

Response

{
  "status": "success",
  "message": "Custom field created successfully",
  "data": {
    "id": "membership_level"
  }
}

Select fields (select)

A select field (selection/status) stores one option from a predefined catalog. The value saved on each customer is the option id (not the label).

{
  "name": "Sales stage",
  "type": "select",
  "description": "Current stage of the customer in the funnel",
  "ordered": true,
  "options": [
    { "label": "New" },
    { "label": "Contacted" },
    { "label": "Closed" }
  ]
}

In this example the options are created with ids new, contacted, and closed. You can set your own id or a color (hex) per option; if you omit the id, it is derived from the label.

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTThe body fails validation: name is missing or longer than 100 characters, type is not one from the list, description is longer than 500, or a select comes without options. details.issues says which field
400INVALID_REQUESTThe options of a select are not valid (repeated ids, no active option…), or no valid id can be derived from name. details.message says what happened
400CUSTOM_FIELD_LIMIT_REACHEDThe workspace already has 25 active custom fields. details.limit is 25. Delete one before creating another
400INVALID_REQUESTYour credential covers several workspaces and you did not send ?workspace=, or you sent one it does not cover. details.available lists the ones you can use
401UNAUTHENTICATEDThe credential is missing or invalid
403FORBIDDENThe credential does not have the Contacts module (Missing contacts permission), or it is an OAuth token without the platica:write scope
409CUSTOM_FIELD_ALREADY_EXISTSA field with the id derived from name already exists. details.id is that id
{
  "code": 409,
  "error": "Conflict - The resource state conflicts with this request",
  "details": {
    "code": "CUSTOM_FIELD_ALREADY_EXISTS",
    "message": "A custom field with id \"membership_level\" already exists in this workspace",
    "id": "membership_level"
  }
}

The general error format is in Errors.

Notes

  • The field id is generated automatically from the name: lowercased, accents removed, and non-alphanumeric characters replaced with underscores _.
  • If a field with the same derived id already exists, the API returns 409 with CUSTOM_FIELD_ALREADY_EXISTS. Use a different name or update the existing field.
  • Types ending in List (textList, numberList, imageUrlList, fileUrlList) store multiple values per contact.
  • In a select field, each option’s id is derived from its label and stays fixed when you rename it. Labels cannot be empty and ids must be unique within the field.
  • To assign a select value to a customer, send the id or the label of an active option in customFields (see Create a Customer).
  • name and type are immutable after the field is created. To change them, delete the field and create it again. A select field's options and ordered can be edited afterwards (see Update Custom Field).