POST
/api/public/v1/customer-custom-fieldsCreate a customer custom field
Define a new custom field on customers for a location.
Required scope
The access token must carry this scope. A token missing it gets 403 Forbidden. Grant them to an API client under Dev Tools → API, to an assistant or CLI sign-in when you approve or edit it under Dev Tools, and to a teammate under Employee → Permissions.
customer:custom-fields:write
Request Body
| Property | Type | Description |
|---|---|---|
locationId | string | Owning location. |
name | string | Internal name (a-z, A-Z, 0-9, _). |
type | string | Field type. |
label | string | Display label. |
placeholder | string | Placeholder text. |
required | boolean | Whether the field is required. |
options | array | For SELECT: array of { value, label }. |
displayOrder | number | Display position. |
POSTExample request
curl
curl -X POST "https://www.pxb.app/api/public/v1/customer-custom-fields" \
-H "Authorization: Bearer your_access_token" \
-H "Content-Type: application/json" \
-d '{
"locationId": "loc_abc",
"name": "preferred_contact",
"type": "SELECT",
"label": "Preferred contact method",
"options": [
{
"value": "email",
"label": "Email"
},
{
"value": "sms",
"label": "SMS"
}
]
}'200Example response
json
{
"message": "Customer custom field created successfully!",
"content": {
"customField": {
"id": "cf_1"
}
}
}In the console
The same thing done by hand, for anyone comparing the API against the screen they already use.
xRM → Accounts → Custom fields
/xrm- Open the Custom fields dialog from the accounts table header.
- Add a field and pick its type.