Custom Fields

Custom Fields Object

Custom Fields are represented as JSON objects with the following properties

Name
Type
Description

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.

config

object

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

Name
Type
Description

type

literal

Must be exactly: 'select'

options

object array

Array of selection options with the following structure:

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

Name
Type
Description

type

literal

Must be exactly: 'multi_select'

options

object array

Array of selection options with the following structure:

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

Name
Type
Description

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

Name
Type
Description

type

literal

Must be exactly: 'date'

Config Object for Number

Name
Type
Description

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
Type
Description

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

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

Name
Type
Description

id*

integer

The ID of the custom field to update

Request Body

Name
Type
Description

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

Important: Once created, a custom field's type cannot be modified. However, you can:

  • For select and multi_select fields: add, remove, or modify the available options

  • For 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

Name
Type
Description

id*

integer

The ID of the custom field to delete

Last updated