The POST /publisher/customField endpoint creates new custom field keys or updates existing ones for an app. A custom field key is the schema of a custom field — its name, data type, options, validators, and other settings — defining what data the field can hold. The actual data entered by individual users is stored as values, managed by separate endpoints. Pass an array of one or more field keys in the request body.
Request
POST https://api.piano.io/id/api/v1/publisher/customField?aid={{aid}}
Headers
-
Authorization: {{api_token}} -
Content-Type: application/json
Request body
The request body is a JSON array. Each element describes one custom field with the following properties:
|
Field |
Type |
Required |
Description |
|---|---|---|---|
|
|
string |
Yes |
Internal identifier of the field. Must match the pattern |
|
|
string |
Yes |
Human-readable label shown in the dashboard and on user-facing forms. |
|
|
string |
Yes |
One of: |
|
|
string |
No |
Internal description for administrators. |
|
|
boolean |
No |
Whether end users can edit the field’s value. Defaults to |
|
|
boolean |
No |
Whether the field is marked as required by default in forms. Defaults to |
|
|
array of objects |
No |
Validation rules applied to user input later (not to the create/update request itself). Each entry has three keys: |
|
|
array of strings |
Conditional |
Selectable values for |
|
|
integer |
Conditional |
For list-type fields, selects either a custom or predefined value list. Predefined values for options_link . |
|
|
array of strings |
No |
For list-type fields, a subset of |
|
|
string |
No |
Name of an existing custom field set this field belongs to. The set must already exist; the API does not create sets. |
|
|
object |
No |
Type-specific settings. See Attribute object below. |
|
|
object |
No |
Tooltip shown next to the field. Schema: |
Attribute object
The optional attribute object holds type-specific settings. All keys are optional.
|
Field |
Type |
Description |
|---|---|---|
|
|
string |
Pre-filled value for new users. |
|
|
string |
Placeholder text shown in the input. |
|
|
boolean |
For |
|
|
string |
For |
|
|
boolean |
Enable browser autofill on this field. |
|
|
string |
Browser autofill hint. One of: |
|
|
boolean |
For country fields, preselect a value by IP geolocation. |
|
|
boolean |
Enable DMP segmentation for this field. |
|
|
boolean |
Mark as a global custom field (shared across multiple apps). |
|
|
array of strings |
App IDs this global field applies to. |
Examples
The base call is the same for every variant; only the JSON request body changes:
curl --location 'https://api.piano.io/id/api/v1/publisher/customField?aid={{aid}}'
--header 'Authorization: {{api_token}}'
--header 'Content-Type: application/json'
--data-raw '{{request body}}'
Plain text field with a default value
[
{
"field_name": "TESTAPI",
"title": "TESTAPI",
"data_type": "TEXT",
"editable": true,
"required_by_default": false,
"validators": [],
"options": [],
"attribute": { "default_value": "123" }
}
]
Single-select list with a custom value list
[
{
"field_name": "favorite_day",
"title": "Favorite day",
"data_type": "SINGLE_SELECT_LIST",
"editable": false,
"validators": [],
"options": ["Monday", "Tuesday", "Wednesday"],
"options_link": 0
}
]
Multi-select list with a custom value list
[
{
"field_name": "custom_days",
"title": "Days",
"data_type": "MULTI_SELECT_LIST",
"editable": false,
"validators": [],
"options": ["Monday", "Tuesday", "Wednesday"],
"options_link": 0
}
]
Single-select list using a predefined thesaurus (here, Countries — options_link: 1)
[
{
"field_name": "country_of_residence",
"title": "Country",
"data_type": "SINGLE_SELECT_LIST",
"editable": false,
"validators": [],
"options": [],
"options_link": 1
}
]
For the full list of options_link values and the values returned by each predefined thesaurus, see Predefined values for options_link.