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
curl https://api.platic.ai/v1/custom-fields \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Plan", "type": "text" }' 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
| Parameter | Type | Description | Required | Default |
|---|---|---|---|---|
name | string | Field name (1-100 characters) | ✓ | — |
type | string | Field type. One of: text, textList, number, numberList, date, email, phone, imageUrl, imageUrlList, fileUrl, fileUrlList, select | ✓ | — |
description | string | Field description (max 500 characters) | — | "" |
automatic | boolean | Whether the AI should fill the field automatically from the conversation | — | false |
overwritable | boolean | Whether the AI can overwrite the field's existing value | — | false |
options | array | select 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 | — |
ordered | boolean | select 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
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | The 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 |
400 | INVALID_REQUEST | The 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 |
400 | CUSTOM_FIELD_LIMIT_REACHED | The workspace already has 25 active custom fields. details.limit is 25. Delete one before creating another |
400 | INVALID_REQUEST | Your 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 |
401 | UNAUTHENTICATED | The credential is missing or invalid |
403 | FORBIDDEN | The credential does not have the Contacts module (Missing contacts permission), or it is an OAuth token without the platica:write scope |
409 | CUSTOM_FIELD_ALREADY_EXISTS | A 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
idis generated automatically from thename: lowercased, accents removed, and non-alphanumeric characters replaced with underscores_. - If a field with the same derived
idalready exists, the API returns409withCUSTOM_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
selectfield, each option’sidis 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
selectvalue to a customer, send theidor the label of an active option incustomFields(see Create a Customer). nameandtypeare immutable after the field is created. To change them, delete the field and create it again. Aselectfield'soptionsandorderedcan be edited afterwards (see Update Custom Field).