list-buy-it-again-items
Method: GET
Path: /orders/buy-it-again
Tags: Orders
Summary
Retrieve buy-it-again items
Description
Lists items previously purchased by the authenticated user across paid orders (excludes orders with payment_status of pending or failed). Results are deduplicated by product_id, returning the most recent purchase for each product. Use this to power a "Buy it again" carousel on storefronts.
Storefront SDK Usage
SDK Method: sdk.order.listBuyItAgainItems()
Example:
// Basic usage
const { data, error } = await sdk.order.listBuyItAgainItems();
// With pagination and marketplace seller filtering
const { data, error } = await sdk.order.listBuyItAgainItems({
page: 1,
limit: 20,
seller_id: "seller_a,seller_b"
});
if (error) {
console.error("Failed to list buy-it-again items:", error.message);
} else {
console.log("Items found:", data.items.length);
console.log("Pagination:", data.pagination);
data.items.forEach(item => {
console.log(`${item.product_name} (${item.product_id})`);
console.log("Variant:", item.variant_name);
console.log("Selling price:", item.selling_price);
});
}TypeScript Definition
"list-buy-it-again-items": {
parameters: {
query?: {
/** @description Page number, starting at 1. Non-integer values and values below 1 return 400. */
page?: components["parameters"]["pageParam"];
/** @description Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400. */
limit?: components["parameters"]["pageLimitParam"];
/** @description Filter items by one or more seller IDs. Accepts a comma-separated list (e.g. `seller_a,seller_b`). Relevant for marketplace stores. */
seller_id?: string;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
content: {
items: components["schemas"]["BuyOrderItemAgain"][];
pagination: components["schemas"]["Pagination"];
};
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["parameters"]["pageParam"] | pageParam |
components["parameters"]["pageLimitParam"] | pageLimitParam |
components["schemas"]["BuyOrderItemAgain"] | BuyOrderItemAgain |
components["schemas"]["Pagination"] | Pagination |
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Parameters
- page (query): Page number, starting at 1. Non-integer values and values below 1 return 400.
- limit (query): Results per page. Values outside 1–100 are clamped to that range. Non-integer input returns 400.
- seller_id (query): Filter items by one or more seller IDs. Accepts a comma-separated list (e.g.
seller_a,seller_b). Relevant for marketplace stores.
Responses
200
OK
400
Bad request
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
{
"tags": [
"Orders"
],
"operationId": "list-buy-it-again-items",
"summary": "Retrieve buy-it-again items",
"description": "Lists items previously purchased by the authenticated user across paid orders (excludes orders with `payment_status` of `pending` or `failed`). Results are deduplicated by `product_id`, returning the most recent purchase for each product. Use this to power a \"Buy it again\" carousel on storefronts.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/list-buy-it-again-items",
"description": "API reference for the list-buy-it-again-items operation"
},
"parameters": [
{
"$ref": "#/components/parameters/pageParam"
},
{
"$ref": "#/components/parameters/pageLimitParam"
},
{
"name": "seller_id",
"in": "query",
"description": "Filter items by one or more seller IDs. Accepts a comma-separated list (e.g. `seller_a,seller_b`). Relevant for marketplace stores.",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success",
"content"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
},
"content": {
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BuyOrderItemAgain"
}
},
"pagination": {
"$ref": "#/components/schemas/Pagination"
}
},
"required": [
"items",
"pagination"
],
"type": "object"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "orders",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "listBuyItAgainItems"
}Auto-generated from OpenAPI spec and TypeScript definitions