Skip to main content

Custom Fields

To create, edit, list and delete custom fields, a valid access token is required.

Stefan Schindler avatar
Written by Stefan Schindler
Updated over a week ago

Please refer to the help article "API: authentication" for information on how to create this token.

Custom Fields can have 2 different types: TEXT, which allows any value, and SELECT, which only allows specific values.

Create

POST <cambuildr-url>/api/v1/custom_fields

To create a custom field with the TEXT type, the body has to be:

{ 
"name":"cf-name",
"type":"TEXT"
}

To create a custom field with the SELECT type, the body has to be:

{ 
"name":"cf-name",
"type":"SELECT",
"allowed_values": ["value1", "value2", "value3"]
}

where allowed_values holds all values that can be set for this custom field.

Edit

PUT <cambuildr-url>/api/v1/custom_fields/{id}

{
"name":"...",
"type":"...",
"allowed_values": ["..."]
}

It is possible to change the field type for a custom field:

  • Changing from SELECT to TEXT will just keep the value of already set custom fields, as it is free text now

  • Changing from TEXT to SELECT will use a laissez-faire logic: Already set values keep set on the custom fields, but they are not set-able or query-able anymore

Delete

DELETE <cambuildr-url>/api/v1/custom_fields/{id}

If the custom field is still used in the condition of any target audience, the removal is not possible.

List

GET <cambuildr-url>/api/v1/custom_fields

It is possible to paginate using the page_nr and page_size params.

Did this answer your question?