Skip to main content
POST
/
data
/
query
Query Custom Data
curl --request POST \
  --url https://api.prod.usesimple.ai/api/v1/data/query \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "tableName": "<string>",
  "filters": [
    {
      "column": "<string>",
      "values": [
        "<string>"
      ]
    }
  ],
  "text": "<string>",
  "size": 25,
  "from": 1
}
'
import requests

url = "https://api.prod.usesimple.ai/api/v1/data/query"

payload = {
"tableName": "<string>",
"filters": [
{
"column": "<string>",
"values": ["<string>"]
}
],
"text": "<string>",
"size": 25,
"from": 1
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tableName: '<string>',
filters: [{column: '<string>', values: ['<string>']}],
text: '<string>',
size: 25,
from: 1
})
};

fetch('https://api.prod.usesimple.ai/api/v1/data/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://api.prod.usesimple.ai/api/v1/data/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([
'tableName' => '<string>',
'filters' => [
[
'column' => '<string>',
'values' => [
'<string>'
]
]
],
'text' => '<string>',
'size' => 25,
'from' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.prod.usesimple.ai/api/v1/data/query"

payload := strings.NewReader("{\n \"tableName\": \"<string>\",\n \"filters\": [\n {\n \"column\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"text\": \"<string>\",\n \"size\": 25,\n \"from\": 1\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<api-key>")
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.prod.usesimple.ai/api/v1/data/query")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"tableName\": \"<string>\",\n \"filters\": [\n {\n \"column\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"text\": \"<string>\",\n \"size\": 25,\n \"from\": 1\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.prod.usesimple.ai/api/v1/data/query")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tableName\": \"<string>\",\n \"filters\": [\n {\n \"column\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"text\": \"<string>\",\n \"size\": 25,\n \"from\": 1\n}"

response = http.request(request)
puts response.read_body
{
  "records": [
    {}
  ],
  "total": 123
}
{
"status": "error",
"success": false,
"error": "<string>",
"errors": [
"<string>"
]
}
{
"status": "error",
"success": false,
"error": "<string>",
"errors": [
"<string>"
]
}
{
"status": "error",
"success": false,
"error": "<string>",
"errors": [
"<string>"
]
}
This runs a deterministic query against a single table that has searchIndexingEnabled set to true. Provide exact-match filters (each matches a column against one or more values) and/or a free-text text query. Omit both to get the most recent records. Use GET /data/facets/{table_name} to discover the available columns and values to filter on.

Authorizations

Authorization
string
header
required

Body

application/json
tableName
string
required

The indexed custom data table to query.

Pattern: ^[a-z0-9_]+$
filters
Filters · object[]

Exact-match filters. Each filter matches a column against one or more values (any-of). An empty filter is ignored.

text
string

Optional free-text search across all columns.

Maximum string length: 5000
size
integer

Max records to return (default 25, max 50).

Required range: 0 <= x <= 50
from
integer

Offset for pagination.

Required range: x >= 0

Response

Successful Response

records
Records · object[]
required
total
integer
required

Total number of records matching the query (may exceed the returned page).