---
title: "Create a custom field definition"
description: "Creates a workspace-scoped custom field definition for contacts, appointments, or workspace-level values."
---

> Documentation Index
> Fetch the complete documentation index at: https://developer.channelautomations.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Channel Automation API › Contacts

`POST /api/custom-fields`

Creates a workspace-scoped custom field definition for contacts, appointments, or workspace-level values.

## Request body

_Required._

- `workspace_id` (`post/api/custom-fields.workspace_id`; string, required)
- `name` (`post/api/custom-fields.name`; string, required)
- `label` (`post/api/custom-fields.label`; string, required)
- `field_type` (`post/api/custom-fields.field_type`; string, required)
  - one of `"text"`, `"url"`, `"number"`, `"date"`, `"datetime"`, `"boolean"`, `"select"`, `"multi_select"`, `"json"`
- `object_type` (`post/api/custom-fields.object_type`; string, optional)
  - one of `"contact"`, `"appointment"`, `"workspace"`; default `"contact"`
- `options` (`post/api/custom-fields.options`; array<object>, optional)
- `is_required` (`post/api/custom-fields.is_required`; boolean, optional)
- `description` (`post/api/custom-fields.description`; string, optional)
- `default_value` (`post/api/custom-fields.default_value`; unknown, optional) — Workspace-level default value for object_type=workspace.

## Example request

```json
{
  "workspace_id": "string",
  "name": "string",
  "label": "string",
  "field_type": "text",
  "object_type": "contact",
  "options": [
    {}
  ],
  "is_required": true,
  "description": "string",
  "default_value": null
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.channelautomation.com/api/custom-fields \
  --header 'Content-Type: application/json' \
  --data '
{
  "workspace_id": "string",
  "name": "string",
  "label": "string",
  "field_type": "text",
  "object_type": "contact",
  "options": [
    {}
  ],
  "is_required": true,
  "description": "string",
  "default_value": null
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/custom-fields';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    workspace_id: 'string',
    name: 'string',
    label: 'string',
    field_type: 'text',
    object_type: 'contact',
    options: [{}],
    is_required: true,
    description: 'string',
    default_value: null
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/custom-fields"

payload = {
    "workspace_id": "string",
    "name": "string",
    "label": "string",
    "field_type": "text",
    "object_type": "contact",
    "options": [{}],
    "is_required": True,
    "description": "string",
    "default_value": None
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Custom field created successfully

### 400

Missing or invalid custom field parameters

### 500

Internal server error

#### Example

```json
{
  "error": "Internal server error",
  "details": "string",
  "success": false
}
```

- `error` (`post/api/custom-fields.response.500.error`; string, optional)
  - example `"Internal server error"`
- `details` (`post/api/custom-fields.response.500.details`; string, optional)
- `success` (`post/api/custom-fields.response.500.success`; boolean, optional)
  - example `false`


Source: https://developer.channelautomations.com/api/post-api-custom-fields/index.md
