This endpoint allows you to list custom contact fields in your account.
Listing Fields
A GET returns the list of custom contact fields for your organization, in the order of last created.
- key - the unique key of this field (string), filterable as
key
. - name - the display name of this field (string).
- type - the data type of this field, one of
text
,number
,datetime
,state
,district
orward
.
Example:
GET /api/v2/fields.json
Response containing the fields for your organization:
{
"next": null,
"previous": null,
"results": [
{
"key": "nick_name",
"name": "Nick name",
"type": "text"
},
...
]
}
Adding Fields
A POST can be used to create a new contact field. Don't specify a key as this will be generated for you.
- name - the display name (string)
- type - one of the data type codes (string)
Example:
POST /api/v2/fields.json
{
"name": "Nick name",
"type": "text"
}
You will receive a field object (with the new field key) as a response if successful:
{
"key": "nick_name",
"name": "Nick name",
"type": "text"
}
Updating Fields
A POST can also be used to update an existing field if you include it's key in the URL.
Example:
POST /api/v2/fields.json?key=nick_name
{
"name": "New label",
"type": "text"
}
You will receive the updated field object as a response if successful:
{
"key": "nick_name",
"name": "New label",
"type": "text"
}