Custom Fields
Custom Fields Object
Custom Fields are represented as JSON objects with the following properties
id
integer
The ID of the custom field.
name
string
The name of the custom field.
version
string
Version of current data, increments each time we update the custom field object.
type
enum
Denotes the type of the custom field.
select
A custom field that allows a single selection from predefined options.
multi_select
A custom field that supports multiple selections from a list of predefined options.
text
A custom field for entering freeform text input.
date
A custom field for selecting a specific date.
number
A custom field for entering numerical values.
created_at
string
The creation timestamp of the request
updated_at
string
The update timestamp of the request
Config Object
Config is represented as a JSON object with the following properties. It will hold different properties for different types of custom Fields.
Config Object for Select Custom Field
type
literal
Must be exactly: 'select'
options
object array
Array of selection options with the following structure:
id
string
Unique identifier for the option
value
string
Display text for the option
The order of elements in the array determines the sequence in which they are displayed across various user interfaces.
last_option_id
number
Represents the highest ID number used for options.
Config Object for Multi-Select Custom Field
type
literal
Must be exactly: 'multi_select'
options
object array
Array of selection options with the following structure:
id
string
Unique identifier for the option
value
string
Display text for the option
The order of elements in the array determines the sequence in which they are displayed across various user interfaces.
last_option_id
number
Represents the highest ID number used for options.
Config Object for Text Custom Field
type
literal
Must be exactly: 'text'
max_length
number
Optional. Maximum number of characters allowed in the text field. Defaults 255
single_line
boolean
Optional. If true, the text field will be displayed as a single-line text field in various user interfaces. If false it will be displayed as a multi-line text field. Default value:
Config Object for Date
type
literal
Must be exactly: 'date'
Config Object for Number
type
literal
Must be exactly: 'number'
Get All Custom Fields
GET
https://api.clearfeed.app/v1/rest/custom-fields
Get all custom fields in an account
{
"custom_fields": [
{
"id": 1,
"name": "player select",
"version": 0,
"type": "select",
"config": {
"type": "select",
"options": [
{
"id": "1",
"value": "joel"
},
{
"id": "2",
"value": "ellie"
}
],
"last_option_id": 2
},
"created_at": "2024-10-30T18:18:10.839Z",
"updated_at": "2024-10-30T18:18:10.839Z"
}
]
}
Create Custom Field
POST
https://api.clearfeed.app/v1/rest/custom-fields
Create a custom field to use them in forms.
Request Body
name*
string
Name of the custom field
type*
enum
Type of the custom field. Must be one of: select
, multi_select
, text
, date
, number
config
object
Config object for the custom field. Required structure depends on the field type. See Config Object for type-specific details.
Example request body:
{
"name": "player select",
"type": "select",
"config": {
"options": [
{
"value": "joel"
},
{
"value": "ellie"
}
]
}
}
{
"id": 1,
"name": "player select",
"version": 0,
"type": "select",
"config": {
"type": "select",
"options": [
{
"id": "1",
"value": "joel"
},
{
"id": "2",
"value": "ellie"
}
],
"last_option_id": 3
},
"created_at": "2024-10-30T18:18:10.839Z",
"updated_at": "2024-10-30T18:18:10.839Z"
}
Update Custom Field
PUT
https://api.clearfeed.app/v1/rest/custom-fields/:id
Update an existing custom field.
Request Parameters
id*
integer
The ID of the custom field to update
Request Body
name*
string
Name of the custom field
type*
enum
Type of the custom field. Must be one of: select
, multi_select
, text
, date
, number
config
object
Configuration object for the custom field. Required structure depends on the field type. See Config Object for type-specific details.
Important: Once created, a custom field's type cannot be modified. However, you can:
For
select
andmulti_select
fields: add, remove, or modify the available optionsFor
text
fields: adjust the character limit
Example request body:
{
"name": "character select",
"config": {
"options": [
{
"id" : 2,
"value": "ellie-renamed"
},
{
"id" : 1,
"value": "joel"
},
{
"value": "tommy"
},
{
"value": "harry"
}
]
}
}
{
"id": 1,
"name": "character select",
"version": 1,
"type": "select",
"config": {
"type": "select",
"options": [
{
"id": "2",
"value": "ellie-renamed"
},
{
"id": "1",
"value": "joel"
},
{
"id": "3",
"value": "tommy"
},
{
"id": "3",
"value": "harry"
}
],
"last_option_id": 3
},
"created_at": "2024-10-30T18:18:10.839Z",
"updated_at": "2024-10-30T18:20:15.122Z"
}
Delete Custom Field
DELETE
https://api.clearfeed.app/v1/rest/custom-fields/:id
Delete a custom field.
Request Parameters
id*
integer
The ID of the custom field to delete
Last updated