External API
Create a custom field
Create a People field in your teamspace from your own system.
Creates a custom field for customers from your own system – for example, a Plan field to hold the plan they’re on in your billing system. The API creates People fields only. Create Conversation fields in Proto. Not sure how to send a request? See Make your first request.
Request
Send a POST request to:
https://v3-api.proto.cx/api/platform/v1/custom-fields/YOUR_TEAMSPACE_ID/create-custom-field
In the body, send the field’s type and name. In the address, replace anything starting with YOUR_ with your own.
There are six types. Dropdown and Single select fields also need their options:
type | Shown in Proto as | Also send |
|---|---|---|
text | Text | – |
number | Number | – |
boolean | Toggle switch | – |
datetime | Date | – |
select | Dropdown | select_options |
single_select | Single select | single_select_options |
A Text field – the same for Number, Toggle switch and Date, with their own type:
{
"type": "text",
"name": "Account manager",
"description": "Who looks after them",
"default_value": "Sam Tan"
}
A Dropdown field:
{
"type": "select",
"name": "Plan",
"description": "The plan they pay for",
"select_options": ["Free", "Pro", "Enterprise"],
"default_value": "Free"
}
A Single select field, with its options in groups. Set every id to "new":
{
"type": "single_select",
"name": "Interest",
"description": "What they want to hear about",
"single_select_options": [
{
"id": "new",
"name": "Products",
"options": [
{ "id": "new", "name": "Loans" },
{ "id": "new", "name": "Savings", "description": "Savings accounts" }
]
}
]
}
| Field | Required | What it is |
|---|---|---|
type | Yes | One of the six types in the table above |
name | Yes | The field’s name – at least 2 characters. No other custom field in your teamspace can have it, including Conversation fields. |
description | No | What the field is for |
select_options | For select | The options, with no blanks or repeats. Leave it out for other types. |
single_select_options | For single_select | Groups of options. Leave it out for other types. |
default_value | No | The value customers get when none is set. It must suit the type, and be one of the options for select. You can’t set one for single_select. |
Each item in single_select_options has:
| Field | Required | What it is |
|---|---|---|
id | Yes | Always "new" |
name | Yes | The group’s name – up to 255 characters. No two groups can have the same name. |
options | Yes | The options in the group – at least one |
Each item in options has:
| Field | Required | What it is |
|---|---|---|
id | Yes | Always "new" |
name | Yes | The option’s name – up to 255 characters. No two options in a group can have the same name. |
description | No | What the option means – up to 500 characters |
Response
Proto replies 200 OK with the new field. Keep its id.
{
"id": "01J0ABCDEF1234567890ABCDEF",
"entity": "customer",
"type": "select",
"name": "Plan",
"description": "The plan they pay for",
"select_options": ["Free", "Pro", "Enterprise"],
"single_select_options": null,
"default_value": "Free"
}
entity is always customer – the field is a People field. For a Single select field, each group gets an id starting cfg_ and each option an id starting cfo_. Send the option’s ID as the field’s value.
Errors
| You get | What it means |
|---|---|
400 | A field with this name already exists, or the options or default value don’t suit the type. The message says which, and data.field names the field. |
422 | type isn’t one of the six, name is too short or an option’s id isn’t "new". |
For errors any request can return, see If something goes wrong.