openapi: 3.0.0
info:
  title: Google Shopping Light API
  description: |
    The Google Shopping Light API returns the Google Shopping product grid, sponsored products and titled product carousels for a query, without the filter list. It takes the parameters of the Google Shopping API except `include_base_images`, with `page` up to 25, and returns the same keys except `filters` and `all_filters_token`.

    **Cross-linking**: The `product_token` in each `shopping_results` entry works with the Google Product API, the Google Product Offers API and the Google Product Page API. The Google Product Page API also accepts the `product_id` or `prds` instead. Filter values for `shoprs` come from the `filters` of the Google Shopping API or the Google Shopping Filters API.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Google Shopping Light Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Defines the engine that will be used to retrieve real-time data. It must be set to google_shopping_light.
          schema:
            type: string
            enum: ["google_shopping_light"]
        - name: q
          in: query
          required: true
          description: Search query for Google Shopping.
          schema:
            type: string
        - name: location
          in: query
          required: false
          description: Defines from where you want the search to originate. If several locations match the requested location, the most popular one is selected. Head to the Locations API for more precise control.
          schema:
            type: string
        - name: uule
          in: query
          required: false
          description: Defines the Google encoded location for the search. SearchApi builds it when the location parameter is used, and uule and location cannot be used together.
          schema:
            type: string
        - name: gl
          in: query
          required: false
          description: Country code for the search.
          schema:
            type: string
            default: "us"
            enum: ["ae","ai","ar","au","bm","br","ca","cc","ch","cl","co","cx","fk","gb","gs","hk","hm","id","il","in","io","jp","kr","ky","ms","mx","my","nf","nz","ph","ru","sa","sg","tc","th","tk","tr","tw","ua","uk","us","vg","vn","za","at","aw","be","cz","de","dk","es","fi","fr","gf","gp","gr","hu","ie","it","mq","nc","nl","no","pf","pl","pm","pt","re","ro","se","sk","tf","wf","yt"]
        - name: hl
          in: query
          required: false
          description: Interface language for the search.
          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","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: page
          in: query
          required: false
          description: Page of results to return. A page without products returns the error Google Shopping didn't return any results. Google Shopping can also leave a page before the last one without products, so a later page can still have products.
          schema:
            type: integer
            minimum: 1
            maximum: 25
            default: 1
        - name: sort_by
          in: query
          required: false
          description: Sorts the shopping results. Ignored when shoprs is provided. When Google Shopping doesn't apply a price sort, the search answers a 503 error and isn't charged.
          schema:
            type: string
            enum: ["price_low_to_high","price_high_to_low","rating_high_to_low"]
        - name: price_min
          in: query
          required: false
          description: Minimum product price in the local currency of gl, as a number or currency value with up to 2 decimals (e.g. 2.50 or $100). A comma before the last one or two digits is the decimal mark (2,50 is 2.50). 0 sets no minimum, and it can't be negative. Ignored when shoprs is provided. When Google Shopping doesn't apply it, the search answers a 503 error and isn't charged.
          schema:
            type: string
        - name: price_max
          in: query
          required: false
          description: Maximum product price in the local currency of gl, as a number or currency value with up to 2 decimals, more than 0. A comma before the last one or two digits is the decimal mark (99,99 is 99.99). It can't be lower than price_min. Ignored when shoprs is provided. When Google Shopping doesn't apply it, the search answers a 503 error and isn't charged.
          schema:
            type: string
        - name: condition
          in: query
          required: false
          description: Filters products by condition.
          schema:
            type: string
            enum: ["new","used"]
        - name: is_on_sale
          in: query
          required: false
          description: Set to true to return only products on sale. Ignored when shoprs is provided.
          schema:
            type: string
            enum: ["true", "false"]
        - name: is_small_business
          in: query
          required: false
          description: Set to true to return only products from small businesses. Ignored when shoprs is provided.
          schema:
            type: string
            enum: ["true", "false"]
        - name: is_free_delivery
          in: query
          required: false
          description: Set to true to return only products with free delivery. Ignored when shoprs is provided.
          schema:
            type: string
            enum: ["true", "false"]
        - name: shoprs
          in: query
          required: false
          description: Encoded filter value from the filters of the Google Shopping API or the Google Shopping Filters API.
          schema:
            type: string
        - name: include_favicon
          in: query
          required: false
          description: Set to true to include each seller's favicon in seller_favicon.
          schema:
            type: string
            enum: ["true", "false"]
            default: "false"
      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, or Google Shopping didn't apply sort_by, price_min or price_max.
          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
      required: [search_metadata, search_parameters, search_information]
      properties:
        search_metadata:
          $ref: '#/components/schemas/SearchMetadata'
        search_parameters:
          $ref: '#/components/schemas/SearchParameters'
        search_information:
          $ref: '#/components/schemas/SearchInformation'
        shopping_ads:
          type: array
          description: Sponsored products.
          items:
            $ref: '#/components/schemas/ShoppingAd'
        shopping_results:
          type: array
          description: Products in the main grid.
          items:
            $ref: '#/components/schemas/ShoppingResult'
        categorized_shopping_results:
          type: array
          description: Titled product carousels, such as themed sets, deals and price ranges.
          items:
            $ref: '#/components/schemas/CategorizedShoppingResult'
        popular_products:
          type: array
          description: Popular product recommendations.
          items:
            $ref: '#/components/schemas/ShoppingResult'
        error:
          type: string
          description: Error message when Google Shopping returns no products or rejects the request as malformed.
    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 Shopping URL for this search.
        json_url:
          type: string
          description: URL to view the JSON response.
    SearchParameters:
      type: object
      properties:
        engine:
          type: string
          description: Engine used.
        q:
          type: string
          description: Search query used.
        location:
          type: string
          description: Location parameter provided.
        location_used:
          type: string
          description: Canonical location name used for the search.
        uule:
          type: string
          description: Google encoded location used.
        gl:
          type: string
          description: Country code used.
        hl:
          type: string
          description: Interface language used.
        page:
          type: string
          description: Page number requested.
        shoprs:
          type: string
          description: Encoded filter value used.
        is_on_sale:
          type: string
          description: On-sale filter used.
        is_small_business:
          type: string
          description: Small business filter used.
        is_free_delivery:
          type: string
          description: Free delivery filter used.
        sort_by:
          type: string
          description: Sort order used.
        price_min:
          type: string
          description: Minimum price filter used.
        price_max:
          type: string
          description: Maximum price filter used.
        condition:
          type: string
          description: Product condition filter used.
        include_favicon:
          type: string
          description: Favicon option used.
    SearchInformation:
      type: object
      required: [query_displayed]
      properties:
        query_displayed:
          type: string
          description: Query the results are for.
        showing_results_for:
          type: string
          description: Corrected query Google returned results for instead of a misspelled one.
    ShoppingAd:
      type: object
      required: [position, block_position]
      properties:
        position:
          type: integer
          description: Position of the ad, starting at 1.
        block_position:
          type: string
          description: Block of the page the ad sits in.
        title:
          type: string
          description: Product title.
        seller:
          type: string
          description: Seller name.
        link:
          type: string
          description: Link to the product, as an encrypted Google redirect (google.com/goto?url=...) on some searches.
        domain:
          type: string
          description: Merchant domain, returned whether or not the link is encrypted.
        price:
          type: string
          description: Displayed price.
        extracted_price:
          type: number
          description: Numeric value of price.
        original_price:
          type: string
          description: Price before the discount as Google shows it.
        extracted_original_price:
          type: number
          description: Numeric value of original_price.
        installment:
          $ref: '#/components/schemas/Installment'
        rating:
          type: number
          description: Product rating.
        reviews:
          type: integer
          description: Number of reviews.
        image:
          type: string
          description: Product image URL.
    CategorizedShoppingResult:
      type: object
      required: [shopping_results]
      properties:
        title:
          type: string
          description: Carousel title.
        shopping_results:
          type: array
          description: Products in the carousel, positioned from 1.
          items:
            $ref: '#/components/schemas/ShoppingResult'
    ShoppingResult:
      type: object
      required: [position, product_link, offers_link, product_token]
      properties:
        position:
          type: integer
          description: Position in the results, starting at 1.
        product_id:
          type: string
          description: Google product ID, accepted by the Google Product Page API.
        prds:
          type: string
          description: Product identifier Google uses when the product has no product_id, accepted by the Google Product Page API.
        title:
          type: string
          description: Product title.
        product_link:
          type: string
          description: Link to the product on Google Shopping.
        offers:
          type: string
          description: Offers label, such as "& more".
        offers_link:
          type: string
          description: Link to the product's offers on Google Shopping.
        price:
          type: string
          description: Displayed price.
        extracted_price:
          type: number
          description: Numeric value of price.
        original_price:
          type: string
          description: Price before the discount as Google shows it, bare or labelled (e.g. "$200", "Was $50" or "Usually $750").
        extracted_original_price:
          type: number
          description: Numeric value of original_price.
        installment:
          $ref: '#/components/schemas/Installment'
        rating:
          type: number
          description: Product rating.
        reviews:
          type: integer
          description: Number of reviews.
        tag:
          type: string
          description: Product tag, such as a discount.
        delivery:
          type: string
          description: Delivery information.
        delivery_return:
          type: string
          description: Returns information.
        condition:
          type: string
          description: Product condition, such as "Pre-owned".
        seller:
          type: string
          description: Seller name.
        seller_favicon:
          type: string
          description: Seller favicon URL, returned when include_favicon is true.
        thumbnail:
          type: string
          description: Product image URL.
        product_token:
          type: string
          description: Token for the Google Product, Google Product Offers and Google Product Page APIs.
    Installment:
      type: object
      required: [months, cost_per_month]
      properties:
        down_payment:
          type: string
          description: Payment due now.
        extracted_down_payment:
          type: number
          description: Numeric value of down_payment.
        months:
          type: string
          description: Number of monthly payments.
        extracted_months:
          type: integer
          description: Numeric value of months.
        cost_per_month:
          type: string
          description: Monthly payment.
        extracted_cost_per_month:
          type: number
          description: Numeric value of cost_per_month.
        extracted_cost_per_moth:
          type: number
          description: Same value as extracted_cost_per_month, under the legacy name the Google Shopping API also returns.
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong.
