Skip to content

Product List

POSThttps://rebuyengine.com/api/v1/smart-collections/{handle}/products

Returns a list of products for a Smart Collection based on the given parameters in the request body. Only products within the specified collection are returned.

Path Parameters

handle · string · required
URL-friendly identifier for the collection provided by Shopify

Headers

Rebuy-Api-Key · string
Your Rebuy public API key

Query Parameters

key · string
Your Rebuy public API key (alternative to header)

Body Parameters

fields · array of strings
The set of product fields/attributes to be returned in the search results. If omitted, all fields will be returned
filters · object
Specifies the filtering criteria for a query or a data retrieval request
filters.tags · array of strings
A list of product tags used to further refine the resulting products
filters.categories · array of strings
A list of product categories used to further refine the product list
filters.vendors · array of strings
A list of product vendors used to further refine the product list
filters.options · array of strings
A list of product options used to further refine the product list
filters.available · boolean
Limit search to only available products if true
filters.price · object
Specifies the desired price range with min and max properties
filters.metafields · array of strings
A list of metafields categorized by type, namespace, name and value delimited by period characters
sortBy · object
Custom sort object to sort search results based on specific product fields
sortBy.field · string
Sort field. Options: featured, best-sellers, highest-price, lowest-price, new-arrivals, highest-rating, lowest-rating, oldest, name-ascending, name-descending
aggregate · object
Defines dimensions for data aggregation
aggregate.fields · array of strings
Fields to aggregate. Options: availability, tags, categories, options, vendors, metafields, price
pageSize · integer · Default: 15
The number of search results to be returned per page. Maximum value: 250
currentPage · integer · Default: 1
The current page number of search results to be retrieved

Code Example

const handle = "new-arrivals";

fetch(`https://rebuyengine.com/api/v1/smart-collections/${handle}/products?key=YOUR_API_KEY`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Rebuy-Api-Key": "YOUR_API_KEY"
  },
  body: JSON.stringify({
    fields: ["product_id", "name", "price", "images", "variants"],
    sortBy: { field: "featured" },
    pageSize: 15,
    currentPage: 1,
    filters: {
      price: {},
      tags: [],
      categories: [],
      vendors: []
    },
    aggregate: {
      fields: ["availability", "tags", "categories", "vendors", "price"]
    }
  })
})
  .then(response => response.json())
  .then(data => console.log(data));

Response Examples

200 OK

{
  "successful": true,
  "data": {
    "products": [
      {
        "canPurchase": true,
        "categories": ["TOYS"],
        "compareAtPrice": 0,
        "createdAt": 1721135135,
        "description": "",
        "handle": "digimon-plush-toys",
        "id": "9585971822891",
        "images": [
          {
            "alt": "",
            "url": "https://cdn.shopify.com/s/files/1/0888/9407/9275/files/d05c532f9b94484a51dd37222bbea4e2.jpg"
          }
        ],
        "name": "Digimon Plush Toys",
        "price": 2400,
        "sku": "TOY137",
        "tags": ["digimon", "stuffed-toys", "toys"],
        "url": "https://example.myshopify.com/products/digimon-plush-toys",
        "variants": [
          {
            "canPurchase": true,
            "compareAtPrice": 0,
            "id": "49342336958763",
            "name": "Default Title",
            "price": 2400,
            "productId": "9585971822891",
            "sku": "TOY137",
            "visible": true
          }
        ],
        "vendor": "DIGIMON",
        "visible": true
      }
    ],
    "aggregates": [
      {
        "categories": [{ "categories": "TOYS", "numProducts": "10" }]
      },
      {
        "availability": [{ "available": 10 }]
      },
      {
        "price": [{ "max": 6299, "min": 599 }]
      }
    ],
    "pageInfo": {
      "pageSize": 5,
      "currentPage": 1,
      "responseSize": 0,
      "serverSize": 10
    },
    "searchMetadata": []
  },
  "status": 200,
  "errorMessage": null,
  "metadata": []
}

400 Bad Request

{
  "successful": false,
  "message": "error performing search",
  "data": [
    {
      "message": {
        "error": "failed to read products"
      }
    }
  ]
}
See something that needs updating? Suggest an edit