Learn how to use the Product Search API with location hints and image search
All API requests require authentication using an API key. Include your API key in the request header:
X-API-KEY: your-api-key-hereYou can create and manage API keys from your dashboard.
The Product Search API allows you to search for products. The endpoint accepts a search query and optional parameters to customize your results.
POST https://productapi.dev/api?search=your+search+query
Headers:
X-API-KEY: your-api-key-hereThe location-hint parameter allows you to bias search results toward products available in a specific country.
POST https://productapi.dev/api?search=laptop&location-hint=us
Headers:
X-API-KEY: your-api-key-hereThe location-hint parameter accepts any valid two-letter ISO 3166-1 alpha-2 country code. Supported countries include:
The API accepts all standard ISO country codes. Invalid codes will return a 400 error.
The response_language parameter allows you to specify the language in which product information (name, description, brand) should be returned. This ensures that all product details are provided in your preferred language. If not provided, the response will guess based on the search query.
POST https://productapi.dev/api?search=laptop&response_language=fr
Headers:
X-API-KEY: your-api-key-hereThe response_language parameter accepts valid two-letter ISO 639-1 language codes. Supported languages include:
Invalid language codes will return a 400 error.
The with_image parameter controls whether product results include image URLs. When enabled, the API performs additional image searches for each product and includes the image URL in the response.
with_image=true to include imageswith_image is false or omitted, products won't include image URLslocation-hint if providedwith_image settingPOST https://productapi.dev/api?search=wireless+headphones&with_image=true
Headers:
X-API-KEY: your-api-key-hereResponse includes image URLs:
{
"search": "wireless headphones",
"products": [
{
"name": "Sony WH-1000XM5",
"description": "Premium noise-cancelling wireless headphones",
"brand": "Sony",
"image": "https://example.com/sony-headphones.jpg"
}
],
"creditsUsed": 1,
"creditsRemaining": 49
}POST https://productapi.dev/api?search=wireless+headphones
Headers:
X-API-KEY: your-api-key-hereResponse without image URLs:
{
"search": "wireless headphones",
"products": [
{
"name": "Sony WH-1000XM5",
"description": "Premium noise-cancelling wireless headphones",
"brand": "Sony"
}
],
"creditsUsed": 1,
"creditsRemaining": 49
}The custom_data_schema parameter allows you to define additional structured data fields that should be included in each product result. This is sent in the request body as a JSON schema, and the api will respond with a custom_data field for each product according to your schema.
custom_data_schemacustom_data fieldPOST https://productapi.dev/api?search=wireless+headphones
Headers:
X-API-KEY: your-api-key-here
Content-Type: application/json
Body:
{
"custom_data_schema": {
"type": "object",
"properties": {
"price_range": { "type": "string" },
"availability": { "type": "string" },
"rating": { "type": "number" }
},
"required": ["price_range", "availability"]
}
}{
"search": "wireless headphones",
"products": [
{
"name": "Sony WH-1000XM5",
"description": "Premium noise-cancelling wireless headphones",
"brand": "Sony",
"custom_data": {
"price_range": "$300-$400",
"availability": "In Stock",
"rating": 4.8
}
}
],
"creditsUsed": 1,
"creditsRemaining": 49
}POST https://productapi.dev/api?search=laptop
Headers:
X-API-KEY: your-api-key-here
Content-Type: application/json
Body:
{
"custom_data_schema": {
"type": "object",
"properties": {
"price": {
"type": "object",
"properties": {
"min": { "type": "number" },
"max": { "type": "number" },
"currency": { "type": "string" }
},
"required": ["min", "max", "currency"]
},
"specifications": {
"type": "object",
"properties": {
"ram": { "type": "string" },
"storage": { "type": "string" },
"processor": { "type": "string" }
}
},
"in_stock": { "type": "boolean" }
},
"required": ["price", "in_stock"]
}
}You can combine all parameters to get location-specific products with images in your preferred language and custom data fields:
POST https://productapi.dev/api?search=smartphone&location-hint=jp&with_image=true&response_language=fr
Headers:
X-API-KEY: your-api-key-hereThis will return products preferred for Japan with image URLs included, all in French.
POST https://productapi.dev/api?search=smartphone&location-hint=jp&with_image=true&response_language=fr
Headers:
X-API-KEY: your-api-key-here
Content-Type: application/json
Body:
{
"custom_data_schema": {
"type": "object",
"properties": {
"price_range": { "type": "string" },
"availability": { "type": "string" }
},
"required": ["price_range"]
}
}This will return products preferred for Japan with image URLs included, all in French, with custom data fields populated according to your schema.
{
"search": "wireless headphones",
"products": [
{
"name": "Sony WH-1000XM5",
"description": "Premium noise-cancelling wireless headphones",
"brand": "Sony",
"image": "https://example.com/sony-headphones.jpg"
}
],
"creditsUsed": 1,
"creditsRemaining": 49
}400 Bad Request - Missing search parameter:
{
"error": "Missing required query parameter: 'search'"
}400 Bad Request - Invalid location-hint:
{
"error": "Invalid location-hint parameter: 'invalid'. Must be a valid two-letter country code."
}400 Bad Request - Invalid response_language:
{
"error": "Invalid response_language parameter: 'invalid'. Must be a valid two-letter language code."
}400 Bad Request - Invalid custom_data_schema:
{
"error": "Invalid custom_data_schema: /properties: must be object"
}400 Bad Request - Invalid JSON in request body:
{
"error": "Invalid JSON in request body"
}401 Unauthorized - Missing API key:
{
"error": "Unauthorized. Please provide a valid API key."
}401 Unauthorized - Invalid API key:
{
"error": "Invalid API key."
}402 Payment Required - Insufficient credits:
{
"error": "Insufficient credits",
"creditsRequired": 1,
"creditsAvailable": 0
}404 Not Found - No products found:
{
"error": "No products found"
}const response = await fetch(
'https://productapi.dev/api?search=laptop&location-hint=us&with_image=true&response_language=en',
{
method: 'POST',
headers: {
'X-API-KEY': 'your-api-key-here'
}
}
);
const data = await response.json();
console.log(data);const response = await fetch(
'https://productapi.dev/api?search=laptop&location-hint=us&with_image=true&response_language=en',
{
method: 'POST',
headers: {
'X-API-KEY': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
custom_data_schema: {
type: 'object',
properties: {
price_range: { type: 'string' },
availability: { type: 'string' }
},
required: ['price_range']
}
})
}
);
const data = await response.json();
console.log(data);import requests
url = 'https://productapi.dev/api'
params = {
'search': 'laptop',
'location-hint': 'us',
'with_image': 'true',
'response_language': 'en'
}
headers = {
'X-API-KEY': 'your-api-key-here'
}
response = requests.post(url, params=params, headers=headers)
data = response.json()
print(data)import requests
url = 'https://productapi.dev/api'
params = {
'search': 'laptop',
'location-hint': 'us',
'with_image': 'true',
'response_language': 'en'
}
headers = {
'X-API-KEY': 'your-api-key-here',
'Content-Type': 'application/json'
}
body = {
'custom_data_schema': {
'type': 'object',
'properties': {
'price_range': {'type': 'string'},
'availability': {'type': 'string'}
},
'required': ['price_range']
}
}
response = requests.post(url, params=params, headers=headers, json=body)
data = response.json()
print(data)curl -X POST \
"https://productapi.dev/api?search=laptop&location-hint=us&with_image=true&response_language=en" \
-H "X-API-KEY: your-api-key-here"curl -X POST \
"https://productapi.dev/api?search=laptop&location-hint=us&with_image=true&response_language=en" \
-H "X-API-KEY: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"custom_data_schema": {
"type": "object",
"properties": {
"price_range": {"type": "string"},
"availability": {"type": "string"}
},
"required": ["price_range"]
}
}'Need help? Visit your dashboard to manage API keys and credits.