> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leavo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Field Definitions

> Create and manage custom field definitions

## List Definitions

<Card>
  <strong>GET</strong> `/backend/custom-fields`
</Card>

### Response

```json theme={null}
{
  "success": true,
  "data": [
    {
      "id": "field-uuid",
      "name": "Lead Source",
      "field_key": "lead_source",
      "type": "select",
      "options": ["Website", "Referral", "Ads", "Other"],
      "default_value": "Website",
      "required": false
    }
  ]
}
```

***

## Create Definition

<Card>
  <strong>POST</strong> `/backend/custom-fields`
</Card>

### Body Parameters

<ParamField body="name" type="string" required>
  Display name
</ParamField>

<ParamField body="field_key" type="string" required>
  Unique key (used in variables)
</ParamField>

<ParamField body="type" type="string" required>
  Type: `text`, `number`, `date`, `boolean`, `select`
</ParamField>

<ParamField body="options" type="array">
  Options for select type
</ParamField>

<ParamField body="default_value" type="any">
  Default value
</ParamField>

<ParamField body="required" type="boolean" default="false">
  Whether field is required
</ParamField>

### Request Example

```bash theme={null}
curl -X POST "https://api.leavo.ai/backend/custom-fields" \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Lead Source",
    "field_key": "lead_source",
    "type": "select",
    "options": ["Website", "Referral", "Ads", "Other"],
    "default_value": "Website"
  }'
```

***

## Update Definition

<Card>
  <strong>PUT</strong> `/backend/custom-fields/{id}`
</Card>

```bash theme={null}
curl -X PUT "https://api.leavo.ai/backend/custom-fields/field-uuid" \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Lead Origin",
    "options": ["Website", "Referral", "Ads", "Events", "Other"]
  }'
```

***

## Delete Definition

<Card>
  <strong>DELETE</strong> `/backend/custom-fields/{id}`
</Card>

```bash theme={null}
curl -X DELETE "https://api.leavo.ai/backend/custom-fields/field-uuid" \
  -H "Authorization: Bearer your_api_key_here"
```

<Warning>
  Deleting a definition removes all values stored for that field in all leads.
</Warning>
