Forms

Update a field of a form

PATCH/forms/{form_id}/fields/{id}

Changes the keys you send, keeps everything else (page, order, validator, preset, conditions) and returns the field. Null clears a key. conditions replaces the list; empty removes it. A type change must be compatible: see compatible-types. A bad validator or type returns 422; a compliance-protected field returns 409 conflict. required is read-only. Published forms can be changed too. dry_run previews it. Emits form_field.updated when something changes; no email. Sending the old values undoes it.

Path parameters

  • form_idstring (uuid)Required#

    The form's id, a uuid. An unknown id, or a hidden form, returns 404.

  • idstring (uuid)Required#

    The field's id, a uuid. A field of another form returns 404.

Query parameters

  • dry_runboolean#

    Validate and run the call without committing it, returning what the real call would return with meta.dry_run set.

Request body

application/json, required · FormFieldUpdate

  • typestring#

    The new field type. It must be compatible with the current type; see the compatible-types read.

  • labelstring | null#

    The question shown to the person filling in the form.

  • namestring | null#

    The field's short name.

  • descriptionstring | null#

    Help text shown under the question.

  • referencestring | null#

    A key that stays stable across edits, unique within the form.

  • validatorstring | null#

    Validation rules separated by a pipe, such as required|string.

  • placeholderstring | null#

    Placeholder text.

  • pre_population_keystring | null#

    The profile value that pre-fills this field.

  • backfillboolean | null#

    Whether the answer is written back to the profile.

  • orderinteger | null#

    The field's position within the form.

  • page_idstring | null#

    A page of this form to place the field on. Null removes it from its page.

  • option_preset_idstring | null#

    A live option preset a dropdown field takes its options from. Null unlinks it.

  • optionsarray | object | null#

    The options of a dropdown or similar field. A list for most types; an object for a DOCUSIGN field.

  • condition_logicstring | null#

    Whether all conditions (AND) or any one (OR) must hold.

    One of: AND, OR
  • conditionsarray | null#

    Display conditions. Send an empty list to remove them; leave the key out to keep them.

{
  "label": "Spouse full name",
  "conditions": [
    {
      "against_field_reference": "marital_status",
      "operator": "one_of",
      "value": [
        "married",
        "widowed"
      ]
    }
  ]
}

Responses

200

The updated field.

FormField
{
  "data": {
    "id": "9a9d1c5e-4f2b-4c8e-9a7d-2f1e6b3c4d5a",
    "label": "string",
    "name": "string",
    "description": "string",
    "type": "string",
    "reference": "string",
    "validator": "string",
    "placeholder": "string",
    "pre_population_key": "string",
    "backfill": true,
    "order": 1,
    "page_id": "9a9d1c5e-4f2b-4c8e-9a7d-2f1e6b3c4d5a",
    "option_preset_id": "9a9d1c5e-4f2b-4c8e-9a7d-2f1e6b3c4d5a",
    "options": [
      null
    ],
    "required": true,
    "conditions": [
      {
        "against_field_id": "9a9d1c5e-4f2b-4c8e-9a7d-2f1e6b3c4d5a",
        "against_field_reference": "string",
        "operator": "string",
        "value": "string"
      }
    ],
    "condition_logic": "AND"
  }
}
401

Authentication failed. error.code is one of invalid_token, expired, revoked.

Error
403

Authorization failed. error.code is one of org_disabled, ip_blocked, missing_scope, scope_disabled, user_disabled.

Error
404

Resource not found (error.code = not_found).

Error
409

The request conflicts with existing state (error.code = conflict), e.g. a compliance flow with the requested name already exists.

Error
422

The request can't be processed (HTTP 422): validation_failed with one ErrorDetail per problem, or a code documented on the operation.

Error
429

Rate limit exceeded (error.code = rate_limited).

Error

Examples

curl -X PATCH https://your-org-domain/kong/core/api/v2/forms/{form_id}/fields/{id}\
  -H "Authorization: Bearer $HELM_API_KEY"\
  -H "Content-Type: application/json"\
  -d '{
  "label": "Spouse full name",
  "conditions": [
    {
      "against_field_reference": "marital_status",
      "operator": "one_of",
      "value": [
        "married",
        "widowed"
      ]
    }
  ]
}'