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

# Discover candidate entries for a linked_form field

> Lists candidate entries for a `linked_form` field on a published form, so a filler can
pick a value and obtain the `entry_token` to submit. `field_api_code` must reference a
`linked_form` field among the form's public fields.

Values are rendered exactly as the published form shows them: the searched key field is
returned as plain text, while other key fields (and display fields configured as
privacy-protected) are masked.

Results are paginated by cursor and ordered by the candidate entry's serial number,
descending. `pagination.total` is an upper bound: an in-page match recheck may drop rows,
so a page can contain fewer items than requested even when more pages follow.

For a privacy-protected `linked_form` field, `q` is required and matched exactly.

**Required scope:** `form:respond`.




## OpenAPI

````yaml /api-reference/openapi.yaml get /api/v1/f/{form_token}/associated_entry_options
openapi: 3.0.1
info:
  title: FormHug API V1
  version: v1
  description: |
    FormHug public REST API. All request/response keys are snake_case.

    Successful response:

    ```json
    {
      "data": { ... }
    }
    ```

    Paginated response:

    ```json
    {
      "data": [ ... ],
      "pagination": {
        "total": 123,
        "next_cursor": "NQ=="
      }
    }
    ```

    Error response:

    ```json
    {
      "error": "Human-readable message",
      "error_details": [
        { "attribute": "field_name", "message": "specific error" }
      ]
    }
    ```

    `error_details` only appears for model validation failures.
servers:
  - url: https://formhug.ai
security: []
tags:
  - name: Forms
    description: Form CRUD
  - name: Attachments
    description: >-
      2-step upload for form-element images (theme, rich-text, or field-element
      images). Prepare returns an `upload_id`; consume it in a theme update,
      attachment_commitments, or the form `fields` payload depending on purpose.
  - name: Entries
    description: Entries collected by a form owned by the current user
  - name: Folders
    description: Folder CRUD
  - name: Participated Forms
    description: Forms the current user has submitted to (does not own)
  - name: Published Form Entries
    description: Submit entries to a published form
  - name: Published Forms
    description: Read a published form's public structure for filling
  - name: Linked Form Options
    description: >-
      Discover candidate entries (and their `entry_token`s) for a `linked_form`
      field while filling a published form
  - name: Entry Attachments
    description: >-
      2-step upload for `attachment` field submissions. Prepare returns an
      `upload_id`; submit it under the attachment field in `field_values` when
      creating the entry.
  - name: Me
    description: Current authenticated user
  - name: Webhooks
    description: Webhook integrations attached to a form
  - name: Form Themes
    description: Read and update a form's visual theme
  - name: Form Settings
    description: >-
      Per-form settings — submission flow, availability, access control,
      presentation
  - name: Field Rules
    description: >-
      Read and replace a form's conditional field-display and post-submission
      redirect rules.
  - name: Form Folder
    description: Per-user folder placement for a shared form
  - name: OAuth
    description: OAuth 2.0 PKCE token issuance and revocation
paths:
  /api/v1/f/{form_token}/associated_entry_options:
    parameters:
      - name: form_token
        in: path
        description: Token of a published form
        required: true
        schema:
          type: string
    get:
      tags:
        - Linked Form Options
      summary: Discover candidate entries for a linked_form field
      description: >
        Lists candidate entries for a `linked_form` field on a published form,
        so a filler can

        pick a value and obtain the `entry_token` to submit. `field_api_code`
        must reference a

        `linked_form` field among the form's public fields.


        Values are rendered exactly as the published form shows them: the
        searched key field is

        returned as plain text, while other key fields (and display fields
        configured as

        privacy-protected) are masked.


        Results are paginated by cursor and ordered by the candidate entry's
        serial number,

        descending. `pagination.total` is an upper bound: an in-page match
        recheck may drop rows,

        so a page can contain fewer items than requested even when more pages
        follow.


        For a privacy-protected `linked_form` field, `q` is required and matched
        exactly.


        **Required scope:** `form:respond`.
      parameters:
        - name: field_api_code
          in: query
          required: true
          schema:
            type: string
          description: api_code of the `linked_form` field to look up candidates for.
        - name: q
          in: query
          required: false
          schema:
            type: string
          description: >-
            Search text matched against the key field named by
            `associated_field_api_code`. Required for a privacy-protected field.
        - name: associated_field_api_code
          in: query
          required: false
          schema:
            type: string
          description: >-
            Which key field `q` matches. Must be one of the field's key
            `api_code`s; defaults to the first.
        - name: filters
          in: query
          required: false
          style: deepObject
          explode: true
          schema:
            type: object
            additionalProperties:
              type: string
          description: >-
            Exact-match constraints on other key fields, keyed by `api_code`
            (excluding the `associated_field_api_code` target).
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 20
            maximum: 100
          description: Page size (1..100, default 20)
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          description: >-
            Pagination cursor returned in the previous response as
            pagination.next_cursor
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - pagination
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/AssociatedEntryOption'
                  pagination:
                    $ref: '#/components/schemas/Pagination'
        '401':
          description: Missing or invalid credentials
          content:
            application/json:
              examples:
                unauthenticated:
                  value:
                    error: Invalid token
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Password-protected form, password not supplied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorEnvelope'
        '404':
          description: Form not found
          content:
            application/json:
              examples:
                not_found:
                  value:
                    error: Form not found
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: field_api_code does not reference a linked_form field
          content:
            application/json:
              examples:
                not_linked_form:
                  value:
                    error: >-
                      `field_api_code` must reference a `linked_form` field on
                      this form
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - PersonalAccessToken:
            - form:respond
components:
  schemas:
    AssociatedEntryOption:
      type: object
      required:
        - entry_token
        - serial_number
        - associated_fields
        - display_fields
      description: >-
        A candidate entry for a `linked_form` field. Submit `entry_token` as the
        field value to link this entry.
      properties:
        entry_token:
          type: string
          description: >-
            Token of the candidate entry; submit this as the `linked_form` field
            value.
          example: aB2cD9eF
        serial_number:
          type: integer
          description: Serial number of the candidate entry.
          example: 12
        associated_fields:
          type: object
          additionalProperties:
            type: string
          description: >-
            Rendered key-field values keyed by `api_code`. The searched key
            field renders as plain text; other key fields are masked when the
            field is privacy-protected.
          example:
            field_1: Sales
            field_2: A***e
        display_fields:
          type: object
          additionalProperties: true
          description: >-
            Rendered display-field values keyed by `api_code`, formatted as
            shown on the published form (masked where configured).
          example:
            field_5: 138****5678
    Pagination:
      type: object
      required:
        - total
        - next_cursor
      properties:
        total:
          type: integer
          description: Total number of records
          example: 123
        next_cursor:
          type: string
          nullable: true
          description: Opaque cursor for the next page; null when there are no more records
          example: NQ==
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message
    ValidationErrorEnvelope:
      type: object
      required:
        - error
        - error_details
      description: >-
        Returned on model validation failures. error_details lists per-field
        errors.
      properties:
        error:
          type: string
          example: Name can't be blank
        error_details:
          type: array
          items:
            type: object
            required:
              - attribute
              - message
            properties:
              attribute:
                type: string
                example: name
              message:
                type: string
                example: can't be blank
  securitySchemes:
    PersonalAccessToken:
      type: http
      scheme: bearer
      bearerFormat: PAT
      description: >
        Personal Access Token prefixed with `fh_`. Sent as `Authorization:
        Bearer fh_xxx`.

        The scope required by each endpoint is listed in that endpoint's
        description.

````