Query the dataset
curl --request POST \
--url https://platform.datagyro.com/v1/query \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"query_string": "Engineers",
"dataset_id": "118",
"limit": 10,
"use_smaller_model": false
}
'import requests
url = "https://platform.datagyro.com/v1/query"
payload = {
"query_string": "Engineers",
"dataset_id": "118",
"limit": 10,
"use_smaller_model": False
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query_string: 'Engineers',
dataset_id: '118',
limit: 10,
use_smaller_model: false
})
};
fetch('https://platform.datagyro.com/v1/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://platform.datagyro.com/v1/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_string' => 'Engineers',
'dataset_id' => '118',
'limit' => 10,
'use_smaller_model' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://platform.datagyro.com/v1/query"
payload := strings.NewReader("{\n \"query_string\": \"Engineers\",\n \"dataset_id\": \"118\",\n \"limit\": 10,\n \"use_smaller_model\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<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://platform.datagyro.com/v1/query")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query_string\": \"Engineers\",\n \"dataset_id\": \"118\",\n \"limit\": 10,\n \"use_smaller_model\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.datagyro.com/v1/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query_string\": \"Engineers\",\n \"dataset_id\": \"118\",\n \"limit\": 10,\n \"use_smaller_model\": false\n}"
response = http.request(request)
puts response.read_bodydata: {"type":"thoughts","data":{"filters":["headline contains 'engineer'"],"traits":["Profile mentions engineer"],"key_phrases":["engineer","engineering"],"metadata":"SQL construction notes"},"created":1748020550423}
Querying Data
Query Data
Performs a query against a specified dataset with the given parameters
POST
/
v1
/
query
Query the dataset
curl --request POST \
--url https://platform.datagyro.com/v1/query \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"query_string": "Engineers",
"dataset_id": "118",
"limit": 10,
"use_smaller_model": false
}
'import requests
url = "https://platform.datagyro.com/v1/query"
payload = {
"query_string": "Engineers",
"dataset_id": "118",
"limit": 10,
"use_smaller_model": False
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query_string: 'Engineers',
dataset_id: '118',
limit: 10,
use_smaller_model: false
})
};
fetch('https://platform.datagyro.com/v1/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://platform.datagyro.com/v1/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_string' => 'Engineers',
'dataset_id' => '118',
'limit' => 10,
'use_smaller_model' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://platform.datagyro.com/v1/query"
payload := strings.NewReader("{\n \"query_string\": \"Engineers\",\n \"dataset_id\": \"118\",\n \"limit\": 10,\n \"use_smaller_model\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<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://platform.datagyro.com/v1/query")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query_string\": \"Engineers\",\n \"dataset_id\": \"118\",\n \"limit\": 10,\n \"use_smaller_model\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.datagyro.com/v1/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query_string\": \"Engineers\",\n \"dataset_id\": \"118\",\n \"limit\": 10,\n \"use_smaller_model\": false\n}"
response = http.request(request)
puts response.read_bodydata: {"type":"thoughts","data":{"filters":["headline contains 'engineer'"],"traits":["Profile mentions engineer"],"key_phrases":["engineer","engineering"],"metadata":"SQL construction notes"},"created":1748020550423}
Core Concepts
Datasets
Each dataset in DataGyro has a unique identifier (dataset_id). You’ll need to specify which dataset you want to query in your request.
Query Parameters
query_string: The search term or phrase you want to find in the datasetdataset_id: The unique identifier for the dataset you want to querylimit: Maximum number of results to return (default: 10)use_smaller_model: Option to use a smaller model for faster processing (default: false)
Example Request
curl --request POST \
--url https://platform.datagyro.com/v1/query \
--header 'Content-Type: application/json' \
--header 'Accept: text/event-stream' \
--header 'apikey: YOUR_API_KEY' \
--data '{
"query_string": "Engineers",
"dataset_id": "118",
"limit": 10,
"use_smaller_model": false
}'
Accept: text/event-stream header and handle the streaming response appropriately.
Response Format
The query endpoint returns a Server-Sent Events (SSE) stream that provides real-time updates during query processing. Each event contains adata field with JSON content.
Stream Event Types
The SSE stream returns four types of events in sequence:1. Thoughts Event
Provides insights into the query processing logic:data: {"type":"thoughts","data":{"filters":["headline contains 'engineer'"],"traits":["Profile mentions engineer"],"key_phrases":["engineer","engineering"],"metadata":"SQL construction notes"},"created":1748020550423}
2. SQL Event
Contains the generated SQL query:data: {"type":"sql","data":{"sql":"SELECT id AS OUTPUT_ID, headline, current_title FROM public.linkedin_profiles WHERE LOWER(headline) LIKE LOWER('%engineer%')"},"created":1748020553674}
3. Results Event
Contains the actual query results:data: {"type":"results","data":{"items":[{"id":"c0cc058f-0ef0-4ef5-bfea-fe0468d3814f","item":{"001_headline":"AI & VC Engineer","002_current_title":"Software Engineer","003_bio":"..."}}]},"created":1748020553784}
4. Close Event
Indicates the stream has completed:data: {"type":"close","data":{"complete":true},"created":1748020553784}
Consuming the SSE Stream
To consume the SSE stream in JavaScript:const eventSource = new EventSource('https://platform.datagyro.com/v1/query', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': 'YOUR_API_KEY'
},
body: JSON.stringify({
query_string: "Engineers",
dataset_id: "118",
limit: 10
})
});
eventSource.onmessage = function(event) {
const data = JSON.parse(event.data);
switch(data.type) {
case 'thoughts':
console.log('Processing insights:', data.data);
break;
case 'sql':
console.log('Generated SQL:', data.data.sql);
break;
case 'results':
console.log('Query results:', data.data.items);
break;
case 'close':
console.log('Stream completed');
eventSource.close();
break;
}
};
Error Handling
The API may return the following error responses:400 Bad Request: Invalid parameters were provided401 Unauthorized: Invalid or missing API key404 Not Found: The specified dataset was not found500 Server Error: An internal server error occurred
{
"error": "Invalid dataset ID provided",
"error_code": "INVALID_DATASET"
}
Authorizations
API key for authentication
Body
application/json
The search query to execute against the dataset
Example:
"Engineers"
Identifier for the dataset to query
Example:
"118"
Maximum number of results to return
Required range:
1 <= x <= 100Option to use a smaller model for faster but potentially less accurate results
Response
Server-Sent Events stream with query processing updates
SSE stream with events containing JSON data