openapi: 3.0.0
info:
  title: Google Product Offers API
  description: |
    Search for product offers from Google Shopping. This API provides detailed pricing, merchant information, and availability data for a specific product.
    
    **Cross-linking**: The `product_id` parameter required by this API can be obtained from the Google Search API or Google Shopping API when searching for products. The product IDs are returned in the shopping results.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Google Product Offers Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Search engine to use for this request. Must be set to `google_product_offers`.
          schema:
            type: string
            enum: ["google_product_offers"]
        - name: product_id
          in: query
          required: true
          description: Google Product ID to search offers for. This ID is obtained from Google Search or Google Shopping results.
          schema:
            type: string
        - name: location
          in: query
          required: false
          description: Location to search from. If provided, the corresponding UULE parameter will be automatically generated.
          schema:
            type: string
        - name: uule
          in: query
          required: false
          description: Google UULE parameter for location-based search. Used when location is not provided.
          schema:
            type: string
        - name: hl
          in: query
          required: false
          description: Interface language code.
          schema:
            type: string
            default: "en"
            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"]
        - name: gl
          in: query
          required: false
          description: Country code for search results.
          schema:
            type: string
            default: "us"
            enum: ["ae", "ai", "ar", "at", "au", "aw", "be", "bm", "br", "ca", "cc", "ch", "cl", "co", "cx", "cz", "de", "dk", "es", "fi", "fk", "fr", "gb", "gf", "gp", "gr", "gs", "hk", "hm", "hu", "id", "ie", "il", "in", "io", "it", "jp", "kr", "ky", "mq", "ms", "mx", "my", "nc", "nf", "nl", "no", "nz", "pf", "ph", "pl", "pm", "pt", "re", "ro", "ru", "sa", "se", "sg", "sk", "tc", "tf", "th", "tk", "tr", "tw", "ua", "uk", "us", "vg", "vn", "wf", "yt", "za"]
        - name: page
          in: query
          required: false
          description: Page number for pagination. Each page contains up to 10 results.
          schema:
            type: integer
            minimum: 1
        - name: prds
          in: query
          required: false
          description: Alternative product ID parameter for specific offer requests.
          schema:
            type: string
        - name: product_token
          in: query
          required: false
          description: Encoded product token containing product metadata. This is an alternative to product_id.
          schema:
            type: string
      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'
        product:
          $ref: '#/components/schemas/Product'
        offers:
          type: array
          description: List of offers for the product
          items:
            $ref: '#/components/schemas/Offer'
        pagination:
          $ref: '#/components/schemas/Pagination'
        error:
          type: string
          description: Error message if the search failed
    SearchMetadata:
      type: object
      required: [id, 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 Shopping 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 used
        product_id:
          type: string
          description: Product ID searched for
        prds:
          type: string
          description: Alternative product ID parameter
        product_token:
          type: string
          description: Encoded product token if provided
        location:
          type: string
          description: Location parameter if provided
        location_used:
          type: string
          description: Canonical name of the location used
        uule:
          type: string
          description: UULE parameter used (only present if location not provided)
        hl:
          type: string
          description: Interface language code
        gl:
          type: string
          description: Country code
        page:
          type: integer
          description: Page number
    Product:
      type: object
      properties:
        product_id:
          type: string
          description: Google Product ID
        prds:
          type: string
          description: Product reference string
        title:
          type: string
          description: Product title
        link:
          type: string
          description: Link to the product page
        brand:
          type: string
          description: Product brand
        rating:
          type: number
          description: Product rating
        reviews:
          type: integer
          description: Number of reviews
    Offer:
      type: object
      properties:
        position:
          type: integer
          description: Position of the offer in results
        title:
          type: string
          description: Offer title
        link:
          type: string
          description: Direct link to the merchant's product page
        price:
          type: string
          description: Display price of the product
        extracted_price:
          type: number
          description: Extracted numeric price value
        original_price:
          type: string
          description: Original price before discount
        extracted_original_price:
          type: number
          description: Extracted numeric original price
        delivery_price:
          type: string
          description: Delivery cost
        extracted_delivery_price:
          type: number
          description: Extracted numeric delivery price
        total_price:
          type: string
          description: Total price including all costs
        extracted_total_price:
          type: number
          description: Extracted numeric total price
        installment:
          $ref: '#/components/schemas/Installment'
        rating:
          type: number
          description: Offer rating
        reviews:
          type: integer
          description: Number of reviews for this offer
        details:
          type: array
          description: Additional details about the offer
          items:
            type: string
        payment_methods:
          type: string
          description: Available payment methods
        merchant:
          $ref: '#/components/schemas/Merchant'
        tag:
          type: string
          description: Special offer tag
    Installment:
      type: object
      properties:
        down_payment:
          type: string
          description: Down payment amount
        extracted_down_payment:
          type: number
          description: Extracted numeric down payment
        months:
          type: string
          description: Number of months for installment
        extracted_months:
          type: integer
          description: Extracted numeric months value
        cost_per_month:
          type: string
          description: Monthly payment amount
        extracted_cost_per_month:
          type: number
          description: Extracted numeric monthly payment
    Merchant:
      type: object
      properties:
        name:
          type: string
          description: Merchant name
        favicon:
          type: string
          description: Merchant favicon URL
        rating:
          type: number
          description: Merchant rating
        reviews:
          type: integer
          description: Number of merchant reviews
        link:
          type: string
          description: Link to merchant's page
    Pagination:
      type: object
      properties:
        current:
          type: integer
          description: Current page number
        previous:
          type: string
          description: Previous page number
        next:
          type: string
          description: Next page number
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong