---
docId: doc_6d166855e0534047b9e1876e2c9b00c7
title: Create a custom field
description: Create a new custom field for the contacts in your workspace.
api:
  group: campos-personalizados
  auth: bearer
  operations:
    - operationId: createCustomField
      method: POST
      path: /v1/custom-fields
      postmanName: Create a custom field
---

<script>
  import { Ways } from '$lib/components';
</script>

# Create a custom field

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

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl https://api.platic.ai/v1/custom-fields \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Plan", "type": "text" }'
```

</Ways.Way>
<Ways.Way name="sdk">

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

</Ways.Way>
</Ways>

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

## Request body

```json
{
  "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

```json
{
  "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).

```json
{
  "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 |

```json
{
  "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](/api-reference/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](/api-reference/contacts/create)).
- `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](/api-reference/custom-fields/update)).
