curl --request POST \
--url https://www.closient.com/search/api/v1/search/session/{session_id}/query \
--header 'Content-Type: application/json' \
--data '
{
"query": "but under $80"
}
'import requests
url = "https://www.closient.com/search/api/v1/search/session/{session_id}/query"
payload = { "query": "but under $80" }
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({query: 'but under $80'})
};
fetch('https://www.closient.com/search/api/v1/search/session/{session_id}/query', 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/{session_id}/query",
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' => 'but under $80'
]),
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/{session_id}/query"
payload := strings.NewReader("{\n \"query\": \"but under $80\"\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/{session_id}/query")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"but under $80\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.closient.com/search/api/v1/search/session/{session_id}/query")
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 \"query\": \"but under $80\"\n}"
response = http.request(request)
puts response.read_body{
"active_constraints": {
"distance_km": 2,
"price_max": 80,
"scope": "local"
},
"base_query": "organic trail mix near me",
"classification_explanation": "Refinement language detected.",
"is_refinement": true,
"new_constraints": {
"price_max": 80
},
"query": "but under $80",
"search_history": [
"organic trail mix near me",
"but under $80"
],
"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"
}Submit a follow-up query within a session
Send a follow-up query and let the classifier decide whether to refine the existing search or start fresh. Refinement language (“but cheaper”, “in red”, “within 2 km”) merges constraints; explicit reset language (“instead”, “never mind”, “forget that”) replaces the session’s anchor and clears the constraint set.
Either way, the response carries the classifier’s verdict, the new constraint delta, the merged active set, and the updated history. The session’s TTL is refreshed by 30 minutes on every successful call.
Errors: 404 Not Found when the session doesn’t exist, has expired, or belongs to a different signed-in user.
curl --request POST \
--url https://www.closient.com/search/api/v1/search/session/{session_id}/query \
--header 'Content-Type: application/json' \
--data '
{
"query": "but under $80"
}
'import requests
url = "https://www.closient.com/search/api/v1/search/session/{session_id}/query"
payload = { "query": "but under $80" }
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({query: 'but under $80'})
};
fetch('https://www.closient.com/search/api/v1/search/session/{session_id}/query', 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/{session_id}/query",
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' => 'but under $80'
]),
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/{session_id}/query"
payload := strings.NewReader("{\n \"query\": \"but under $80\"\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/{session_id}/query")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"but under $80\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.closient.com/search/api/v1/search/session/{session_id}/query")
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 \"query\": \"but under $80\"\n}"
response = http.request(request)
puts response.read_body{
"active_constraints": {
"distance_km": 2,
"price_max": 80,
"scope": "local"
},
"base_query": "organic trail mix near me",
"classification_explanation": "Refinement language detected.",
"is_refinement": true,
"new_constraints": {
"price_max": 80
},
"query": "but under $80",
"search_history": [
"organic trail mix near me",
"but under $80"
],
"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 submitting a query within an existing session.
The classifier decides whether the query refines the current session
or resets it as a new search; the body is the same shape either way.
Phrasing matters: "but cheaper" reads as refinement, while
"instead show me laptops" reads as a fresh search.
Follow-up or replacement query text. The server classifies it as either a refinement (constraints merge into the existing set) or a new search (constraints reset, base_query updates) based on phrasing signals and keyword overlap with the current base_query.
1 - 500^[^\x00]{1,500}$Response
OK
Response for POST /search/session/{session_id}/query.
Reports the classifier's verdict (refinement vs. new search), the
constraint delta the extractor pulled out of the new query, and the
merged session state. Clients typically render
classification_explanation to the user as a chip ("Adding 'under
$80' to your search") so the model's behavior is visible.