Serverless AI Product Suggestion
AI powered product suggestion service that recommends the most relevant products based on catalog, user searches, context, and order history.
Endpoint
Suggest relevant products for a user based on catalog, searches, context, and order history.
POSThttps://api.xtartapp.com/data/suggestion
*Authentication
You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.
Request body
Name | Type | Required | Max | Description |
---|---|---|---|---|
products | array | Yes | 1000 | Array of product objects to suggest. |
products[].id | string | Yes | 50 | The id of the product. |
products[].title | string | Yes | 100 | The title of the product. |
products[].price | number | No | - | The price of the product. |
lastSearches | array | Yes | 10 | Array of recent user search strings (max 10 items, each max 50 chars) |
lastSearches[] | string | Yes | 50 | The search string. |
context | array | No | 3 | Array of context strings (max 3 items, each max 500 chars) |
lastOrderedProducts | array | No | 10 | Array of last ordered product objects (max 10 items). Each must have id (max 50 chars), title (max 100 chars), quantity (number), price (number) |
lastOrderedProducts[].id | string | Yes | 50 | The id of the product. |
lastOrderedProducts[].title | string | Yes | 100 | The title of the product. |
lastOrderedProducts[].quantity | number | No | - | |
lastOrderedProducts[].price | number | No | - |
Response
Name | Type | Description |
---|---|---|
suggestedProducts | array | Array of suggested product objects, each with id, title, and price (optional). |
suggestedProducts[].id | string | The id of the suggested product. |
suggestedProducts[].title | string | The title of the suggested product. |
suggestedProducts[].price | number | The price of the suggested product (optional). |
total | number | The total number of suggested products. |
keywords | array | Array of keywords for customer search. |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | Occurs when the payload is invalid. |
400 | INVALID_REQUEST | Ex.: The request is invalid. |
400 | DATA_SUGGESTION_ERROR | Ex: could not suggest products | parsing error |
400 | INSUFFICIENT_BALANCE | The user has insufficient balance |
401 | UNAUTHORIZED | Ex.: The token is invalid. |
429 | TOO_MANY_REQUESTS | Ex.: The request limit has been reached. |