curl --request POST \
--url https://www.closient.com/search/api/v1/search/session \
--header 'Content-Type: application/json' \
--data '
{
"latitude": 48.4284,
"longitude": -123.3656,
"query": "organic trail mix near me"
}
'import requests
url = "https://www.closient.com/search/api/v1/search/session"
payload = {
"latitude": 48.4284,
"longitude": -123.3656,
"query": "organic trail mix near me"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({latitude: 48.4284, longitude: -123.3656, query: 'organic trail mix near me'})
};
fetch('https://www.closient.com/search/api/v1/search/session', 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://www.closient.com/search/api/v1/search/session",
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([
'latitude' => 48.4284,
'longitude' => -123.3656,
'query' => 'organic trail mix near me'
]),
CURLOPT_HTTPHEADER => [
"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://www.closient.com/search/api/v1/search/session"
payload := strings.NewReader("{\n \"latitude\": 48.4284,\n \"longitude\": -123.3656,\n \"query\": \"organic trail mix near me\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://www.closient.com/search/api/v1/search/session")
.header("Content-Type", "application/json")
.body("{\n \"latitude\": 48.4284,\n \"longitude\": -123.3656,\n \"query\": \"organic trail mix near me\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.closient.com/search/api/v1/search/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"latitude\": 48.4284,\n \"longitude\": -123.3656,\n \"query\": \"organic trail mix near me\"\n}"
response = http.request(request)
puts response.read_body{
"active_constraints": {
"distance_km": 2,
"scope": "local"
},
"base_query": "organic trail mix near me",
"is_expired": false,
"latitude": 48.4284,
"longitude": -123.3656,
"search_history": [
"organic trail mix near me"
],
"session_id": "s_abc123def456"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}Open a conversational search session
Create a new search session anchored to a location. The initial query is parsed for structured constraints (color, price, distance, availability, scope) and stored alongside the verbatim text. Sessions expire after 30 minutes of inactivity; submitting a query or removing a constraint refreshes the TTL.
Auth: unauthenticated (anonymous IP-throttled at 30 requests/minute). Authenticated requests attach the session to the caller’s user.
Errors: 422 Unprocessable Content when the payload fails validation (missing query, latitude/longitude out of WGS84 bounds).
curl --request POST \
--url https://www.closient.com/search/api/v1/search/session \
--header 'Content-Type: application/json' \
--data '
{
"latitude": 48.4284,
"longitude": -123.3656,
"query": "organic trail mix near me"
}
'import requests
url = "https://www.closient.com/search/api/v1/search/session"
payload = {
"latitude": 48.4284,
"longitude": -123.3656,
"query": "organic trail mix near me"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({latitude: 48.4284, longitude: -123.3656, query: 'organic trail mix near me'})
};
fetch('https://www.closient.com/search/api/v1/search/session', 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://www.closient.com/search/api/v1/search/session",
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([
'latitude' => 48.4284,
'longitude' => -123.3656,
'query' => 'organic trail mix near me'
]),
CURLOPT_HTTPHEADER => [
"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://www.closient.com/search/api/v1/search/session"
payload := strings.NewReader("{\n \"latitude\": 48.4284,\n \"longitude\": -123.3656,\n \"query\": \"organic trail mix near me\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://www.closient.com/search/api/v1/search/session")
.header("Content-Type", "application/json")
.body("{\n \"latitude\": 48.4284,\n \"longitude\": -123.3656,\n \"query\": \"organic trail mix near me\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.closient.com/search/api/v1/search/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"latitude\": 48.4284,\n \"longitude\": -123.3656,\n \"query\": \"organic trail mix near me\"\n}"
response = http.request(request)
puts response.read_body{
"active_constraints": {
"distance_km": 2,
"scope": "local"
},
"base_query": "organic trail mix near me",
"is_expired": false,
"latitude": 48.4284,
"longitude": -123.3656,
"search_history": [
"organic trail mix near me"
],
"session_id": "s_abc123def456"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}{
"detail": "The requested resource was not found.",
"error_code": "not_found",
"retryable": false,
"status": 404,
"timestamp": "2026-03-31T12:00:00+00:00",
"title": "Not Found",
"type": "https://closient.com/docs/errors/not_found"
}Body
Payload for opening a new conversational search session.
The initial query seeds the session — its extracted constraints
become the starting filter set, and the verbatim text is stored as
base_query so follow-up refinements have an anchor. Latitude /
longitude fix the geographic origin used for distance-based ranking
on every subsequent query in the session.
Initial natural-language search query. May contain freeform intent ("birthday gift ideas") or pre-extractable constraints ("red shoes under $50 within 5km"). The refinement extractor parses color, price, distance, availability, and scope on creation.
1 - 500^[^\x00]{1,500}$User latitude in WGS84 decimal degrees. Used for distance-based ranking and the distance_km constraint. Stored once per session — follow-up queries inherit it.
-90 <= x <= 90User longitude in WGS84 decimal degrees. See latitude.
-180 <= x <= 180Response
OK
Response schema for the current state of a search session.
Returned by POST /search/session and DELETE /search/session/{session_id}/constraints/{key}. Reflects the
session's full filter state plus the geographic anchor.
URL-safe session identifier (~32 chars). Use this in the path of every follow-up call (/search/session/{session_id}/...).
The anchor query for this session. Set on session creation and replaced whenever a follow-up is classified as a new search.
Current filter state. Keys are members of ConstraintKeyEnum:
Scalar constraints — set replaces:
color(string),price_max/price_min(float),distance_km(float),availability(string),scope(string).
Trait-based constraints — list-of-slug, set unions additively across successive refinements (C-2385):
exclude_allergens— allergen slugs to drop (peanuts,tree_nuts,dairy,eggs,soy,wheat,gluten,fish,shellfish,sesame,sulfites,mustard).require_certifications— certification slugs that products must carry (vegan,vegetarian,kosher,halal,organic,non_gmo,gluten_free,fair_trade,cruelty_free,rainforest_alliance,usda_organic).avoid_substances— substance slugs to drop (sucralose,aspartame,msg,high_fructose_corn_syrup,red_dye_40,carrageenan,bpa,parabens,phthalates).
Each constraint can be removed individually via DELETE /search/session/{session_id}/constraints/{key}.
Ordered list of every query submitted in this session, oldest first.
true once the session has passed its 30-minute idle expiry. Expired sessions return 404 from query/constraint endpoints.
WGS84 latitude captured at session creation.
-90 <= x <= 90WGS84 longitude captured at session creation.
-180 <= x <= 180