API:CustomFieldOption:Create

From docs
Jump to: navigation, search

API » Create Custom Field Option

Base URL

https://app.callproof.com

Endpoint

/api/custom_field/option/new/

Purpose

Creates a new selectable option for an existing custom field in your CallProof company. Use this to add choice values for custom fields that use option-based selections, including the option name, display order, and points value.

HTTP Method

POST

Headers

Header Required Description
Content-Type Yes Must be application/json.

Security

  • Yes – Requires a valid API key and secret with permission to create custom fields. Credentials are sent in the request body.

Parameters

Path Parameters

None.

Query Parameters

None.

Request Body

Parameter Type Required Description
api_key object Yes Authentication credentials object.
api_key.key string Yes Public API key assigned to your CallProof account.
api_key.secret string Yes Private API secret paired with the API key.
custom_field_option object Yes Custom field option creation payload.
custom_field_option.custom_field_id integer Yes Unique identifier of the parent custom field that will own the option. Must belong to your company.
custom_field_option.name string No Option display name. Maximum 64 characters. If omitted, an empty name may be stored.
custom_field_option.position integer No Display order position for the option.
custom_field_option.points integer No Points value assigned to the option.

cURL Example

curl -X POST "https://app.callproof.com/api/custom_field/option/new/" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": {
      "key": "YOUR_API_KEY",
      "secret": "YOUR_API_SECRET"
    },
    "custom_field_option": {
      "custom_field_id": 12,
      "name": "Manufacturing",
      "position": 1,
      "points": 0
    }
  }'

Successful Response (200)

Indicates the custom field option was created successfully. The response returns the new option details.

Field Type Description
results object Newly created custom field option details.
results.id integer Unique identifier for the option.
results.name string Option display name.
results.cfield_id integer Identifier of the custom field that owns the option.
results.cfield string Name of the custom field that owns the option.
results.is_default string 1 if this option is a default option; otherwise 0.
results.position integer Option display order position.
results.points integer Points value assigned to the option.
errors object Empty object when the request succeeds.
code integer HTTP-style status value; 200 on success.

Example response:

{
  "results": {
    "id": 101,
    "name": "Manufacturing",
    "cfield_id": 12,
    "cfield": "Industry",
    "is_default": "0",
    "position": 1,
    "points": 0
  },
  "errors": {},
  "code": 200
}

Notes

  • The parent custom field must exist and belong to your company.
  • This endpoint creates an option for a custom field definition; it does not set a custom field value on a contact.
  • If name is omitted, an empty option name may be stored.
  • position and points are optional.
  • Newly created options are typically not marked as the default unless the parent field is later configured that way.
  • To update an existing option, use /api/custom_field/option/update/.
  • To retrieve custom fields and their options, use /api/custom_fields/get/.

Error Responses

Status Code Meaning
400 Bad Request – The custom field ID is missing, invalid, or does not match a custom field in your company.
401 Unauthorized – The API key and/or secret is missing, invalid, inactive, associated with a disabled account, or lacks permission to create custom fields.
405 Method Not Allowed – A method other than POST was used.
500 Internal Server Error – An unexpected server problem occurred. Not specified in Swagger.

400 response body example:

{
  "results": [],
  "errors": ["Invalid 'custom_field_id' field"],
  "code": 400
}

401 response body example:

{
  "results": [],
  "errors": ["Invalid API Key"],
  "code": 401
}

405 response body example:

{
  "results": [],
  "errors": ["Method not allowed"],
  "code": 405
}