Search
curl --request POST \
--url https://api.neuronsearchlab.com/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "waterproof shoes",
"user_id": "user-123",
"context_id": 101,
"limit": "10",
"filter": [
"category:footwear"
]
}
'import requests
url = "https://api.neuronsearchlab.com/v1/search"
payload = {
"query": "waterproof shoes",
"user_id": "user-123",
"context_id": 101,
"limit": "10",
"filter": ["category:footwear"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'waterproof shoes',
user_id: 'user-123',
context_id: 101,
limit: '10',
filter: ['category:footwear']
})
};
fetch('https://api.neuronsearchlab.com/v1/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.neuronsearchlab.com/v1/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([
'query' => 'waterproof shoes',
'user_id' => 'user-123',
'context_id' => 101,
'limit' => '10',
'filter' => [
'category:footwear'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.neuronsearchlab.com/v1/search"
payload := strings.NewReader("{\n \"query\": \"waterproof shoes\",\n \"user_id\": \"user-123\",\n \"context_id\": 101,\n \"limit\": \"10\",\n \"filter\": [\n \"category:footwear\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.neuronsearchlab.com/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"waterproof shoes\",\n \"user_id\": \"user-123\",\n \"context_id\": 101,\n \"limit\": \"10\",\n \"filter\": [\n \"category:footwear\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neuronsearchlab.com/v1/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"waterproof shoes\",\n \"user_id\": \"user-123\",\n \"context_id\": 101,\n \"limit\": \"10\",\n \"filter\": [\n \"category:footwear\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "/v1/recommendations",
"data": [
{
"id": 3187,
"object": "recommendation",
"item_id": 3187,
"rank": 1,
"score": 0.94,
"item": {
"id": 3187,
"object": "item",
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme",
"price": 10999,
"currency": "usd"
}
},
"entity_id": 3187,
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme",
"price": 10999,
"currency": "usd"
},
"source": "model",
"explanation": {
"item_id": 2,
"rank": 123,
"summary": "<string>",
"shown_because": [
"<string>"
],
"source": "<string>",
"score": {
"final": 123,
"base": 123,
"cosine_distance": 123,
"retrieval": 123,
"ranker": 123
},
"context": {
"context_id": 2,
"mode": "single",
"filters": [
{}
],
"request_filters": [
{
"column": "<string>",
"operator": "<string>",
"value": "<string>",
"logic": "AND"
}
],
"group_by": [
"<string>"
],
"exclude_viewed_items": {
"value": 123,
"unit": "<string>",
"interval": "<string>"
},
"auto_section": {
"section_id": "<string>",
"title": "<string>",
"subtitle": "<string>",
"reason": {}
}
},
"embedding": {},
"pipeline": {
"id": 123,
"stages": [
{
"stage": "<string>",
"enabled": true,
"status": "<string>",
"pipeline_id": 123,
"config": {},
"note": "<string>",
"item_events": [
{}
]
}
]
},
"rules": [
{}
],
"experiments": [
{
"experiment_id": 123,
"experiment_name": "<string>",
"variant_id": 123,
"variant_name": "<string>"
}
],
"user_segments": [
"<string>"
]
}
}
],
"recommendations": [
{
"id": 3187,
"object": "recommendation",
"item_id": 3187,
"rank": 1,
"score": 0.94,
"item": {
"id": 3187,
"object": "item",
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme",
"price": 10999,
"currency": "usd"
}
},
"entity_id": 3187,
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme",
"price": 10999,
"currency": "usd"
},
"source": "model",
"explanation": {
"item_id": 2,
"rank": 123,
"summary": "<string>",
"shown_because": [
"<string>"
],
"source": "<string>",
"score": {
"final": 123,
"base": 123,
"cosine_distance": 123,
"retrieval": 123,
"ranker": 123
},
"context": {
"context_id": 2,
"mode": "single",
"filters": [
{}
],
"request_filters": [
{
"column": "<string>",
"operator": "<string>",
"value": "<string>",
"logic": "AND"
}
],
"group_by": [
"<string>"
],
"exclude_viewed_items": {
"value": 123,
"unit": "<string>",
"interval": "<string>"
},
"auto_section": {
"section_id": "<string>",
"title": "<string>",
"subtitle": "<string>",
"reason": {}
}
},
"embedding": {},
"pipeline": {
"id": 123,
"stages": [
{
"stage": "<string>",
"enabled": true,
"status": "<string>",
"pipeline_id": 123,
"config": {},
"note": "<string>",
"item_events": [
{}
]
}
]
},
"rules": [
{}
],
"experiments": [
{
"experiment_id": 123,
"experiment_name": "<string>",
"variant_id": 123,
"variant_name": "<string>"
}
],
"user_segments": [
"<string>"
]
}
}
],
"has_more": true,
"next_cursor": "<string>",
"limit": 50,
"quantity": 1,
"processing_time_ms": 1,
"mode": "single",
"message": "Recommendations fetched",
"embedding_info": {
"source": "db",
"used_default": true,
"default_reason": "<string>",
"dimension": 1,
"expected_dimension": 64
},
"cold_start_fallback_used": true,
"explanation": {
"scope": "request",
"note": "<string>",
"context": {
"context_id": 2,
"mode": "single",
"filters": [
{}
],
"request_filters": [
{
"column": "<string>",
"operator": "<string>",
"value": "<string>",
"logic": "AND"
}
],
"group_by": [
"<string>"
],
"exclude_viewed_items": {
"value": 123,
"unit": "<string>",
"interval": "<string>"
},
"auto_section": {
"section_id": "<string>",
"title": "<string>",
"subtitle": "<string>",
"reason": {}
}
},
"pipeline": {
"id": 123,
"stages": [
{
"stage": "<string>",
"enabled": true,
"status": "<string>",
"pipeline_id": 123,
"config": {},
"note": "<string>",
"item_events": [
{}
]
}
]
},
"experiments": [
{
"experiment_id": 123,
"experiment_name": "<string>",
"variant_id": 123,
"variant_name": "<string>"
}
],
"user_segments": [
"<string>"
],
"embedding": {
"source": "db",
"used_default": true,
"default_reason": "<string>",
"dimension": 1,
"expected_dimension": 64
}
},
"excluded_viewed_items": {
"value": 123,
"unit": "<string>",
"interval": "<string>"
},
"section": {
"section_id": "<string>",
"title": "<string>",
"subtitle": "<string>",
"reason": {}
},
"done": true,
"experiments": [
{
"experiment_id": 123,
"experiment_name": "<string>",
"variant_id": 123,
"variant_name": "<string>"
}
],
"user_segments": [
"<string>"
],
"pipeline_id": 123,
"search_intent": {
"share": 0.29,
"queries": [
{
"query": "waterproof trail shoes",
"count": 2,
"event_weight": 25,
"share": 0.21,
"last_searched_at": "2023-11-07T05:31:56Z"
}
],
"candidates_added": 3,
"candidates_rescored": 24
}
}Search
Search
Run query-driven retrieval through the Core API.
POST
/
v1
/
search
Search
curl --request POST \
--url https://api.neuronsearchlab.com/v1/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "waterproof shoes",
"user_id": "user-123",
"context_id": 101,
"limit": "10",
"filter": [
"category:footwear"
]
}
'import requests
url = "https://api.neuronsearchlab.com/v1/search"
payload = {
"query": "waterproof shoes",
"user_id": "user-123",
"context_id": 101,
"limit": "10",
"filter": ["category:footwear"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'waterproof shoes',
user_id: 'user-123',
context_id: 101,
limit: '10',
filter: ['category:footwear']
})
};
fetch('https://api.neuronsearchlab.com/v1/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.neuronsearchlab.com/v1/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([
'query' => 'waterproof shoes',
'user_id' => 'user-123',
'context_id' => 101,
'limit' => '10',
'filter' => [
'category:footwear'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.neuronsearchlab.com/v1/search"
payload := strings.NewReader("{\n \"query\": \"waterproof shoes\",\n \"user_id\": \"user-123\",\n \"context_id\": 101,\n \"limit\": \"10\",\n \"filter\": [\n \"category:footwear\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.neuronsearchlab.com/v1/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"waterproof shoes\",\n \"user_id\": \"user-123\",\n \"context_id\": 101,\n \"limit\": \"10\",\n \"filter\": [\n \"category:footwear\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neuronsearchlab.com/v1/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"waterproof shoes\",\n \"user_id\": \"user-123\",\n \"context_id\": 101,\n \"limit\": \"10\",\n \"filter\": [\n \"category:footwear\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "/v1/recommendations",
"data": [
{
"id": 3187,
"object": "recommendation",
"item_id": 3187,
"rank": 1,
"score": 0.94,
"item": {
"id": 3187,
"object": "item",
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme",
"price": 10999,
"currency": "usd"
}
},
"entity_id": 3187,
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme",
"price": 10999,
"currency": "usd"
},
"source": "model",
"explanation": {
"item_id": 2,
"rank": 123,
"summary": "<string>",
"shown_because": [
"<string>"
],
"source": "<string>",
"score": {
"final": 123,
"base": 123,
"cosine_distance": 123,
"retrieval": 123,
"ranker": 123
},
"context": {
"context_id": 2,
"mode": "single",
"filters": [
{}
],
"request_filters": [
{
"column": "<string>",
"operator": "<string>",
"value": "<string>",
"logic": "AND"
}
],
"group_by": [
"<string>"
],
"exclude_viewed_items": {
"value": 123,
"unit": "<string>",
"interval": "<string>"
},
"auto_section": {
"section_id": "<string>",
"title": "<string>",
"subtitle": "<string>",
"reason": {}
}
},
"embedding": {},
"pipeline": {
"id": 123,
"stages": [
{
"stage": "<string>",
"enabled": true,
"status": "<string>",
"pipeline_id": 123,
"config": {},
"note": "<string>",
"item_events": [
{}
]
}
]
},
"rules": [
{}
],
"experiments": [
{
"experiment_id": 123,
"experiment_name": "<string>",
"variant_id": 123,
"variant_name": "<string>"
}
],
"user_segments": [
"<string>"
]
}
}
],
"recommendations": [
{
"id": 3187,
"object": "recommendation",
"item_id": 3187,
"rank": 1,
"score": 0.94,
"item": {
"id": 3187,
"object": "item",
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme",
"price": 10999,
"currency": "usd"
}
},
"entity_id": 3187,
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme",
"price": 10999,
"currency": "usd"
},
"source": "model",
"explanation": {
"item_id": 2,
"rank": 123,
"summary": "<string>",
"shown_because": [
"<string>"
],
"source": "<string>",
"score": {
"final": 123,
"base": 123,
"cosine_distance": 123,
"retrieval": 123,
"ranker": 123
},
"context": {
"context_id": 2,
"mode": "single",
"filters": [
{}
],
"request_filters": [
{
"column": "<string>",
"operator": "<string>",
"value": "<string>",
"logic": "AND"
}
],
"group_by": [
"<string>"
],
"exclude_viewed_items": {
"value": 123,
"unit": "<string>",
"interval": "<string>"
},
"auto_section": {
"section_id": "<string>",
"title": "<string>",
"subtitle": "<string>",
"reason": {}
}
},
"embedding": {},
"pipeline": {
"id": 123,
"stages": [
{
"stage": "<string>",
"enabled": true,
"status": "<string>",
"pipeline_id": 123,
"config": {},
"note": "<string>",
"item_events": [
{}
]
}
]
},
"rules": [
{}
],
"experiments": [
{
"experiment_id": 123,
"experiment_name": "<string>",
"variant_id": 123,
"variant_name": "<string>"
}
],
"user_segments": [
"<string>"
]
}
}
],
"has_more": true,
"next_cursor": "<string>",
"limit": 50,
"quantity": 1,
"processing_time_ms": 1,
"mode": "single",
"message": "Recommendations fetched",
"embedding_info": {
"source": "db",
"used_default": true,
"default_reason": "<string>",
"dimension": 1,
"expected_dimension": 64
},
"cold_start_fallback_used": true,
"explanation": {
"scope": "request",
"note": "<string>",
"context": {
"context_id": 2,
"mode": "single",
"filters": [
{}
],
"request_filters": [
{
"column": "<string>",
"operator": "<string>",
"value": "<string>",
"logic": "AND"
}
],
"group_by": [
"<string>"
],
"exclude_viewed_items": {
"value": 123,
"unit": "<string>",
"interval": "<string>"
},
"auto_section": {
"section_id": "<string>",
"title": "<string>",
"subtitle": "<string>",
"reason": {}
}
},
"pipeline": {
"id": 123,
"stages": [
{
"stage": "<string>",
"enabled": true,
"status": "<string>",
"pipeline_id": 123,
"config": {},
"note": "<string>",
"item_events": [
{}
]
}
]
},
"experiments": [
{
"experiment_id": 123,
"experiment_name": "<string>",
"variant_id": 123,
"variant_name": "<string>"
}
],
"user_segments": [
"<string>"
],
"embedding": {
"source": "db",
"used_default": true,
"default_reason": "<string>",
"dimension": 1,
"expected_dimension": 64
}
},
"excluded_viewed_items": {
"value": 123,
"unit": "<string>",
"interval": "<string>"
},
"section": {
"section_id": "<string>",
"title": "<string>",
"subtitle": "<string>",
"reason": {}
},
"done": true,
"experiments": [
{
"experiment_id": 123,
"experiment_name": "<string>",
"variant_id": 123,
"variant_name": "<string>"
}
],
"user_segments": [
"<string>"
],
"pipeline_id": 123,
"search_intent": {
"share": 0.29,
"queries": [
{
"query": "waterproof trail shoes",
"count": 2,
"event_weight": 25,
"share": 0.21,
"last_searched_at": "2023-11-07T05:31:56Z"
}
],
"candidates_added": 3,
"candidates_rescored": 24
}
}Search the catalogue using a free-text query and optional context. This is application search; the Platform API’s console search serves a different purpose.
{
"query": "waterproof trail shoes",
"user_id": "user-123",
"context_id": 101,
"limit": "10",
"filter": ["category:footwear"]
}
Search and behaviour
When you supply a user or anonymous ID, the request also records a search event. Result items are impressions, not clicks. Record the user’s actual engagement separately with the response’srequest_id.
If your own engine ran the search, include its NSL integer result_item_ids. NSL records those results and returns complementary recommendations that exclude the supplied items. search.source identifies whether the search originated in NSL or your application, and search.event_recorded indicates whether it was attached to a user.
Read data for results; recommendations is a compatibility alias. Preserve explicit attribution when displaying multiple lists or sharing an SDK instance between visitors. See Search for retrieval controls and Events for search signals.Authorizations
Body
application/json
Response
Ranked results with request attribution
Was this page helpful?

