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

# Add a form field

> Adds a question to a form (on its first page). SINGLE_OPTION / MULTIPLE_OPTION fields require a non-empty `values` list of allowed options. Returns the updated field list.



## OpenAPI

````yaml /openapi.v2.json post /forms/{id}/fields
openapi: 3.1.1
info:
  title: Heffl API v2 (Beta)
  version: 2.0.0
  description: >-
    Heffl REST API v2 (beta) — resource-oriented endpoints with consistent
    response envelopes. Endpoints, schemas, and behavior may change until GA.
    See Agent workflows and ID prefixes guides for automation.
  contact:
    name: Heffl Support
    url: https://heffl.com/support
    email: support@heffl.com
servers:
  - url: https://api.heffl.com/api/v2
    description: Production API Server
security:
  - ApiKeyAuth: []
paths:
  /forms/{id}/fields:
    post:
      tags:
        - Objects
      summary: Add a form field
      description: >-
        Adds a question to a form (on its first page). SINGLE_OPTION /
        MULTIPLE_OPTION fields require a non-empty `values` list of allowed
        options. Returns the updated field list.
      operationId: objects.forms.addField
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Form ID (frm_ prefix)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FormFieldInput'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FormFields'
        '400':
          description: Validation error or bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
        '403':
          description: Insufficient permission
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ApiError'
components:
  schemas:
    FormFieldInput:
      type: object
      properties:
        label:
          type: string
          description: Question label shown to respondents
        dataType:
          type: string
          enum:
            - TEXT
            - LONG_TEXT
            - EMAIL
            - MOBILE
            - NUMBER
            - DATE
            - SINGLE_OPTION
            - MULTIPLE_OPTION
            - FILE_PICKER
            - SIGNATURE
            - CURRENCY
            - LINK
            - RATING
            - OPINION_SCALE
          description: Field data type. SINGLE_OPTION / MULTIPLE_OPTION require `values`.
        description:
          type:
            - string
            - 'null'
          description: Optional help text under the question
        required:
          type: boolean
          description: Whether an answer is required. Defaults to false.
        placeholder:
          type:
            - string
            - 'null'
          description: Optional input placeholder
        values:
          type: array
          items:
            type: string
          description: >-
            Allowed options. Required (non-empty) for SINGLE_OPTION and
            MULTIPLE_OPTION fields.
        settings:
          type: object
          additionalProperties: true
          description: 'Extra config for RATING / OPINION_SCALE fields (e.g. { max: 5 }).'
      required:
        - label
        - dataType
    FormFields:
      type: object
      properties:
        formId:
          type: string
          description: Form ID (frm_ prefix)
        formTitle:
          type: string
          description: Form title
        fields:
          type: array
          items:
            $ref: '#/components/schemas/FormField'
          description: Ordered list of fields on the form
      required:
        - formId
        - formTitle
        - fields
    V2ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: object
    FormField:
      type: object
      properties:
        key:
          type: string
          description: >-
            Stable field identifier. Use this as the key inside a submission
            `data` object when answering, and as the `key` when updating or
            deleting the field (e.g. cf_full_name).
        label:
          type: string
          description: Question label shown to respondents
        dataType:
          type: string
          description: >-
            Field data type, e.g. TEXT, LONG_TEXT, EMAIL, MOBILE, NUMBER, DATE,
            SINGLE_OPTION, MULTIPLE_OPTION, FILE_PICKER, SIGNATURE, CURRENCY,
            LINK, RATING, OPINION_SCALE.
        required:
          type: boolean
          description: Whether an answer is required for this field
        type:
          type: string
          description: >-
            Item kind: 'custom' for answerable questions, 'system' for built-in
            fields.
        options:
          type: array
          items:
            $ref: '#/components/schemas/FormFieldOption'
          description: >-
            Allowed options. Populated for SINGLE_OPTION / MULTIPLE_OPTION
            fields; empty otherwise.
        multiple:
          type: boolean
          description: Whether multiple options can be selected (true for MULTIPLE_OPTION).
      required:
        - key
        - label
        - dataType
        - required
        - type
        - options
        - multiple
    FormFieldOption:
      type: object
      properties:
        label:
          type: string
          description: Display label for the option
        value:
          type: string
          description: Value submitted when chosen
      required:
        - label
        - value
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Get yours at
        app.heffl.com/settings/developers

````