Skip to content

Create a custom field

Request to create new custom field:

POST /api/v2/custom_fields.json

Note

This API endpoint is used to administer custom fields configuration. To assign values to custom fields on call resource, use the PUT /api/v2/calls.json API endpoint.

HTTP body should contain JSON formatted profile of custom field to create.

For example:

{
    "custom_field": {
      "enable": true,
      "tenant_id": "9079d60a-5192-11ee-aa89-0015172d2a7d",
      "name": "Call type",
      "is_global": false,
      "description": "Type of the call, like "Sales, Collection, etc.",
      "type": "option",
      "display_as": "default",
      "str_max_len": 64,
      "editable": true,
      "search_options": [
        "advanced"
      ],
      "options": [
        "Collection call",
        "Sales call"
      ],
      "ai_assist": false
    }
}

Response contains HTTP status code as shown in the following list.

201 Created

Custom field has been successfully created. HTTP header Location contains URL by which the newly created object should be know.

For example:

HTTP/1.1 201 Created 
Location: /api/v2/custom_fields/e011c408-f288-11e4-9b73-e03f497dbdff.json
403 Forbidden

The request cannot be completed because API user has no permission to create custom fields

400 Bad Request

The request cannot be completed because supplied JSON object has invalid data.

When response has content type application/json, then it contains more detailed description of error in JSON format like:

{
    "error": "InvalidRecord",
    "description": "Record Validation errors",
    "details": {
        "name": "Such name exists already"
    }
}