openapi: 3.0.0
info:
  title: Walmart Product API
  description: |
    The Walmart Product API allows you to retrieve detailed product information from Walmart, including pricing, availability, specifications, reviews, and more.

    **Cross-linking**: The `product_id` parameter accepts Walmart product IDs. You can obtain these IDs from the Walmart Search API results or from Walmart product URLs (the numeric part after `/ip/` in the URL).
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Walmart Product Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Engine to use for the search
          schema:
            type: string
            enum: ["walmart_product"]
            default: "walmart_product"
        - name: product_id
          in: query
          required: true
          description: Walmart product ID to retrieve information for
          schema:
            type: string
        - name: store_id
          in: query
          required: false
          description: Walmart store ID to get location-specific information
          schema:
            type: integer
      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'
        search_information:
          $ref: '#/components/schemas/SearchInformation'
        product:
          $ref: '#/components/schemas/Product'
        reviews:
          $ref: '#/components/schemas/Reviews'
        error:
          type: string
          description: Error message when no results are found
    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: Walmart 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: Engine used for the search
        product_id:
          type: string
          description: Walmart product ID searched for
        store_id:
          type: integer
          description: Walmart store ID used for location-specific information
    SearchInformation:
      type: object
      properties:
        meta_title:
          type: string
          description: SEO meta title for the product page
        meta_description:
          type: string
          description: SEO meta description for the product page
        postal_code:
          type: string
          description: Postal code of the location
        province_code:
          type: string
          description: State or province code
        city:
          type: string
          description: City name
        store_id:
          type: string
          description: Store ID for the location
    Product:
      type: object
      properties:
        id:
          type: string
          description: Walmart US item ID
        product_id:
          type: string
          description: Internal product ID
        upc:
          type: string
          description: Universal Product Code
        title:
          type: string
          description: Product title
        brand:
          $ref: '#/components/schemas/Brand'
        link:
          type: string
          description: URL to the product page on Walmart
        seller_id:
          type: string
          description: Seller ID
        seller_name:
          type: string
          description: Seller name
        rating:
          type: number
          description: Average customer rating
        reviews:
          type: integer
          description: Total number of customer reviews
        price:
          type: string
          description: Current price as displayed
        extracted_price:
          type: number
          description: Current price as a numeric value
        original_price:
          type: string
          description: Original price before discount
        extracted_original_price:
          type: number
          description: Original price as a numeric value
        unit_price:
          type: string
          description: Price per unit
        extracted_unit_price:
          type: number
          description: Price per unit as a numeric value
        price_range:
          $ref: '#/components/schemas/PriceRange'
        specifications:
          type: array
          items:
            $ref: '#/components/schemas/Specification'
          description: Product specifications
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/Warning'
          description: Product warnings
        warranty:
          type: string
          description: Warranty information
        highlights:
          type: array
          items:
            $ref: '#/components/schemas/Highlight'
          description: Product highlights
        description:
          type: string
          description: Product description
        ai_description:
          type: string
          description: AI-generated product description
        ai_list_description:
          type: array
          items:
            type: string
          description: AI-generated bullet point descriptions
        ingredients:
          type: string
          description: Product ingredients
        nutrition_facts:
          $ref: '#/components/schemas/NutritionFacts'
        main_image:
          type: string
          description: Main product image URL
        images:
          type: array
          items:
            $ref: '#/components/schemas/Image'
          description: All product images
        condition:
          type: string
          description: Product condition
        condition_offers:
          type: array
          items:
            $ref: '#/components/schemas/ConditionOffer'
          description: Offers for different conditions
        is_out_of_stock:
          type: boolean
          description: Whether the product is out of stock
        is_subscription_eligible:
          type: boolean
          description: Whether the product is eligible for subscription
        fulfillment:
          $ref: '#/components/schemas/Fulfillment'
        min_quantity:
          type: integer
          description: Minimum quantity that can be ordered
        max_quantity:
          type: integer
          description: Maximum quantity that can be ordered
        categories:
          type: array
          items:
            $ref: '#/components/schemas/Category'
          description: Product category hierarchy
        variants:
          type: array
          items:
            $ref: '#/components/schemas/Variant'
          description: Product variants
        badges:
          type: array
          items:
            $ref: '#/components/schemas/Badge'
          description: Product badges
        additional_services:
          type: array
          items:
            $ref: '#/components/schemas/AdditionalService'
          description: Additional services available for the product
    Brand:
      type: object
      properties:
        name:
          type: string
          description: Brand name
        link:
          type: string
          description: URL to the brand page
    PriceRange:
      type: object
      properties:
        extracted_min_price:
          type: number
          description: Minimum price in the range
        extracted_max_price:
          type: number
          description: Maximum price in the range
    Specification:
      type: object
      properties:
        name:
          type: string
          description: Specification name
        value:
          type: string
          description: Specification value
    Warning:
      type: object
      properties:
        name:
          type: string
          description: Warning type
        value:
          type: string
          description: Warning message
    Highlight:
      type: object
      properties:
        name:
          type: string
          description: Highlight name
        value:
          type: string
          description: Highlight value
        thumbnail:
          type: string
          description: Highlight icon URL
    NutritionFacts:
      type: object
      properties:
        disclaimer:
          $ref: '#/components/schemas/NutritionInfo'
        additional_info:
          $ref: '#/components/schemas/NutritionInfo'
        serving_info:
          type: array
          items:
            $ref: '#/components/schemas/NutritionInfo'
          description: Serving size information
        key_nutrients:
          type: array
          items:
            $ref: '#/components/schemas/KeyNutrient'
          description: Key nutritional values
        vitamins_and_minerals:
          type: array
          items:
            $ref: '#/components/schemas/VitaminMineral'
          description: Vitamin and mineral content
    NutritionInfo:
      type: object
      properties:
        name:
          type: string
          description: Information label
        value:
          type: string
          description: Information value
        extracted_value:
          type: number
          description: Numeric value extracted
    KeyNutrient:
      type: object
      properties:
        name:
          type: string
          description: Nutrient name
        value:
          type: string
          description: Nutrient amount
        extracted_value:
          type: number
          description: Numeric amount
        daily_value_percentage:
          type: string
          description: Percentage of daily value
        extracted_daily_value_percentage:
          type: number
          description: Numeric percentage of daily value
    VitaminMineral:
      type: object
      properties:
        name:
          type: string
          description: Vitamin or mineral name
        amount:
          type: string
          description: Amount per serving
        extracted_amount:
          type: number
          description: Numeric amount
        daily_value_percentage:
          type: string
          description: Percentage of daily value
        extracted_daily_value_percentage:
          type: number
          description: Numeric percentage of daily value
    Image:
      type: object
      properties:
        id:
          type: string
          description: Image ID
        url:
          type: string
          description: Image URL
    ConditionOffer:
      type: object
      properties:
        id:
          type: string
          description: Offer ID
        condition:
          type: string
          description: Product condition
        price:
          type: string
          description: Price for this condition
        extracted_price:
          type: number
          description: Numeric price
        availability:
          type: string
          description: Availability status
    Fulfillment:
      type: object
      properties:
        pickup:
          $ref: '#/components/schemas/FulfillmentOption'
        delivery:
          $ref: '#/components/schemas/FulfillmentOption'
        shipping:
          $ref: '#/components/schemas/FulfillmentOption'
    FulfillmentOption:
      type: object
      properties:
        text:
          type: string
          description: Fulfillment badge text
        expected_date:
          type: string
          format: date-time
          description: Expected fulfillment date
        items_limit:
          type: integer
          description: Maximum items allowed
        price:
          type: number
          description: Fulfillment cost
        is_free_fulfillment:
          type: boolean
          description: Whether fulfillment is free
        is_free_with_walmart_plus:
          type: boolean
          description: Whether fulfillment is free with Walmart+
    Category:
      type: object
      properties:
        name:
          type: string
          description: Category name
        link:
          type: string
          description: Category page URL
    Variant:
      type: object
      properties:
        id:
          type: string
          description: Variant ID
        name:
          type: string
          description: Variant name
        type:
          type: string
          description: Variant type
        options:
          type: array
          items:
            $ref: '#/components/schemas/VariantOption'
          description: Available options for this variant
    VariantOption:
      type: object
      properties:
        id:
          type: string
          description: Option ID
        label:
          type: string
          description: Option label
        products:
          type: array
          items:
            $ref: '#/components/schemas/VariantProduct'
          description: Products for this option
        is_available:
          type: boolean
          description: Whether this option is available
        swatch_image_url:
          type: string
          description: Swatch image URL
    VariantProduct:
      type: object
      properties:
        id:
          type: string
          description: Product ID
        link:
          type: string
          description: Product URL
        images:
          type: array
          items:
            type: string
          description: Product image URLs
        main_image:
          type: string
          description: Main image URL
        variants:
          type: array
          items:
            type: string
          description: Variant identifiers
        price:
          type: number
          description: Product price
        original_price:
          type: number
          description: Original price before discount
        currency:
          type: string
          description: Price currency
        is_available:
          type: boolean
          description: Whether the product is available
    Badge:
      type: object
      properties:
        key:
          type: string
          description: Badge key
        text:
          type: string
          description: Badge display text
        query:
          type: string
          description: Badge query parameter
    AdditionalService:
      type: object
      properties:
        type:
          type: string
          description: Service type
        title:
          type: string
          description: Service title
        subtitle:
          type: string
          description: Service subtitle
        groups:
          type: array
          items:
            $ref: '#/components/schemas/ServiceGroup'
          description: Service groups
    ServiceGroup:
      type: object
      properties:
        type:
          type: string
          description: Group type
        title:
          type: string
          description: Group title
        thumbnail:
          type: string
          description: Group thumbnail URL
        description:
          type: string
          description: Group description
        services:
          type: array
          items:
            $ref: '#/components/schemas/Service'
          description: Services in this group
    Service:
      type: object
      properties:
        id:
          type: string
          description: Service item ID
        offer_id:
          type: string
          description: Service offer ID
        name:
          type: string
          description: Service name
        display_name:
          type: string
          description: Service display name
        price:
          type: string
          description: Service price
        extracted_price:
          type: number
          description: Numeric service price
        is_gift_eligible:
          type: boolean
          description: Whether the service is gift eligible
    Reviews:
      type: object
      properties:
        ai_summary:
          $ref: '#/components/schemas/AiSummary'
        aspects:
          type: array
          items:
            $ref: '#/components/schemas/ReviewAspect'
          description: Review aspects
        rating:
          type: number
          description: Average rating
        total_review_count:
          type: integer
          description: Total number of reviews
        top_positive_review:
          $ref: '#/components/schemas/Review'
        top_negative_review:
          $ref: '#/components/schemas/Review'
        customer_reviews:
          type: array
          items:
            $ref: '#/components/schemas/Review'
          description: Customer reviews
    AiSummary:
      type: object
      properties:
        title:
          type: string
          description: AI summary title
        summary:
          type: string
          description: AI-generated summary text
        summary_aspects:
          type: array
          items:
            $ref: '#/components/schemas/SummaryAspect'
          description: Aspects highlighted in the summary
    SummaryAspect:
      type: object
      properties:
        id:
          type: string
          description: Aspect ID
        text:
          type: string
          description: Aspect text from the summary
        sentiment:
          type: string
          description: Aspect sentiment
        link:
          type: string
          description: Link to reviews for this aspect
        start:
          type: integer
          description: Start position in summary text
        end:
          type: integer
          description: End position in summary text
    ReviewAspect:
      type: object
      properties:
        id:
          type: string
          description: Aspect ID
        name:
          type: string
          description: Aspect name
        score:
          type: number
          description: Aspect score
        count:
          type: integer
          description: Number of mentions
    Review:
      type: object
      properties:
        id:
          type: string
          description: Review ID
        title:
          type: string
          description: Review title
        text:
          type: string
          description: Review text
        rating:
          type: number
          description: Review rating
        date:
          type: string
          description: Review date
        extracted_date:
          type: string
          format: date
          description: Parsed review date
        user_name:
          type: string
          description: Reviewer name
        item_details:
          type: array
          items:
            type: string
          description: Item detail variations
        fullfilled_by:
          type: string
          description: Fulfillment provider
        status:
          type: string
          description: Review status
        badges:
          type: array
          items:
            type: string
          description: Review badges
        media:
          type: array
          items:
            $ref: '#/components/schemas/ReviewMedia'
          description: Review media attachments
        replies:
          type: array
          items:
            $ref: '#/components/schemas/ReviewReply'
          description: Replies to the review
    ReviewMedia:
      type: object
      properties:
        id:
          type: string
          description: Media ID
        link:
          type: string
          description: Media URL
        caption:
          type: string
          description: Media caption
        type:
          type: string
          description: Media type
    ReviewReply:
      type: object
      properties:
        name:
          type: string
          description: Replier name
        text:
          type: string
          description: Reply text
        date:
          type: string
          format: date
          description: Reply date
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong