Search products from a prompt
POST
/api/products/search
const url = 'https://example.com/api/products/search';const options = { method: 'POST', headers: { cookie: 'better-auth.session_token=<better-auth.session_token>', 'Content-Type': 'application/json' }, body: '{"prompt":"Need a battery-ready photovoltaic setup for a small office.","limit":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/products/search \ --header 'Content-Type: application/json' \ --cookie better-auth.session_token=<better-auth.session_token> \ --data '{ "prompt": "Need a battery-ready photovoltaic setup for a small office.", "limit": 1 }'Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”Prompt used for semantic product matching against embedded products.
Media type application/json
Prompt used for semantic product matching.
object
prompt
required
string
limit
integer
Responses
Section titled “ Responses ”Semantic matches from the products table with an AI summary.
Media type application/json
Semantic product matches plus an agent summary.
object
prompt
required
string
answer
required
string
products
required
Array<object>
A database product matched semantically against the prompt.
object
id
required
string
sku
required
string
name
required
string
description
required
string
similarity
required
number
Example generated
{ "prompt": "example", "answer": "example", "products": [ { "id": "example", "sku": "example", "name": "example", "description": "example", "similarity": 1 } ]}The request body could not be parsed or validated.
Media type application/json
Standard API error payload.
object
error
required
object
code
required
string
message
required
string
issues
Array<string>
Example generated
{ "error": { "code": "example", "message": "example", "issues": [ "example" ] }}No valid Better Auth session was present.
Media type application/json
Returned when no valid Better Auth session is present.
object
error
required
string
Example generated
{ "error": "example"}The server could not complete the semantic product search.
Media type application/json
Standard API error payload.
object
error
required
object
code
required
string
message
required
string
issues
Array<string>
Example generated
{ "error": { "code": "example", "message": "example", "issues": [ "example" ] }}