Get Wishlist Items
Retrieve all items from the customer's wishlist
Get Wishlist Items
Retrieve all items from the customer's wishlist. This endpoint returns wishlist items associated with the current session or authenticated customer.
Endpoint
GET /v1/wishlist
Base URL: https://api.storekit.app
Authentication
Info: All API requests require authentication using an API key. Generate your API key from the StoreKit Dashboard under API Key Usage section.
Headers
Name | Type | Required | Description |
---|---|---|---|
x-api-key | string | Yes | Your API key for authentication |
Response
Success Response (200 OK)
Returns a list of wishlist items with metadata:
{
"success": true,
"data": [
{
"id": "cmcqc7h5l000zp92bz94zgl7v",
"addedAt": "2025-07-05T14:27:02.938Z",
"customerId": null,
"productId": "cmc36x85s0007nx0koog2cn0b",
"sessionId": "c1ed0749-1ef9-47e7-a762-6f0102da0759"
},
{
"id": "cmcqh1atn0003nu2brsr9bszz",
"addedAt": "2025-07-05T16:42:12.876Z",
"customerId": null,
"productId": "cmc3795t2000bnx0kqrt5x371",
"sessionId": "c1ed0749-1ef9-47e7-a762-6f0102da0759"
}
],
"count": 2,
"message": "list of all wishlist items"
}
Response Schema
Field | Type | Description |
---|---|---|
success | boolean | Indicates if the request was successful |
data | array | Array of wishlist item objects |
count | number | Total number of items in the wishlist |
message | string | Descriptive message about the operation |
Wishlist Item Object
Field | Type | Description |
---|---|---|
id | string | Unique identifier for the wishlist item |
addedAt | string | ISO 8601 timestamp when item was added |
customerId | string | null | Customer ID if authenticated, null for guest sessions |
productId | string | ID of the product in the wishlist |
sessionId | string | Session identifier for guest users |
Error Responses
401 Unauthorized
{
"success": false,
"message": "Invalid or missing API key"
}
422 Unprocessable Entity
{
"success": false,
"message": "Invalid input data"
}
500 Internal Server Error
{
"success": false,
"message": "Failed to get all items from wishlist"
}
Code Examples
curl -X GET "https://api.storekit.app/v1/wishlist" \
-H "x-api-key: sk_live_be186797384f05ff038e1751e8ff9572cf8a05adfdba79abb7e8bcd165f2c402"
const response = await fetch("https://api.storekit.app/v1/wishlist", {
method: "GET",
headers: {
"x-api-key":
"sk_live_be186797384f05ff038e1751e8ff9572cf8a05adfdba79abb7e8bcd165f2c402",
},
});
const data = await response.json();
if (data.success) {
console.log(`Found ${data.count} items in wishlist:`, data.data);
} else {
console.error("Error:", data.message);
}
import axios from "axios";
try {
const response = await axios.get("https://api.storekit.app/v1/wishlist", {
headers: {
"x-api-key":
"sk_live_be186797384f05ff038e1751e8ff9572cf8a05adfdba79abb7e8bcd165f2c402",
},
});
const { success, data, count, message } = response.data;
if (success) {
console.log(`Found ${count} items in wishlist:`, data);
} else {
console.error("Error:", message);
}
} catch (error) {
console.error("Request failed:", error.response?.data || error.message);
}
const https = require("https");
const options = {
hostname: "api.storekit.app",
port: 443,
path: "/v1/wishlist",
method: "GET",
headers: {
"x-api-key":
"sk_live_be186797384f05ff038e1751e8ff9572cf8a05adfdba79abb7e8bcd165f2c402",
},
};
const req = https.request(options, (res) => {
let data = "";
res.on("data", (chunk) => {
data += chunk;
});
res.on("end", () => {
const result = JSON.parse(data);
if (result.success) {
console.log(`Found ${result.count} items in wishlist:`, result.data);
} else {
console.error("Error:", result.message);
}
});
});
req.on("error", (error) => {
console.error("Request failed:", error);
});
req.end();
Python
import requests
import json
url = "https://api.storekit.app/v1/wishlist"
headers = {
"x-api-key": "sk_live_be186797384f05ff038e1751e8ff9572cf8a05adfdba79abb7e8bcd165f2c402"
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
data = response.json()
if data['success']:
print(f"Found {data['count']} items in wishlist:")
for item in data['data']:
print(f"- Product ID: {item['productId']} (Added: {item['addedAt']})")
else:
print(f"Error: {data['message']}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.storekit.app/v1/wishlist",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"x-api-key: sk_live_be186797384f05ff038e1751e8ff9572cf8a05adfdba79abb7e8bcd165f2c402"
],
]);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
$data = json_decode($response, true);
if ($httpCode === 200 && $data['success']) {
echo "Found " . $data['count'] . " items in wishlist:\n";
foreach ($data['data'] as $item) {
echo "- Product ID: " . $item['productId'] . " (Added: " . $item['addedAt'] . ")\n";
}
} else {
echo "Error: " . $data['message'] . "\n";
}
?>
$.ajax({
url: "https://api.storekit.app/v1/wishlist",
method: "GET",
headers: {
"x-api-key":
"sk_live_be186797384f05ff038e1751e8ff9572cf8a05adfdba79abb7e8bcd165f2c402",
},
success: function (data) {
if (data.success) {
console.log(`Found ${data.count} items in wishlist:`, data.data);
// Example: Display in UI
$("#wishlist-count").text(data.count);
$("#wishlist-items").empty();
data.data.forEach(function (item) {
$("#wishlist-items").append(`
<div class="wishlist-item" data-id="${item.id}">
<span>Product: ${item.productId}</span>
<span>Added: ${new Date(item.addedAt).toLocaleDateString()}</span>
</div>
`);
});
} else {
console.error("Error:", data.message);
}
},
error: function (xhr, status, error) {
console.error("Request failed:", error);
},
});
Authentication & Session Management
This endpoint automatically handles both authenticated and anonymous users:
- Authenticated users: Products are associated with their customer account
- Anonymous users: Products are tracked using session cookies that are automatically managed
No manual session management is required - the API handles this automatically through cookies.
Important Notes
- Session data is automatically managed through cookies
- API key is required for all requests and can be generated in your StoreKit Dashboard
Customer Context
Info: This endpoint uses customer identification middleware that tracks items by:
- Authenticated users: Items are associated with their
customerId
- Guest users: Items are tracked by
sessionId
for the current browser session automatically
Use Cases
Quick Start
Step 1: Get your API Key
Navigate to your StoreKit Dashboard and go to the API Key Usage section to generate your API key.
Step 2: Make the request
Use any of the code examples above to fetch the wishlist items. The API will automatically identify the customer based on their session.
Step 3: Handle the response
Check the success
field and use the data
array to display wishlist items.