openapi: 3.0.0
info:
  title: Google Place Products API
  description: |
    The Google Place Products API returns the product catalog a business shows on its Google Business Profile:
    the place's name, address and phone number, and every product with its title, description, category,
    price or price range, image and links. The whole catalog is returned in one response.

    **Cross-linking**: The `place_id`, `data_id` and `ludocid` fields returned by the Google Maps, Google Maps Place
    and Google Local APIs can be used with this API to fetch a place's products. Pass one of them as the parameter
    of the same name.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Google Place Products
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Must be set to google_place_products
          schema:
            type: string
            enum: ["google_place_products"]
        - name: place_id
          in: query
          required: false
          description: Google Maps place ID starting with ChIJ. Provide one of place_id, data_id or ludocid; when more than one is given, they must point to the same place
          schema:
            type: string
            pattern: "^ChIJ[A-Za-z0-9_-]{23}$"
        - name: data_id
          in: query
          required: false
          description: Google Maps data ID of the place. Provide one of place_id, data_id or ludocid; when more than one is given, they must point to the same place
          schema:
            type: string
            pattern: "^0x[0-9a-fA-F]{1,16}:0x[0-9a-fA-F]{1,16}$"
        - name: ludocid
          in: query
          required: false
          description: Google customer ID (CID) of the place, in decimal form. Provide one of place_id, data_id or ludocid; when more than one is given, they must point to the same place
          schema:
            type: string
            pattern: "^[0-9]{1,20}$"
        - name: hl
          in: query
          required: false
          description: Language of the catalog page, which also sets how prices are formatted
          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"
      x-required-one-of:
        - ["place_id", "data_id", "ludocid"]
      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'
        place_result:
          $ref: '#/components/schemas/PlaceResult'
        products:
          type: array
          description: Products of the catalog, in the order the profile shows them
          items:
            $ref: '#/components/schemas/Product'
        error:
          type: string
          description: Error message explaining why no products were returned
    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 URL of the place's product catalog
        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: Engine used for the search
        place_id:
          type: string
          description: Place ID used for the search
        data_id:
          type: string
          description: Data ID used for the search
        ludocid:
          type: string
          description: Google customer ID (CID) of the place the catalog belongs to
        hl:
          type: string
          description: Language of the catalog page
    PlaceResult:
      type: object
      required: [ludocid, title]
      properties:
        ludocid:
          type: string
          description: Google customer ID (CID) of the place, in decimal form
        title:
          type: string
          description: Name of the business
        address:
          type: string
          description: Address of the business
        phone:
          type: string
          description: Phone number of the business
    Product:
      type: object
      required: [position, product_id, title, category, image, product_link]
      properties:
        position:
          type: integer
          description: Position of the product in the catalog, starting at 1
        product_id:
          type: string
          description: Google's numeric identifier of the product, which can be negative
        title:
          type: string
          description: Name of the product
        description:
          type: string
          description: Description the business wrote for the product
        category:
          type: string
          description: Catalog category the product is listed under
        price:
          type: string
          description: Price or price range as displayed, formatted for the hl language
        extracted_price:
          type: number
          description: Numeric value of a single price
        extracted_price_range:
          $ref: '#/components/schemas/PriceRange'
        is_price_range:
          type: boolean
          description: Whether the price is a range of two amounts
        currency:
          type: string
          description: ISO 4217 currency code of the price
        image:
          type: string
          description: URL of the product image
        link:
          type: string
          description: URL of the product on the business's own website
        call_to_action:
          type: string
          description: Label of the button that opens the link
        product_link:
          type: string
          description: URL of the product's Google page
    PriceRange:
      type: object
      required: [from, to]
      properties:
        from:
          type: number
          description: Lowest price of the range
        to:
          type: number
          description: Highest price of the range
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
