openapi: 3.0.0
info:
  title: Shopify Products API
  description: |
    Get the products of a Shopify store, or of one of its collections, up to 250 per page.

    Each product has its prices, availability, images and variants. 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 Products Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: 'Search engine. Must be set to: `shopify_products`'
          schema:
            type: string
            enum: ["shopify_products"]
        - name: domain
          in: query
          required: true
          description: The store's domain, such as `allbirds.com` or `kith.com`, or any link on the store. A `myshopify.com` domain also works.
          schema:
            type: string
        - name: collection_handle
          in: query
          required: false
          description: Handle of a collection, such as `mens` in `allbirds.com/collections/mens`, to list only its products. A collection link also works. Get handles from the Shopify Collections API.
          schema:
            type: string
        - name: page
          in: query
          required: false
          description: Page of results, at the size `num` sets.
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: num
          in: query
          required: false
          description: Number of results per page, from 1 to 250.
          schema:
            type: integer
            minimum: 1
            maximum: 250
            default: 30
        - 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'
        products:
          type: array
          items:
            $ref: '#/components/schemas/Product'
        pagination:
          $ref: '#/components/schemas/Pagination'
        error:
          type: string
          description: Why there are no products to return.
    Product:
      type: object
      required: [position, product_id, title, handle, link, price, extracted_price, is_available, is_on_sale, variants, created_at]
      properties:
        position:
          type: integer
          description: Position of the product across pages.
        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'
        options:
          type: array
          items:
            $ref: '#/components/schemas/Option'
        variants:
          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.
        updated_at:
          type: string
          format: date-time
          description: Time the product was last updated.
    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.
        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.
        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.
        width:
          type: integer
          description: Image width in pixels.
        height:
          type: integer
          description: Image height in pixels.
    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.
    Pagination:
      type: object
      required: [current]
      properties:
        current:
          type: integer
          description: Current page.
        next_page:
          type: integer
          description: Value to pass as `page` for the next page, shown after any page with products, or an empty one while the store lists more, within its first 25,000 products.
    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
        collection_handle:
          type: string
        page:
          type: integer
        num:
          type: integer
        zero_retention:
          type: boolean
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
