Purchased
GET
https://rebuyengine.com/api/v1/products/purchasedUse Cases
Use this endpoint to create personalized shopping experiences. For example, when a known customer is looking at the homepage, show them their favorite products for easy reordering.
Total units purchased is returned at the product-level¶
Customer details are returned at the response-level¶
"metadata": {
"shopify_customer": {
"id": 589064699940,
"first_name": "John",
"last_name": "Smith"
}
}
Query Parameters¶
shopify_customer_id· string- Shopify Customer ID
shopify_product_ids· string- Comma separated list of Shopify product IDs to filter from the result set.
metafields· string- Valid values: yes. Returns product objects enriched with a metafields property.
bust_cache· string- Valid values: yes. Deletes cached response and generates a new one.
limit· string · Default:5- Used to limit the number of returned results.
format· string- Valid values: pretty. Use pretty to make the response easy to read.
filter_oos· string · Default:yes- Excludes products that are out of stock (OOS) from the response. To include OOS products, set the parameter to no.
country_code· string-
The ISO 3166-1 alpha-2 country code (e.g.,
US,CA,GB) corresponding to a Market region. Retrieves variant pricing from the Market’s catalog. The prices returned reflect the shop’s first active Market that matches the providedcountry_code. Only products included in that Market’s catalog will be returned in the response — products excluded from the catalog will not appear.Required Shopify Scope:
read_marketsReplaces the deprecated
presentment_pricesquery parameter.
Code Example¶
// GET https://rebuyengine.com/api/v1/products/purchased
const params = new URLSearchParams({
shopify_customer_id: "YOUR_VALUE",
shopify_product_ids: "YOUR_VALUE"
});
fetch(`https://rebuyengine.com/api/v1/products/purchased?${params}`)
.then(response => response.json())
.then(data => console.log(data));
Response Examples¶
200 - 200¶
{
"data": [
{
"id": 562361892900,
"title": "Flex Fleece Zip Hoodie",
"body_html": "Flex Fleece Zip Hoodie",
"vendor": "Example Brand",
"product_type": "",
"created_at": "2018-03-20T13:49:54-04:00",
"handle": "american-apparel-flex-fleece-zip-hoodie",
"updated_at": "2019-09-20T14:11:25-04:00",
"published_at": "2018-03-20T13:46:55-04:00",
"template_suffix": "",
"published_scope": "web",
"tags": "carthook_checkout, clothing",
"admin_graphql_api_id": "gid://shopify/Product/562361892900",
"variants": [
{
"id": 7162327597092,
"product_id": 562361892900,
"title": "Black",
"price": "36.00",
"sku": "AAFFZH-1",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": "45.00",
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Black",
"option2": null,
"option3": null,
"created_at": "2018-03-20T13:49:54-04:00",
"updated_at": "2019-12-19T15:10:50-05:00",
"taxable": true,
"barcode": "",
"grams": 1361,
"image_id": 2155862786084,
"weight": 3,
"weight_unit": "lb",
"inventory_item_id": 7159543824420,
"inventory_quantity": -92,
"old_inventory_quantity": -92,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/7162327597092"
},
{
"id": 7162327629860,
"product_id": 562361892900,
"title": "Gray",
"price": "36.00",
"sku": "AAFFZH-2",
"position": 2,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Gray",
"option2": null,
"option3": null,
"created_at": "2018-03-20T13:49:54-04:00",
"updated_at": "2018-09-27T13:05:00-04:00",
"taxable": true,
"barcode": "",
"grams": 1361,
"image_id": 2155863867428,
"weight": 3,
"weight_unit": "lb",
"inventory_item_id": 7159543857188,
"inventory_quantity": -6,
"old_inventory_quantity": -6,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/7162327629860"
},
{
"id": 7162327662628,
"product_id": 562361892900,
"title": "Lapis",
"price": "36.00",
"sku": "AAFFZH-3",
"position": 3,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Lapis",
"option2": null,
"option3": null,
"created_at": "2018-03-20T13:49:54-04:00",
"updated_at": "2018-09-27T13:05:00-04:00",
"taxable": true,
"barcode": "",
"grams": 1361,
"image_id": 2155865604132,
"weight": 3,
"weight_unit": "lb",
"inventory_item_id": 7159543889956,
"inventory_quantity": -14,
"old_inventory_quantity": -14,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/7162327662628"
},
{
"id": 7162327695396,
"product_id": 562361892900,
"title": "Navy",
"price": "36.00",
"sku": "AAFFZH-4",
"position": 4,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Navy",
"option2": null,
"option3": null,
"created_at": "2018-03-20T13:49:54-04:00",
"updated_at": "2018-11-19T19:09:31-05:00",
"taxable": true,
"barcode": "",
"grams": 1361,
"image_id": 2155866128420,
"weight": 3,
"weight_unit": "lb",
"inventory_item_id": 7159543922724,
"inventory_quantity": -4,
"old_inventory_quantity": -4,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/7162327695396"
},
{
"id": 7162327728164,
"product_id": 562361892900,
"title": "White",
"price": "36.00",
"sku": "AAFFZH-5",
"position": 5,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "White",
"option2": null,
"option3": null,
"created_at": "2018-03-20T13:49:54-04:00",
"updated_at": "2018-09-27T13:05:01-04:00",
"taxable": true,
"barcode": "",
"grams": 1361,
"image_id": 2155866390564,
"weight": 3,
"weight_unit": "lb",
"inventory_item_id": 7159543955492,
"inventory_quantity": -18,
"old_inventory_quantity": -18,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/7162327728164"
}
],
"options": [
{
"id": 832991428644,
"product_id": 562361892900,
"name": "Color",
"position": 1,
"values": [
"Black",
"Gray",
"Lapis",
"Navy",
"White"
]
}
],
"images": [
{
"id": 2155862786084,
"product_id": 562361892900,
"position": 1,
"created_at": "2018-03-20T14:01:48-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_Black_A.png?v=1573880385",
"variant_ids": [
7162327597092
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155862786084"
},
{
"id": 2155863179300,
"product_id": 562361892900,
"position": 2,
"created_at": "2018-03-20T14:01:50-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_Black_B.png?v=1573880385",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155863179300"
},
{
"id": 2155863867428,
"product_id": 562361892900,
"position": 3,
"created_at": "2018-03-20T14:01:54-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_Gray_A.png?v=1573880385",
"variant_ids": [
7162327629860
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155863867428"
},
{
"id": 2155864948772,
"product_id": 562361892900,
"position": 4,
"created_at": "2018-03-20T14:01:57-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_Gray_B.png?v=1573880385",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155864948772"
},
{
"id": 2155865604132,
"product_id": 562361892900,
"position": 5,
"created_at": "2018-03-20T14:02:01-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_Lapis_A.png?v=1573880385",
"variant_ids": [
7162327662628
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155865604132"
},
{
"id": 2155865800740,
"product_id": 562361892900,
"position": 6,
"created_at": "2018-03-20T14:02:04-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_Lapis_B.png?v=1573880385",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155865800740"
},
{
"id": 2155866128420,
"product_id": 562361892900,
"position": 7,
"created_at": "2018-03-20T14:02:06-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_Navy_A.png?v=1573880385",
"variant_ids": [
7162327695396
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155866128420"
},
{
"id": 2155866259492,
"product_id": 562361892900,
"position": 8,
"created_at": "2018-03-20T14:02:09-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_Navy_B.png?v=1573880385",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155866259492"
},
{
"id": 2155866390564,
"product_id": 562361892900,
"position": 9,
"created_at": "2018-03-20T14:02:11-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_White_A.png?v=1573880385",
"variant_ids": [
7162327728164
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155866390564"
},
{
"id": 2155866554404,
"product_id": 562361892900,
"position": 10,
"created_at": "2018-03-20T14:02:13-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_White_B.png?v=1573880385",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155866554404"
}
],
"image": {
"id": 2155862786084,
"product_id": 562361892900,
"position": 1,
"created_at": "2018-03-20T14:01:48-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/American_Apparel_Flex_Fleece_Zip_Hoodie_Black_A.png?v=1573880385",
"variant_ids": [
7162327597092
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155862786084"
},
"metadata": {
"purchased_quantity": "1"
}
}
],
"metadata": {
"shopify_customer": {
"id": 589064699940,
"email": "tester2@abovemarket.com",
"accepts_marketing": false,
"created_at": "2018-06-29T21:20:34-04:00",
"updated_at": "2018-06-29T21:20:53-04:00",
"first_name": "John",
"last_name": "Erck",
"orders_count": 0,
"state": "disabled",
"total_spent": "0.00",
"last_order_id": null,
"note": null,
"verified_email": true,
"multipass_identifier": null,
"tax_exempt": false,
"phone": null,
"tags": "",
"last_order_name": null,
"currency": "USD",
"addresses": [
{
"id": 679673036836,
"customer_id": 589064699940,
"first_name": "John",
"last_name": "Erck",
"company": null,
"address1": "407 9th St. #101",
"address2": "",
"city": "Huntington Beach,",
"province": "California",
"country": "United States",
"zip": "92648",
"phone": null,
"name": "John Erck",
"province_code": "CA",
"country_code": "US",
"country_name": "United States",
"default": true
}
],
"accepts_marketing_updated_at": "2019-01-06T16:59:46-05:00",
"marketing_opt_in_level": null,
"tax_exemptions": [],
"admin_graphql_api_id": "gid://shopify/Customer/589064699940",
"default_address": {
"id": 679673036836,
"customer_id": 589064699940,
"first_name": "John",
"last_name": "Erck",
"company": null,
"address1": "407 9th St. #101",
"address2": "",
"city": "Huntington Beach,",
"province": "California",
"country": "United States",
"zip": "92648",
"phone": null,
"name": "John Erck",
"province_code": "CA",
"country_code": "US",
"country_name": "United States",
"default": true
}
}
}
}