openapi: 3.0.0
info:
  title: Shopify Product API
  description: |
    Get one product of a Shopify store by its handle.

    Some headless stores don't serve a single product. Use the Shopify Products API for them.

    The product has its prices, availability, images, videos and up to 250 variants with barcodes and stock. The response also has the store's name, currency and country.

    Prices are the ones the store shows in its home country.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Shopify Product Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: 'Search engine. Must be set to: `shopify_product`'
          schema:
            type: string
            enum: ["shopify_product"]
        - name: domain
          in: query
          required: false
          description: The store's domain, such as `allbirds.com`. Required unless `product_handle` is a product link.
          schema:
            type: string
        - name: product_handle
          in: query
          required: true
          description: Handle of the product, such as `womens-wool-cruiser-port-port-sole` in `allbirds.com/products/womens-wool-cruiser-port-port-sole`. A product link also works and sets `domain` when it is not given. Get handles from the Shopify Products API.
          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. A domain that is not a Shopify store, a password protected store or a handle the store does not have returns `error`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400':
          description: Validation Error. A parameter is missing or invalid, or the domain cannot be reached.
          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. 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
      required: [search_metadata, search_parameters]
      properties:
        search_metadata:
          $ref: '#/components/schemas/SearchMetadata'
        search_parameters:
          $ref: '#/components/schemas/SearchParameters'
        store_information:
          $ref: '#/components/schemas/StoreInformation'
        product:
          $ref: '#/components/schemas/Product'
        error:
          type: string
          description: Why there is no product to return.
    Product:
      type: object
      required: [product_id, title, handle, link, price, extracted_price, is_available, is_on_sale, variants, created_at]
      properties:
        product_id:
          type: integer
          description: Shopify identifier of the product.
        title:
          type: string
          description: Product title.
        handle:
          type: string
          description: The product's handle, to pass to the Shopify Product API as `product_handle`.
        link:
          type: string
          description: Link to the product page.
        brand:
          type: string
          description: Brand, from the product's vendor.
        product_type:
          type: string
          description: Product type the store assigned.
        tags:
          type: array
          description: Tags the store assigned.
          items:
            type: string
        description:
          type: string
          description: Product description as plain text.
        price:
          type: string
          description: Lowest variant price, with the currency symbol.
        extracted_price:
          type: number
          description: Lowest variant price, as a number.
        max_price:
          type: string
          description: Highest variant price, with the currency symbol, for a product whose variants differ in price.
        extracted_max_price:
          type: number
          description: Highest variant price, as a number.
        original_price:
          type: string
          description: Price of the cheapest variant before its discount, with the currency symbol.
        extracted_original_price:
          type: number
          description: Price of the cheapest variant before its discount, as a number.
        currency:
          type: string
          description: ISO 4217 code of the price currency.
        is_available:
          type: boolean
          description: Whether any variant can be bought.
        is_on_sale:
          type: boolean
          description: Whether any variant is priced below its original price.
        thumbnail:
          type: string
          description: Main product image.
        images:
          type: array
          items:
            $ref: '#/components/schemas/Image'
        videos:
          type: array
          items:
            $ref: '#/components/schemas/Video'
        options:
          type: array
          items:
            $ref: '#/components/schemas/Option'
        variants:
          description: Variants of the product, up to 250.
          type: array
          items:
            $ref: '#/components/schemas/Variant'
        created_at:
          type: string
          format: date-time
          description: Time the product was created.
        published_at:
          type: string
          format: date-time
          description: Time the product was published.
    Variant:
      type: object
      required: [variant_id, price, extracted_price, is_available, is_shipping_required, is_taxable, link]
      properties:
        variant_id:
          type: integer
          description: Shopify identifier of the variant.
        title:
          type: string
          description: Variant title, built from its option values.
        options:
          type: array
          description: The variant's option values, in the order of the product's options.
          items:
            type: string
        sku:
          type: string
          description: Stock keeping unit.
        barcode:
          type: string
          description: Barcode, such as a UPC or EAN.
        price:
          type: string
          description: Price with the currency symbol.
        extracted_price:
          type: number
          description: Price as a number.
        original_price:
          type: string
          description: Price before the discount, with the currency symbol.
        extracted_original_price:
          type: number
          description: Price before the discount, as a number.
        is_available:
          type: boolean
          description: Whether the variant can be bought.
        stock:
          type: integer
          description: Units in stock, when the store publishes the variant's inventory.
        weight_grams:
          type: integer
          description: Shipping weight in grams.
        is_shipping_required:
          type: boolean
          description: Whether the variant needs shipping.
        is_taxable:
          type: boolean
          description: Whether the store charges tax on the variant.
        thumbnail:
          type: string
          description: Image of the variant.
        link:
          type: string
          description: Link to the product page with this variant selected.
    Image:
      type: object
      required: [link]
      properties:
        link:
          type: string
          description: Image URL.
        alt:
          type: string
          description: Alt text the store wrote for the image.
        width:
          type: integer
          description: Image width in pixels.
        height:
          type: integer
          description: Image height in pixels.
    Video:
      type: object
      required: [link]
      properties:
        link:
          type: string
          description: Link to the video, the largest MP4 file or the YouTube or Vimeo page.
        thumbnail:
          type: string
          description: Preview image of the video.
    Option:
      type: object
      required: [name]
      properties:
        name:
          type: string
          description: Option name, such as Size or Color.
        values:
          type: array
          description: Values a buyer can pick for this option.
          items:
            type: string
    StoreInformation:
      type: object
      required: [store_id, myshopify_domain]
      properties:
        store_id:
          type: integer
          description: Shopify identifier of the store.
        name:
          type: string
          description: Store name.
        domain:
          type: string
          description: The store's primary domain.
        myshopify_domain:
          type: string
          description: The store's myshopify.com domain.
        link:
          type: string
          description: Link to the store.
        description:
          type: string
          description: Store description.
        currency:
          type: string
          description: ISO 4217 code of the currency the store prices its home country in.
        country:
          type: string
          description: ISO 3166-1 alpha-2 code of the store's country.
        province:
          type: string
          description: The store's province or state.
        city:
          type: string
          description: The store's city.
        ships_to_countries:
          type: array
          description: ISO 3166-1 alpha-2 codes of the countries the store ships to.
          items:
            type: string
        products_count:
          type: integer
          description: Number of products the store has published.
        collections_count:
          type: integer
          description: Number of collections the store has published.
    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: Shopify URL for this search
        html_url:
          type: string
          description: URL to view the raw results
        json_url:
          type: string
          description: URL to view JSON results
    SearchParameters:
      type: object
      properties:
        engine:
          type: string
        domain:
          type: string
        product_handle:
          type: string
        zero_retention:
          type: boolean
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
