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

# Autocomplete

> Suggest businesses matching a partial name, for typeahead UIs.



## OpenAPI

````yaml /api-reference/openapi.json get /autocomplete
openapi: 3.1.0
info:
  title: baselayer-api-service
  version: 0.1.0
servers:
  - url: https://api.baselayer.com/
security: []
paths:
  /autocomplete:
    get:
      tags:
        - Business Autocomplete
      summary: Autocomplete
      description: Suggest businesses matching a partial name, for typeahead UIs.
      operationId: autocomplete_autocomplete_get
      parameters:
        - name: entity_type
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/AutocompleteEntityType'
            description: >-
              The type of entity to suggest. Only `business` is currently
              supported.
          description: >-
            The type of entity to suggest. Only `business` is currently
            supported.
        - name: business.name
          in: query
          required: true
          schema:
            type: string
            minLength: 1
            description: Partial business name to complete.
            examples:
              - apple
              - acme plumb
            title: Business.Name
          description: Partial business name to complete.
        - name: state
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/StateAbbreviation'
              - type: 'null'
            description: Restrict suggestions to businesses registered in this state.
            title: State
          description: Restrict suggestions to businesses registered in this state.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 20
            minimum: 1
            description: Maximum suggestions to return.
            default: 10
            title: Limit
          description: Maximum suggestions to return.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1.AutocompleteResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    AutocompleteEntityType:
      type: string
      enum:
        - business
      title: AutocompleteEntityType
      description: |-
        Entity types the GET /autocomplete route can suggest.

        Only businesses are searchable today; officers, agents, and addresses
        require their own collections before they can join this enum.
    StateAbbreviation:
      enum:
        - AL
        - AK
        - AZ
        - AR
        - CA
        - CO
        - CT
        - DE
        - DC
        - FL
        - GA
        - HI
        - ID
        - IL
        - IN
        - IA
        - KS
        - KY
        - LA
        - ME
        - MD
        - MA
        - MI
        - MN
        - MS
        - MO
        - MT
        - NE
        - NV
        - NH
        - NJ
        - NM
        - NY
        - NC
        - ND
        - OH
        - OK
        - OR
        - PA
        - RI
        - SC
        - SD
        - TN
        - TX
        - UT
        - VT
        - VA
        - WA
        - WV
        - WI
        - WY
        - PR
        - VI
        - AE
        - AA
        - AP
        - GU
        - AS
      title: StateAbbreviation
      type: string
    v1.AutocompleteResponse:
      properties:
        query:
          type: string
          title: Query
          description: The query the suggestions were generated for.
          examples:
            - apple
        suggestions:
          items:
            $ref: '#/components/schemas/v1.AutocompleteSuggestion'
          type: array
          title: Suggestions
          description: Suggestions ordered by relevance, best first.
      type: object
      required:
        - query
      title: AutocompleteResponse (v1)
      description: Response for GET /autocomplete.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    v1.AutocompleteSuggestion:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: >-
            The domicile root registration id of the suggested business family.
            Resolves to an SOSRegistration.
          examples:
            - b3f1c2d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d
        entity_type:
          $ref: '#/components/schemas/AutocompleteEntityType'
          description: The type of entity this suggestion refers to.
          examples:
            - business
        name:
          type: string
          title: Name
          description: The business name closest to the query, in normalized form.
          examples:
            - apple computer inc
        states:
          items:
            type: string
          type: array
          title: States
          description: States where the business holds registrations.
          examples:
            - - CA
              - DE
        registration_count:
          type: integer
          title: Registration Count
          description: Number of registrations in the business's family.
          examples:
            - 12
        score:
          type: number
          title: Score
          description: >-
            Jaro-Winkler similarity between the normalized query and the matched
            name (0.0–1.0).
          examples:
            - 0.96
        highlights:
          items:
            $ref: '#/components/schemas/v1.AutocompleteHighlight'
          type: array
          title: Highlights
          description: Matched fields with highlighted snippets.
      type: object
      required:
        - id
        - entity_type
        - name
        - registration_count
        - score
      title: AutocompleteSuggestion (v1)
      description: A single autocomplete suggestion.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    v1.AutocompleteHighlight:
      properties:
        field:
          type: string
          title: Field
          description: The document field the snippets were matched in.
          examples:
            - normalized_names
        snippets:
          items:
            type: string
          type: array
          title: Snippets
          description: >-
            Matched values with ``<mark>`` tags around the matched tokens, one
            snippet per matched value.
          examples:
            - - <mark>apple</mark> computer inc
      type: object
      required:
        - field
      title: AutocompleteHighlight (v1)
      description: Highlighted match snippets for one matched field of a suggestion.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````