openapi: 3.0.0
info:
  title: Google Local Services API
  description: |
    The Google Local Services API returns the service providers Google lists in its Local Services ads
    for a service and a place, such as plumbers in Austin or electricians in London. Each search returns
    up to 20 businesses, in the order Google shows them, as the `local_ads` array: name, rating, review
    count and star breakdown, business type, service area, years in business, phone number, highlights,
    opening hours, and links to the business's Local Services profile, booking and messaging pages.

    **Cross-linking**: The Google Local API returns businesses from the local pack of Google Search, and the
    Google Maps API returns businesses from Google Maps, for the same kind of query.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Google Local Services Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Search engine identifier
          schema:
            type: string
            enum: ["google_local_services"]
            default: "google_local_services"
        - name: q
          in: query
          required: true
          description: 'The service to find providers for (e.g., "plumber", "electrician", "house cleaning"). Without location or uule, a city in the United States can be named in the query (e.g., "plumber austin tx"). A US postal code named in the query places some searches and returns the no results error for others, so give it with location. A place outside the United States named in the query returns the no results error.'
          schema:
            type: string
            maxLength: 800
        - name: location
          in: query
          required: false
          description: 'Place to find service providers in (e.g., "Austin,Texas,United States", "London,England,United Kingdom"). Takes precedence over uule when both are set. Without location, uule or a place in the United States named in q, the search returns the no results error.'
          schema:
            type: string
        - name: uule
          in: query
          required: false
          description: Google's encoded location for the search, used when location is not set
          schema:
            type: string
            maxLength: 512
        - name: hl
          in: query
          required: false
          description: 'Interface language of the search, which sets the language of business types, highlights, hours and the day names in open_hours. Google Local Services lists businesses only when hl is the language it uses in the searched market (e.g., "en" in the United States, "de" in Germany, "fr" in France), and returns the no results error with any other hl.'
          schema:
            type: string
            enum: ["af", "ak", "sq", "am", "ar", "hy", "az", "eu", "be", "bem", "bn", "bh", "xx-bork", "bs", "br", "bg", "km", "ca", "chr", "ny", "zh-cn", "zh-tw", "co", "hr", "cs", "da", "nl", "xx-elmer", "en", "eo", "et", "ee", "fo", "tl", "fi", "fr", "fy", "gaa", "gl", "ka", "de", "el", "kl", "gn", "gu", "xx-hacker", "ht", "ha", "haw", "iw", "hi", "hu", "is", "ig", "id", "ia", "ga", "it", "ja", "jw", "kn", "kk", "rw", "rn", "xx-klingon", "kg", "ko", "kri", "ku", "ckb", "ky", "lo", "la", "lv", "ln", "lt", "loz", "lg", "ach", "mk", "mg", "my", "ms", "ml", "mt", "mv", "mi", "mr", "mfe", "mo", "mn", "sr-me", "ne", "pcm", "nso", "no", "nn", "oc", "or", "om", "ps", "fa", "xx-pirate", "pl", "pt", "pt-br", "pt-pt", "pa", "qu", "ro", "rm", "nyn", "ru", "gd", "sr", "sh", "st", "tn", "crs", "sn", "sd", "si", "sk", "sl", "so", "es", "es-419", "su", "sw", "sv", "tg", "ta", "tt", "te", "th", "ti", "to", "lua", "tum", "tr", "tk", "tw", "ug", "uk", "ur", "uz", "vu", "vi", "cy", "wo", "xh", "yi", "yo", "zu"]
            default: "en"
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400':
          description: Validation Error. There is an issue with query parameters, such as missing required parameters or invalid values.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication Error. The API key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate Limit Exceeded. The number of allowed requests has been exceeded. Consider upgrading your plan or waiting for the limit to reset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server Error. Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Timeout. We could not retrieve results in 90 seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Use Bearer authentication. Format: "Bearer YOUR_API_KEY"'
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: Pass API key as query parameter
  schemas:
    SearchResponse:
      type: object
      properties:
        search_metadata:
          $ref: '#/components/schemas/SearchMetadata'
        search_parameters:
          $ref: '#/components/schemas/SearchParameters'
        local_ads:
          type: array
          description: Service providers listed in the Local Services ads, in the order Google shows them
          items:
            $ref: '#/components/schemas/LocalAd'
        error:
          type: string
          description: Message returned in a successful, billed response when Google Local Services lists no businesses for the service and place
    LocalAd:
      type: object
      required: [position, title, cid, bid]
      properties:
        position:
          type: integer
          description: Position of the business in Google's list, counting any business left out of local_ads
        title:
          type: string
          description: Name of the business
        link:
          type: string
          description: URL of the business's Google Local Services profile
        cid:
          type: string
          description: Google's cid identifier of the business, used together with bid and pid
        bid:
          type: string
          description: Google's bid identifier of the business, used together with cid and pid
        pid:
          type: string
          description: Google's pid identifier of the business, used together with cid and bid
        rating:
          type: number
          description: Average star rating, from 1 to 5
        reviews:
          type: integer
          description: Number of reviews
        reviews_histogram:
          type: object
          description: Number of reviews for each star rating, keyed from "1" to "5"
          properties:
            '1':
              type: integer
              description: Number of 1-star reviews
            '2':
              type: integer
              description: Number of 2-star reviews
            '3':
              type: integer
              description: Number of 3-star reviews
            '4':
              type: integer
              description: Number of 4-star reviews
            '5':
              type: integer
              description: Number of 5-star reviews
        type:
          type: string
          description: Type of service the business provides
        service_area:
          type: string
          description: Area Google shows the listing for in this search
        years_in_business:
          type: integer
          description: Number of years the business has been operating
        phone:
          type: string
          description: Phone number of the business in international format
        highlights:
          type: array
          description: Short highlights Google shows for the business
          items:
            type: string
        open_state:
          type: string
          description: Open or closed label at the time of the search, as Google shows it in the hl language
        hours:
          type: string
          description: Opening hours summary as Google shows it
        open_hours:
          type: object
          description: Opening hours for each day of the week, keyed by the day name in the hl language
          additionalProperties:
            type: string
        booking_link:
          type: string
          description: URL of the page to book the business through Google
        message_link:
          type: string
          description: URL of the page to message the business through Google
        thumbnail:
          type: string
          description: URL of the business's photo
    SearchMetadata:
      type: object
      required: [status, created_at]
      properties:
        id:
          type: string
          description: Unique identifier for the search request
        status:
          type: string
          description: Status of the search request
        created_at:
          type: string
          format: date-time
          description: Timestamp when the search was created
        request_time_taken:
          type: number
          description: Time taken to make the request in seconds
        parsing_time_taken:
          type: number
          description: Time taken to parse the results in seconds
        total_time_taken:
          type: number
          description: Total time taken for the search in seconds
        request_url:
          type: string
          description: Google Local Services URL for this search
        html_url:
          type: string
          description: URL to view HTML results
        json_url:
          type: string
          description: URL to view JSON results
    SearchParameters:
      type: object
      properties:
        engine:
          type: string
          description: Search engine identifier
        q:
          type: string
          description: The service searched for
        location:
          type: string
          description: The location requested
        location_used:
          type: string
          description: Canonical name of the location used for the search
        uule:
          type: string
          description: Google's encoded location used for the search
        hl:
          type: string
          description: Interface language of the search
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
