API:CustomField:Update

From docs
Jump to: navigation, search

API » Update Custom Field

Base URL

https://app.callproof.com

Endpoint

/api/custom_field/update/

Purpose

Updates an existing custom field definition in your CallProof company. Use this to change a custom field’s name, type, table/area, default option, display position, points, related field links, or checkout visibility settings.

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 update 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 object Yes Custom field update payload.
custom_field.id integer Yes Unique identifier of the custom field to update. Must belong to your company.
custom_field.name string No Updated custom field name. Maximum 64 characters. If omitted, the current name is kept.
custom_field.cfield_table string No Business area/table name for the custom field (for example, contact). If omitted or invalid, the current value is kept.
custom_field.cfield_type string No Custom field type name (for example, text or select). If omitted or invalid, the current value is kept.
custom_field.cfield_option_default string No Default option name for fields that support options. Applied when a matching option exists.
custom_field.regular_field string No Related regular field name, when applicable.
custom_field.custom_field string No Linked/parent custom field name, when applicable.
custom_field.position integer No Display order position. If another field already uses this position in the same table, positions may be swapped.
custom_field.points integer No Points value assigned to the field.
custom_field.hide_on_checkout integer No Set to 1 to hide the field during checkout; 0 to show it. If omitted, the current setting is kept.

cURL Example

curl -X POST "https://app.callproof.com/api/custom_field/update/" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": {
      "key": "YOUR_API_KEY",
      "secret": "YOUR_API_SECRET"
    },
    "custom_field": {
      "id": 12,
      "name": "Industry",
      "position": 1,
      "hide_on_checkout": 0
    }
  }'

Successful Response (200)

Indicates the custom field definition was updated successfully. The response returns the updated field definition, including its options.

Field Type Description
results object Updated custom field definition.
results.id integer Unique identifier for the custom field.
results.name string Custom field display name.
results.cfield_table string Business area where the custom field is used.
results.cfield_type string Type of custom field.
results.cfield_option_default string Default option name, or empty if none.
results.rfield string Related regular field name, when applicable.
results.cfield string Linked/parent custom field name, when applicable.
results.position integer Display order position.
results.points integer Points value assigned to the field.
results.hide_on_checkout string 1 if hidden during checkout; otherwise 0.
results.options array Selectable options configured for the custom field.
results.options[].id integer Unique identifier for the option.
results.options[].name string Option display name.
results.options[].cfield_id integer Identifier of the custom field that owns the option.
results.options[].cfield string Name of the custom field that owns the option.
results.options[].is_default string 1 if this option is a default option; otherwise 0.
results.options[].position integer Option display order position.
results.options[].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": 12,
    "name": "Industry",
    "cfield_table": "contact",
    "cfield_type": "select",
    "cfield_option_default": "Manufacturing",
    "rfield": "",
    "cfield": "",
    "position": 1,
    "points": 0,
    "hide_on_checkout": "0",
    "options": [
      {
        "id": 101,
        "name": "Manufacturing",
        "cfield_id": 12,
        "cfield": "Industry",
        "is_default": "1",
        "position": 1,
        "points": 0
      }
    ]
  },
  "errors": {},
  "code": 200
}

Notes

  • This endpoint updates a custom field definition, not the custom field values stored on a specific contact.
  • The custom field ID must belong to your company.
  • Only provided fields are updated; omitted fields keep their current values where applicable.
  • Changing position may swap positions with another custom field already using that position in the same table.
  • cfield_option_default is applied only when a matching option name is found.
  • To update custom field values for a contact, use /api/contact/custom_fields/update/.
  • To retrieve current custom field definitions, 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 update 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 '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
}