JavaScript
import HenrySDK from '@henrylabs/sdk';
const client = new HenrySDK({
apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted
});
const response = await client.products.search({
filters: {
type: 'text',
query: 'Air Max Shoes',
country: 'US',
price: {
min: 1,
max: 100,
currency: 'USD',
},
sortBy: 'price-low-to-high',
},
type: 'global',
limit: 40,
mode: 'async',
});
console.log(response.refId);curl --request POST \
--url https://api.henrylabs.ai/v1/product/search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"type": "global",
"filters": {
"type": "text",
"query": "Air Max Shoes",
"country": "US",
"price": {
"min": 1,
"max": 100,
"currency": "USD"
},
"sortBy": "price-low-to-high"
},
"mode": "async",
"limit": 40,
"cursor": 0
}
'import requests
url = "https://api.henrylabs.ai/v1/product/search"
payload = {
"type": "global",
"filters": {
"type": "text",
"query": "Air Max Shoes",
"country": "US",
"price": {
"min": 1,
"max": 100,
"currency": "USD"
},
"sortBy": "price-low-to-high"
},
"mode": "async",
"limit": 40,
"cursor": 0
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.henrylabs.ai/v1/product/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'global',
'filters' => [
'type' => 'text',
'query' => 'Air Max Shoes',
'country' => 'US',
'price' => [
'min' => 1,
'max' => 100,
'currency' => 'USD'
],
'sortBy' => 'price-low-to-high'
],
'mode' => 'async',
'limit' => 40,
'cursor' => 0
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.henrylabs.ai/v1/product/search"
payload := strings.NewReader("{\n \"type\": \"global\",\n \"filters\": {\n \"type\": \"text\",\n \"query\": \"Air Max Shoes\",\n \"country\": \"US\",\n \"price\": {\n \"min\": 1,\n \"max\": 100,\n \"currency\": \"USD\"\n },\n \"sortBy\": \"price-low-to-high\"\n },\n \"mode\": \"async\",\n \"limit\": 40,\n \"cursor\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.henrylabs.ai/v1/product/search")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"global\",\n \"filters\": {\n \"type\": \"text\",\n \"query\": \"Air Max Shoes\",\n \"country\": \"US\",\n \"price\": {\n \"min\": 1,\n \"max\": 100,\n \"currency\": \"USD\"\n },\n \"sortBy\": \"price-low-to-high\"\n },\n \"mode\": \"async\",\n \"limit\": 40,\n \"cursor\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.henrylabs.ai/v1/product/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"global\",\n \"filters\": {\n \"type\": \"text\",\n \"query\": \"Air Max Shoes\",\n \"country\": \"US\",\n \"price\": {\n \"min\": 1,\n \"max\": 100,\n \"currency\": \"USD\"\n },\n \"sortBy\": \"price-low-to-high\"\n },\n \"mode\": \"async\",\n \"limit\": 40,\n \"cursor\": 0\n}"
response = http.request(request)
puts response.read_body{
"refId": "<string>",
"result": {
"products": [
{
"link": "<string>",
"merchant": "<string>",
"host": "<string>",
"name": "<string>",
"sku": "<string>",
"description": "<string>",
"images": [
{
"url": "<string>",
"isFeatured": true
}
],
"price": {
"value": 123
},
"originalPrice": {
"value": 123
},
"options": {
"status": "<string>",
"values": [
{
"value": "<string>",
"label": "<string>",
"images": [
{
"url": "<string>",
"isFeatured": true
}
],
"link": "<string>",
"nextOption": "<unknown>"
}
],
"label": "<string>"
},
"reviews": {
"rating": 123,
"count": 0,
"histogram": [
{
"stars": 0,
"count": 0
}
],
"criticRatings": [
{
"name": "<string>",
"rating": "<string>",
"link": "<string>"
}
],
"userReviews": [
{
"text": "<string>",
"title": "<string>",
"author": "<string>",
"rating": 123,
"date": "<string>",
"source": "<string>",
"images": [
"<string>"
]
}
],
"insights": [
{
"title": "<string>",
"snippets": [
"<string>"
]
}
]
}
}
],
"pagination": {
"nextCursor": 123,
"previousCursor": 123
}
},
"error": {}
}{
"success": true,
"status": "<string>",
"message": "<string>"
}{
"success": true,
"status": "<string>",
"message": "<string>"
}Product
Product Search
Search for products by text query or image input. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.
POST
/
product
/
search
JavaScript
import HenrySDK from '@henrylabs/sdk';
const client = new HenrySDK({
apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted
});
const response = await client.products.search({
filters: {
type: 'text',
query: 'Air Max Shoes',
country: 'US',
price: {
min: 1,
max: 100,
currency: 'USD',
},
sortBy: 'price-low-to-high',
},
type: 'global',
limit: 40,
mode: 'async',
});
console.log(response.refId);curl --request POST \
--url https://api.henrylabs.ai/v1/product/search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"type": "global",
"filters": {
"type": "text",
"query": "Air Max Shoes",
"country": "US",
"price": {
"min": 1,
"max": 100,
"currency": "USD"
},
"sortBy": "price-low-to-high"
},
"mode": "async",
"limit": 40,
"cursor": 0
}
'import requests
url = "https://api.henrylabs.ai/v1/product/search"
payload = {
"type": "global",
"filters": {
"type": "text",
"query": "Air Max Shoes",
"country": "US",
"price": {
"min": 1,
"max": 100,
"currency": "USD"
},
"sortBy": "price-low-to-high"
},
"mode": "async",
"limit": 40,
"cursor": 0
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.henrylabs.ai/v1/product/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'global',
'filters' => [
'type' => 'text',
'query' => 'Air Max Shoes',
'country' => 'US',
'price' => [
'min' => 1,
'max' => 100,
'currency' => 'USD'
],
'sortBy' => 'price-low-to-high'
],
'mode' => 'async',
'limit' => 40,
'cursor' => 0
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.henrylabs.ai/v1/product/search"
payload := strings.NewReader("{\n \"type\": \"global\",\n \"filters\": {\n \"type\": \"text\",\n \"query\": \"Air Max Shoes\",\n \"country\": \"US\",\n \"price\": {\n \"min\": 1,\n \"max\": 100,\n \"currency\": \"USD\"\n },\n \"sortBy\": \"price-low-to-high\"\n },\n \"mode\": \"async\",\n \"limit\": 40,\n \"cursor\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.henrylabs.ai/v1/product/search")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"global\",\n \"filters\": {\n \"type\": \"text\",\n \"query\": \"Air Max Shoes\",\n \"country\": \"US\",\n \"price\": {\n \"min\": 1,\n \"max\": 100,\n \"currency\": \"USD\"\n },\n \"sortBy\": \"price-low-to-high\"\n },\n \"mode\": \"async\",\n \"limit\": 40,\n \"cursor\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.henrylabs.ai/v1/product/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"global\",\n \"filters\": {\n \"type\": \"text\",\n \"query\": \"Air Max Shoes\",\n \"country\": \"US\",\n \"price\": {\n \"min\": 1,\n \"max\": 100,\n \"currency\": \"USD\"\n },\n \"sortBy\": \"price-low-to-high\"\n },\n \"mode\": \"async\",\n \"limit\": 40,\n \"cursor\": 0\n}"
response = http.request(request)
puts response.read_body{
"refId": "<string>",
"result": {
"products": [
{
"link": "<string>",
"merchant": "<string>",
"host": "<string>",
"name": "<string>",
"sku": "<string>",
"description": "<string>",
"images": [
{
"url": "<string>",
"isFeatured": true
}
],
"price": {
"value": 123
},
"originalPrice": {
"value": 123
},
"options": {
"status": "<string>",
"values": [
{
"value": "<string>",
"label": "<string>",
"images": [
{
"url": "<string>",
"isFeatured": true
}
],
"link": "<string>",
"nextOption": "<unknown>"
}
],
"label": "<string>"
},
"reviews": {
"rating": 123,
"count": 0,
"histogram": [
{
"stars": 0,
"count": 0
}
],
"criticRatings": [
{
"name": "<string>",
"rating": "<string>",
"link": "<string>"
}
],
"userReviews": [
{
"text": "<string>",
"title": "<string>",
"author": "<string>",
"rating": 123,
"date": "<string>",
"source": "<string>",
"images": [
"<string>"
]
}
],
"insights": [
{
"title": "<string>",
"snippets": [
"<string>"
]
}
]
}
}
],
"pagination": {
"nextCursor": 123,
"previousCursor": 123
}
},
"error": {}
}{
"success": true,
"status": "<string>",
"message": "<string>"
}{
"success": true,
"status": "<string>",
"message": "<string>"
}Authorizations
Body
application/json
- Option 1
- Option 2
Allowed value:
"global"- Option 1
- Option 2
Show child attributes
Show child attributes
Available options:
async, sync Limit the number of results
Required range:
1 <= x <= 100Example:
20
Cursor returned from the previous response
Required range:
0 <= x <= 9007199254740991Example:
0
When true, bypass any cached response and force a fresh search. Fresh results still repopulate the cache. Applies to both text and image searches.
Example:
false
Response
Product search queued successfully, use refId to check status and retrieve results
Was this page helpful?
⌘I