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

# Get address suggestions

> Returns address autocomplete suggestions for a partial address query, for use when entering trip start and end addresses. Pass the selected suggestion's `place_id` to the address details endpoint and to trip create/update.

Use this endpoint to power address autocomplete when entering a trip's start and end addresses.

Generate an opaque `session_token` (for example a UUID) when the user begins typing in an address field, reuse it for every suggestion request in that session and the final [address details](/api-reference/v1/get-address-details) request, then discard it. Requests sharing a token are grouped into a single billed session.

Pass the selected suggestion's `place_id` to the address details endpoint to fetch the formatted address and coordinates, and to [create trip](/api-reference/v1/create-trip) or [update trip](/api-reference/v1/update-trip) as `google_start_place_id` / `google_end_place_id` to have the trip's distance computed automatically.


## OpenAPI

````yaml get /v1/businesses/{businessId}/mileage/address-suggestions
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/mileage/address-suggestions:
    get:
      tags: []
      summary: Get address suggestions
      description: >-
        Returns address autocomplete suggestions for a partial address query,
        for use when entering trip start and end addresses. Pass the selected
        suggestion's `place_id` to the address details endpoint and to trip
        create/update.
      operationId: business.mileage.addressSuggestions.get
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business.
          required: true
          schema:
            type: string
            format: uuid
        - name: query
          in: query
          description: The partial address text to get suggestions for.
          required: true
          schema:
            type: string
        - name: session_token
          in: query
          description: >-
            An opaque session token generated by the client (e.g. a UUID). Use
            the same token for all autocomplete requests in one address-entry
            session and the final address details request, then discard it.
            Groups the requests into a single billed session.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Address suggestions retrieved successfully.
          headers: {}
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/ApiPlaceSuggestion'
                required:
                  - data
components:
  schemas:
    ApiPlaceSuggestion:
      type: object
      properties:
        place_id:
          type: string
          description: >-
            The Google Maps place ID of the suggested address. Pass this to the
            address details endpoint, or to trip create/update as
            `google_start_place_id` / `google_end_place_id`.
        description:
          type: string
          description: The human-readable address suggestion to display.
      required:
        - place_id
        - description
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````