openapi: 3.0.0
info:
  title: Walmart Product Sellers API
  description: |
    The Walmart Product Sellers API returns the offers Walmart lists for a product in its "Compare all sellers"
    panel, together with the product it belongs to. Each offer carries its seller, price, condition, shipping,
    pickup and delivery options, and return policy. Offers come in the order Walmart ranks them, with the buy box
    offer first. Delivery dates, the order of the offers and which offers are available follow the location of
    the request.

    **Cross-linking**: The `product_id` parameter is the numeric Walmart item ID. Use the `id` field of a Walmart
    Search API result or the `product.id` field of the Walmart Product API.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Walmart Product Sellers
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Engine to use for the search
          schema:
            type: string
            enum: ["walmart_product_sellers"]
            default: "walmart_product_sellers"
        - name: product_id
          in: query
          required: true
          description: >-
            Numeric Walmart item ID of the product, up to 9223372036854775807, as in
            https://www.walmart.com/ip/Nintendo-Switch-2-System/15949610846. Walmart answers a relisted item with
            its new ID, which the response returns as product.id.
          schema:
            type: string
            pattern: '^[0-9]+$'
        - name: store_id
          in: query
          required: false
          description: >-
            Walmart store the response is pinned to. Delivery dates, pickup and delivery options and the order of
            the offers follow the store's location. When omitted, Walmart localizes the response itself and the
            store it picked is returned in search_information.store_id.
          schema:
            type: string
        - name: zero_retention
          in: query
          required: false
          description: Set to true to disable logging and persistent storage for this request. Enterprise plans only.
          schema:
            type: boolean
            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'
        '403':
          description: Forbidden. Zero data retention is not available to the account, or the account requires `zero_retention=true`.
          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, or Walmart could not answer the request on any attempt. The body is a bare
            {"error": ...} rather than a search response, and the search is not billed.
          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'
        search_information:
          $ref: '#/components/schemas/SearchInformation'
        product:
          $ref: '#/components/schemas/Product'
        offers:
          type: array
          description: The product's offers in the order Walmart ranks them, with the buy box offer first.
          items:
            $ref: '#/components/schemas/Offer'
        has_no_offers:
          type: boolean
          description: Whether Walmart lists no offer for the product.
        error:
          type: string
          description: Message saying why the response holds no product, for example that Walmart could not find it.
    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: Walmart product page 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: Engine used for the search
        product_id:
          type: string
          description: Walmart item ID requested
        store_id:
          type: string
          description: Walmart store the response was pinned to
        zero_retention:
          type: boolean
          description: Whether zero data retention was requested
    SearchInformation:
      type: object
      properties:
        postal_code:
          type: string
          description: Postal code of the location the offers are shown for
        province_code:
          type: string
          description: State code of that location
        city:
          type: string
          description: City of that location
        store_id:
          type: string
          description: Walmart store the response is localized to
    Product:
      type: object
      required: [id, product_id, title, link]
      properties:
        id:
          type: string
          description: Walmart item ID the offers belong to
        product_id:
          type: string
          description: Walmart catalog product ID
        title:
          type: string
          description: Product title
        brand:
          $ref: '#/components/schemas/Brand'
        link:
          type: string
          description: Walmart product page
        rating:
          type: number
          description: Average customer rating of the product
        reviews:
          type: integer
          description: Number of customer reviews of the product
        main_image:
          type: string
          description: Main product image
        price:
          type: string
          description: Buy box price as displayed
        extracted_price:
          type: number
          description: Buy box price in US dollars
    Brand:
      type: object
      properties:
        name:
          type: string
          description: Brand name
        link:
          type: string
          description: Walmart search page for the brand
    Offer:
      type: object
      required: [position, offer_id, offer_type, link, seller, price, extracted_price, condition, fulfillment, return_policy]
      properties:
        position:
          type: integer
          description: 1-based position of the offer in Walmart's ranking
        is_buybox_winner:
          type: boolean
          description: Whether the offer holds the product page's buy box
        offer_id:
          type: string
          description: Walmart offer ID
        offer_type:
          type: string
          description: Where the offer can be bought, such as ONLINE_ONLY or ONLINE_AND_STORE
        link:
          type: string
          description: Walmart product page opened on this offer's condition
        seller:
          $ref: '#/components/schemas/Seller'
        is_sold_by_walmart:
          type: boolean
          description: Whether Walmart.com sells the offer
        is_fulfilled_by_walmart:
          type: boolean
          description: Whether Walmart ships the offer from its fulfillment centers or stores
        price:
          type: string
          description: Offer price as displayed
        extracted_price:
          type: number
          description: Offer price in US dollars
        original_price:
          type: string
          description: Price before the discount as displayed
        extracted_original_price:
          type: number
          description: Price before the discount in US dollars
        condition:
          $ref: '#/components/schemas/Condition'
        fulfillment:
          $ref: '#/components/schemas/Fulfillment'
        return_policy:
          $ref: '#/components/schemas/ReturnPolicy'
    Seller:
      type: object
      required: [id, catalog_seller_id, name, display_name]
      properties:
        id:
          type: string
          description: Walmart seller ID
        catalog_seller_id:
          type: string
          description: Numeric Walmart seller ID, the number in the seller's page URL, 0 for Walmart.com
        name:
          type: string
          description: Seller's registered name
        display_name:
          type: string
          description: Seller's store name as Walmart shows it
        link:
          type: string
          description: Seller's page on Walmart
        is_pro_seller:
          type: boolean
          description: Whether Walmart shows the Pro Seller badge
        rating:
          type: number
          description: Seller's average rating out of 5
        reviews:
          type: integer
          description: Number of seller reviews
    Condition:
      type: object
      required: [text, group, code]
      properties:
        text:
          type: string
          description: Condition as Walmart shows it, such as New or Pre-Owned Like New
        group:
          type: string
          description: Condition group, such as New, Pre-Owned, Restored or Collectible
        code:
          type: integer
          description: Walmart condition code
        is_new:
          type: boolean
          description: Whether the item is new
    Fulfillment:
      type: object
      properties:
        shipping:
          $ref: '#/components/schemas/FulfillmentOption'
        pickup:
          $ref: '#/components/schemas/FulfillmentOption'
        delivery:
          $ref: '#/components/schemas/FulfillmentOption'
    FulfillmentOption:
      type: object
      properties:
        text:
          type: string
          description: Delivery speed as Walmart shows it, such as Today or Tomorrow
        expected_date:
          type: string
          format: date-time
          description: Expected delivery or pickup date
        latest_expected_date:
          type: string
          format: date-time
          description: Latest expected delivery date of the shipping window
        items_limit:
          type: integer
          description: Maximum quantity per order
        price:
          type: number
          description: Fulfillment fee
        is_free_fulfillment:
          type: boolean
          description: Whether the option is free
    ReturnPolicy:
      type: object
      required: [text]
      properties:
        text:
          type: string
          description: Return policy as Walmart shows it
        is_returnable:
          type: boolean
          description: Whether the offer can be returned
        has_free_returns:
          type: boolean
          description: Whether returns are free
        days:
          type: integer
          description: Number of days the return window lasts
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
