Create custom field
POST
/api/v1/ext/custom-fields
Define a custom field for a workspace.
Auth: Bearer access_token
Scope: contacts.write
Leave field_key out to have it made from the label (Lead Source → lead_source); a key you pass is lower-cased and anything but letters, digits and _ becomes _. Keys are unique per workspace: a taken key answers 409 (update it with *Update custom field* instead). select and multi_select need options. Writing a value under a brand-new key on a contact also creates a text definition for it, so this call is for fields that need a type, options, a label or an order up front.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| workspace_id | body | number | yes | The workspace. |
| field_label | body | string | yes | Shown in the dashboard. Up to 100 characters. |
| field_type | body | enum | yes | How values are validated and shown. |
| field_key | body | string | no | The key in custom_fields. Letters, digits and _, up to 50 characters. Default: made from the label. |
| options | body | array<string> | no | The choices (required for select / multi_select; up to 100, 100 characters each). Ignored for other types. |
| is_required | body | boolean | no | Marks the field required in the dashboard. Default false. |
| sort_order | body | number | no | Display position, lowest first. Default 0. |
Responses
| Status | When |
|---|---|
201 | Created |
400 | Missing label or type, bad type, or a select without options |
401 | Missing or invalid token |
403 | Missing scope |
404 | Workspace does not exist or is not owned by the installer (same response for both) |
409 | The key is taken |
RequestResponses
curl -X POST "https://backend.mysmsgateway.app/api/v1/ext/custom-fields" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": 7,
"field_label": "Lead Source",
"field_type": "select",
"options": [
"Web",
"Referral",
"Event"
],
"sort_order": 1
}'Created
{
"success": true,
"message": "Custom field created",
"data": {
"id": 41,
"workspace_id": 7,
"field_key": "lead_source",
"field_label": "Lead Source",
"field_type": "select",
"options": [
"Web",
"Referral",
"Event"
],
"is_required": false,
"sort_order": 1,
"created_at": "2026-11-04T02:20:00.000Z",
"updated_at": "2026-11-04T02:20:00.000Z"
}
}Try It!
This endpoint needs a bearer token. Open Settings (top right) and paste your access_token.
Body (JSON)
Request URL
POSThttps://backend.mysmsgateway.app/api/v1/ext/custom-fields
Previous
« List custom fields
Next
Update custom field »
