> ## Documentation Index
> Fetch the complete documentation index at: https://www.text.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update form

> Creates or updates a form and returns the resulting configuration.

When you provide `fields`, the method replaces the form's configured fields with the provided array. For survey forms, omit `fields` to keep the configured fields unchanged. Custom forms require at least one field.

**Required scopes:** <Tooltip tip="Required for the `prechat` and `postchat` survey forms.">`surveys_manage`</Tooltip> or <Tooltip tip="Required for custom forms.">`forms_manage`</Tooltip>


## OpenAPI

````yaml /api/configuration/v3.7/openapi.json post /action/update_form
openapi: 3.1.0
info:
  title: Configuration API
  version: v3.7
servers:
  - url: https://api.livechatinc.com/v3.7/configuration
security:
  - PersonalAccessToken: []
  - OAuth2BearerToken: []
paths:
  /action/update_form:
    post:
      tags:
        - Forms
      summary: Update form
      description: >-
        Creates or updates a form and returns the resulting configuration.


        When you provide `fields`, the method replaces the form's configured
        fields with the provided array. For survey forms, omit `fields` to keep
        the configured fields unchanged. Custom forms require at least one
        field.
      operationId: update-form
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFormRequest'
            example:
              type: prechat
              group_id: 0
              enabled: true
              fields:
                - type: question
                  label: What is your name?
                  required: true
                - type: checkbox
                  label: Pick topics
                  required: false
                  answers:
                    - label: Billing
                      checked: true
                    - label: Support
                      checked: false
      responses:
        '200':
          description: The updated form.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FormResponse'
              example:
                form:
                  id: '1'
                  type: prechat
                  enabled: true
                  fields:
                    - id: 153925275950libraryquestion
                      type: question
                      label: What is your name?
                      required: true
                    - id: 153925275950librarytopics
                      type: checkbox
                      label: Pick topics
                      required: false
                      answers:
                        - label: Billing
                          checked: true
                        - label: Support
                          checked: false
components:
  schemas:
    UpdateFormRequest:
      type: object
      required:
        - type
      properties:
        type:
          $ref: '#/components/schemas/FormType'
        group_id:
          type: integer
          default: 0
          description: The ID of the group that owns the form.
        enabled:
          type: boolean
          description: >-
            If set to `true`, enables the survey form. If set to `false`,
            disables it. Applies only to survey forms and is ignored for custom
            forms.
        fields:
          type: array
          maxItems: 20
          items:
            $ref: '#/components/schemas/FormField'
          description: >-
            The form fields in display order. For survey forms, omitting this
            field preserves the configured fields. For custom forms, this field
            is required and must contain at least one item.
    FormResponse:
      type: object
      required:
        - form
      properties:
        form:
          $ref: '#/components/schemas/Form'
    FormType:
      type: string
      enum:
        - prechat
        - postchat
        - offline
        - queued
        - email
        - ask_for_email
        - ask_for_email_mm
      description: >-
        The form type:

        - `prechat` and `postchat` — Survey forms.

        - `offline`, `queued`, `email`, `ask_for_email`, and `ask_for_email_mm`
        — Custom forms.
    FormField:
      type: object
      required:
        - type
        - label
        - required
      properties:
        id:
          type: string
          description: >-
            The field ID. The server assigns this value and ignores it in update
            requests.
        type:
          type: string
          enum:
            - header
            - name
            - email
            - email_with_confirmation
            - question
            - radio
            - select
            - checkbox
            - group
            - textarea
            - rating
            - subject
          description: >-
            The field type. Each form type supports these field types:

            - `prechat` — `header`, `name`, `email`, `email_with_confirmation`,
            `question`, `radio`, `select`, `checkbox`, and `group`.

            - `postchat` — `header`, `question`, `radio`, `select`, `checkbox`,
            `textarea`, and `rating`.

            - `offline`, `ask_for_email`, and `ask_for_email_mm` — `header`,
            `name`, `question`, `email`, `radio`, `select`, `checkbox`,
            `textarea`, and `subject`.

            - `queued` — `header`.

            - `email` — `email`.


            A survey form can contain at most one `group` field and one
            `email_with_confirmation` field. An `ask_for_email` form must
            contain an `email` field.
        label:
          type: string
          description: >-
            The field label. Required when `fields` is provided. Cannot contain
            tab characters.
        required:
          type: boolean
          description: >-
            If `true`, the field requires a value. Required when `fields` is
            provided.
        answers:
          type: array
          maxItems: 350
          items:
            $ref: '#/components/schemas/FormAnswer'
          description: >-
            Answers available for the field. Required for `radio`, `select`,
            `checkbox`, and `group` fields.
        comment_label:
          type: string
          description: >-
            The comment label. Required for `rating` fields. Applies only to
            survey forms.
        confirmation_text:
          type: string
          description: >-
            The confirmation text. Required for `email_with_confirmation`
            fields. Applies only to survey forms.
        confirmation_checked:
          type: boolean
          description: >-
            If `true`, the confirmation is selected by default. Applies only to
            `email_with_confirmation` fields in survey forms.
    Form:
      type: object
      required:
        - id
        - type
        - fields
      properties:
        id:
          type: string
          description: The form ID.
        type:
          $ref: '#/components/schemas/FormType'
        enabled:
          type: boolean
          description: >-
            If `true`, the survey form is enabled. Custom forms do not use this
            field.
        fields:
          type: array
          maxItems: 20
          items:
            $ref: '#/components/schemas/FormField'
          description: The form fields in display order.
    FormAnswer:
      type: object
      required:
        - label
      properties:
        label:
          type: string
          description: >-
            The answer label. Required when `answers` is provided. Cannot
            contain tab characters.
        checked:
          type: boolean
          description: >-
            If `true`, the answer is selected by default. For survey forms, this
            field is required for `radio`, `select`, and `checkbox` fields. Only
            one answer can be selected for `radio` and `select` fields. Custom
            forms ignore this field.
        destination_group:
          type: integer
          description: >-
            The ID of the group to which Text routes the customer when the
            answer is selected. Required for answers in a `group` field. Applies
            only to survey forms and is ignored for custom forms.
  securitySchemes:
    PersonalAccessToken:
      type: http
      scheme: basic
      description: >-
        Use your `account ID` as the username and your personal access token
        (PAT) as the password, or pass a Base64-encoded value directly in the
        Authorization header. For more information, see the <a
        href="/authentication/personal-access-tokens">personal access tokens
        guide</a>.
    OAuth2BearerToken:
      type: http
      scheme: bearer
      description: Authenticate using an OAuth 2.0 Bearer token.
      x-example: us-south1:MQraNrGCsoJvtxD7KNJQB1kM3d5

````