openapi: 3.0.0
info:
  title: AliExpress Product API
  description: |
    Get an AliExpress product by its id for the country it ships to, in that country's currency and language.
    It returns the price, original price and discount, rating, review count, orders, stock, images and video, specifications, coupons, the variant options and the SKUs with their own price and stock, the seller, and the shipping cost and delivery estimate.

    **Cross-linking**: The `product_id` of an `aliexpress_search` result goes in `product_id`.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: AliExpress Product
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Engine used to retrieve the results.
          schema:
            type: string
            enum: ["aliexpress_product"]
        - name: product_id
          in: query
          required: true
          description: Number in the product link, such as `1005009623988175` from `aliexpress.com/item/1005009623988175.html`, up to 4503599627370495.
          schema:
            type: string
        - name: delivery_country
          in: query
          required: false
          description: Two-letter code of the country the product ships to. It also sets the currency and language AliExpress uses there unless `currency` or `language` is given.
          schema:
            type: string
            enum: ["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CO", "CR", "CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RW", "SA", "SB", "SC", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"]
            default: "US"
        - name: currency
          in: query
          required: false
          description: Three-letter code of the currency prices are shown in.
          schema:
            type: string
            enum: ["AED", "AMD", "ARS", "AUD", "AZN", "BDT", "BGN", "BHD", "BOB", "BRL", "BYN", "CAD", "CHF", "CLP", "CNY", "COP", "CRC", "CZK", "DKK", "DOP", "DZD", "EGP", "EUR", "FJD", "GBP", "GEL", "GTQ", "HKD", "HNL", "HUF", "IDR", "ILS", "INR", "ISK", "JOD", "JPY", "KES", "KGS", "KHR", "KRW", "KWD", "KZT", "LAK", "LKR", "MAD", "MDL", "MMK", "MNT", "MUR", "MXN", "MYR", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PHP", "PKR", "PLN", "QAR", "RON", "RSD", "RUB", "SAR", "SEK", "SGD", "THB", "TND", "TRY", "TWD", "UAH", "USD", "UYU", "UZS", "VND", "XAF", "XOF", "XPF", "ZAR"]
        - name: language
          in: query
          required: false
          description: Language of the title, specifications and options.
          schema:
            type: string
            enum: ["ar_MA", "de_DE", "en_US", "es_ES", "fr_FR", "he_IL", "id_ID", "it_IT", "ja_JP", "ko_KR", "nl_NL", "pl_PL", "pt_BR", "th_TH", "tr_TR", "uk_UA"]
      responses:
        '200':
          description: Successful response. A product AliExpress doesn't have, or doesn't sell to the ship-to country, carries an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductResponse'
        '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:
    ProductResponse:
      type: object
      required: [search_metadata, search_parameters]
      properties:
        search_metadata:
          $ref: '#/components/schemas/SearchMetadata'
        search_parameters:
          $ref: '#/components/schemas/SearchParameters'
        product:
          $ref: '#/components/schemas/Product'
        error:
          type: string
          description: Message explaining why there is no product.
    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: "AliExpress URL for this product"
        html_url:
          type: string
          description: "URL to view HTML results"
        json_url:
          type: string
          description: "URL to view JSON results"
    SearchParameters:
      type: object
      required: [engine, product_id]
      properties:
        engine:
          type: string
          description: Engine used for the search.
        product_id:
          type: string
          description: Requested product id.
        delivery_country:
          type: string
          description: Ship-to country.
        currency:
          type: string
          description: Currency of the prices.
        language:
          type: string
          description: Language of the product.
    Product:
      type: object
      required: [product_id, title, link, is_in_stock, is_choice, is_new_shopper_price, has_aggregated_reviews]
      properties:
        product_id:
          type: string
          description: AliExpress product id used by the ship-to country's site, which can differ from the requested id.
        title:
          type: string
          description: Product title.
        link:
          type: string
          description: Product page on the AliExpress site of the ship-to country.
        price:
          type: string
          description: Price of the selected SKU, or the price range when AliExpress selects none, as AliExpress shows it.
        extracted_price:
          type: number
          description: Price of the selected SKU, or the lowest price of the range, as a number.
        original_price:
          type: string
          description: Price before the discount, or its range, as AliExpress shows it.
        extracted_original_price:
          type: number
          description: Price before the discount, or the lowest of its range, as a number.
        discount:
          type: integer
          description: Discount in percent off the original price, or off the lowest price of the last 30 days where AliExpress shows that instead.
        lowest_price_30_days:
          type: string
          description: Lowest price of the last 30 days before the discount, as AliExpress shows it.
        extracted_lowest_price_30_days:
          type: number
          description: Lowest price of the last 30 days as a number.
        currency:
          type: string
          description: Three-letter code of the currency of the prices.
        rating:
          type: number
          description: Average rating out of 5.
        reviews:
          type: integer
          description: Number of reviews.
        sold:
          type: string
          description: Orders as AliExpress shows them, such as `10,000+ sold`.
        stock:
          type: integer
          description: Units available across all SKUs.
        wishlist_count:
          type: integer
          description: Number of shoppers who saved the product.
        category_ids:
          type: array
          description: AliExpress category ids, from the top category down.
          items:
            type: string
        thumbnail:
          type: string
          description: Main product image.
        images:
          type: array
          description: Product gallery images.
          items:
            type: string
        video:
          $ref: '#/components/schemas/Video'
        description_link:
          type: string
          description: Page holding the seller's product description.
        specifications:
          type: array
          description: Product attributes listed by the seller.
          items:
            $ref: '#/components/schemas/Specification'
        variants:
          type: array
          description: Options a shopper picks, such as color or model.
          items:
            $ref: '#/components/schemas/Variant'
        skus:
          type: array
          description: Each combination of options with its own price and stock.
          items:
            $ref: '#/components/schemas/Sku'
        seller:
          $ref: '#/components/schemas/Seller'
        shipping:
          $ref: '#/components/schemas/Shipping'
        coupons:
          type: array
          description: Coupons AliExpress shows for the product.
          items:
            $ref: '#/components/schemas/Coupon'
        is_in_stock:
          type: boolean
          description: Whether the product can be bought.
        is_choice:
          type: boolean
          description: Whether the product is an AliExpress Choice product.
        is_new_shopper_price:
          type: boolean
          description: Whether the price is a welcome deal for new shoppers.
        has_aggregated_reviews:
          type: boolean
          description: Whether the rating and orders pool similar items from several sellers.
    Video:
      type: object
      required: [link]
      properties:
        link:
          type: string
          description: Product video file.
        thumbnail:
          type: string
          description: Video cover image.
    Specification:
      type: object
      required: [name, value]
      properties:
        name:
          type: string
          description: Attribute name.
        value:
          type: string
          description: Attribute value.
    Variant:
      type: object
      required: [name, options]
      properties:
        id:
          type: integer
          description: AliExpress id of the option group.
        name:
          type: string
          description: Option group name, such as `Color`.
        options:
          type: array
          description: Values of the option group.
          items:
            $ref: '#/components/schemas/VariantOption'
    VariantOption:
      type: object
      required: [name]
      properties:
        id:
          type: integer
          description: AliExpress id of the option.
        name:
          type: string
          description: Option name.
        image:
          type: string
          description: Image of the option.
    Sku:
      type: object
      required: [sku_id, is_available]
      properties:
        sku_id:
          type: string
          description: AliExpress SKU id.
        options:
          type: array
          description: Option picked in each group.
          items:
            $ref: '#/components/schemas/SkuOption'
        price:
          type: string
          description: SKU price as AliExpress shows it.
        extracted_price:
          type: number
          description: SKU price as a number.
        original_price:
          type: string
          description: SKU price before the discount as AliExpress shows it.
        extracted_original_price:
          type: number
          description: SKU price before the discount as a number.
        stock:
          type: integer
          description: Units available.
        is_available:
          type: boolean
          description: Whether the SKU can be bought.
    SkuOption:
      type: object
      required: [name, value]
      properties:
        name:
          type: string
          description: Option group name.
        value:
          type: string
          description: Option picked in the group.
    Seller:
      type: object
      required: [name, is_top_rated]
      properties:
        id:
          type: string
          description: Store id in the store link.
        name:
          type: string
          description: Store name.
        link:
          type: string
          description: Store page.
        logo:
          type: string
          description: Store logo.
        country:
          type: string
          description: Country the seller is based in.
        opened_date:
          type: string
          format: date
          description: Date the store opened.
        positive_feedback_percent:
          type: number
          description: Share of positive feedback in percent.
        is_top_rated:
          type: boolean
          description: Whether AliExpress rates the seller top rated.
    Shipping:
      type: object
      required: [is_deliverable, has_free_shipping, has_tracking]
      properties:
        provider:
          type: string
          description: Shipping service AliExpress picks for the ship-to country.
        ships_from:
          type: string
          description: Country the product ships from.
        extracted_price:
          type: number
          description: Shipping cost as a number.
        free_shipping_threshold:
          type: string
          description: Order amount from which shipping is free, as AliExpress shows it.
        extracted_free_shipping_threshold:
          type: number
          description: Order amount from which shipping is free, as a number.
        delivery:
          $ref: '#/components/schemas/Delivery'
        is_deliverable:
          type: boolean
          description: Whether AliExpress can deliver the product to the ship-to country.
        has_free_shipping:
          type: boolean
          description: Whether shipping is free for this product.
        has_tracking:
          type: boolean
          description: Whether the shipment can be tracked.
    Delivery:
      type: object
      properties:
        min_days:
          type: integer
          description: Fewest days to delivery.
        max_days:
          type: integer
          description: Most days to delivery.
        from_date:
          type: string
          format: date
          description: Earliest delivery date.
        to_date:
          type: string
          format: date
          description: Latest delivery date.
    Coupon:
      type: object
      required: [text]
      properties:
        text:
          type: string
          description: Coupon as AliExpress shows it, such as `$3.00 off on $15.00`.
        promotion_id:
          type: string
          description: AliExpress promotion id.
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
