Body
The search query string. Supports fuzzy matching and operators
Array of resource types to search. If empty, searches all resources.
Options: [“orders”, “customers”, “products”, “inventory”, “returns”, “warranties”, “tickets”]
Advanced filters to narrow search results Filter by date range Date field to filter on (e.g., “created_at”, “updated_at”)
Filter by custom field values
Fields to generate facet counts for
Sort configuration Sort order: “asc” or “desc”
Pagination configuration Results per page (max 100)
Whether to include highlighted snippets in results
Whether to include search suggestions for typos
Response
Array of search results Unique identifier of the result
Type of resource (e.g., “order”, “customer”)
Highlighted text snippets (if enabled)
Facet counts for requested fields
Search suggestions for possible typos
Total number of results found
Time taken to execute the query in milliseconds
cURL
GraphQL
Node.js
Python
Ruby
Go
Java
PHP
C#
curl --location --request POST 'https://api.stateset.com/v1/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token <token>' \
--data-raw '{
"query": "john doe refund",
"resources": ["orders", "customers", "returns"],
"filters": {
"date_range": {
"field": "created_at",
"from": "2024-01-01",
"to": "2024-12-31"
},
"status": ["active", "pending"]
},
"facets": ["resource_type", "status", "tags"],
"sort": {
"field": "created_at",
"order": "desc"
},
"pagination": {
"page": 1,
"per_page": 20
},
"highlight": true,
"suggest": true
}'
{
"results" : [
{
"id" : "ord_123abc" ,
"resource_type" : "order" ,
"score" : 0.95 ,
"data" : {
"id" : "ord_123abc" ,
"customer_name" : "John Doe" ,
"total" : 299.99 ,
"status" : "pending" ,
"created_at" : "2024-03-15T10:30:00Z"
},
"highlights" : {
"customer_name" : "<em>John Doe</em>" ,
"notes" : "Customer requested <em>refund</em> for damaged item"
}
},
{
"id" : "cust_456def" ,
"resource_type" : "customer" ,
"score" : 0.88 ,
"data" : {
"id" : "cust_456def" ,
"name" : "John Doe" ,
"email" : "john.doe@example.com" ,
"status" : "active"
},
"highlights" : {
"name" : "<em>John Doe</em>"
}
}
],
"facets" : {
"resource_type" : {
"order" : 5 ,
"customer" : 3 ,
"return" : 2
},
"status" : {
"active" : 6 ,
"pending" : 4
},
"tags" : {
"vip" : 2 ,
"priority" : 3
}
},
"suggestions" : [
{
"text" : "john doe refunded" ,
"score" : 0.92
}
],
"total_results" : 10 ,
"page" : 1 ,
"per_page" : 20 ,
"query_time_ms" : 23
}