curl --request POST \
--url https://api.cloudglue.dev/v1/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"collections": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"sql": "<string>",
"query": "<string>",
"format": "json",
"max_rows": 1000,
"background": false,
"dry_run": false
}
'import requests
url = "https://api.cloudglue.dev/v1/query"
payload = {
"collections": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"sql": "<string>",
"query": "<string>",
"format": "json",
"max_rows": 1000,
"background": False,
"dry_run": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
collections: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
sql: '<string>',
query: '<string>',
format: 'json',
max_rows: 1000,
background: false,
dry_run: false
})
};
fetch('https://api.cloudglue.dev/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://api.cloudglue.dev/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([
'collections' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'sql' => '<string>',
'query' => '<string>',
'format' => 'json',
'max_rows' => 1000,
'background' => false,
'dry_run' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.cloudglue.dev/v1/query"
payload := strings.NewReader("{\n \"collections\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sql\": \"<string>\",\n \"query\": \"<string>\",\n \"format\": \"json\",\n \"max_rows\": 1000,\n \"background\": false,\n \"dry_run\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.cloudglue.dev/v1/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"collections\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sql\": \"<string>\",\n \"query\": \"<string>\",\n \"format\": \"json\",\n \"max_rows\": 1000,\n \"background\": false,\n \"dry_run\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudglue.dev/v1/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"collections\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sql\": \"<string>\",\n \"query\": \"<string>\",\n \"format\": \"json\",\n \"max_rows\": 1000,\n \"background\": false,\n \"dry_run\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "query_result",
"status": "completed",
"created_at": 123,
"collections": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"sql": "<string>",
"columns": [
{
"name": "<string>",
"type": "<string>"
}
],
"rows": [
{}
],
"row_count": 123,
"truncated": true,
"dry_run": true,
"usage": {
"files_scanned": 123,
"entity_rows": 123,
"segment_entity_rows": 123,
"engine_ms": 123,
"total_ms": 123
},
"error": {
"code": "<string>",
"message": "<string>"
},
"format": "json",
"download_url": "<string>",
"download_expires_at": 123,
"output_bytes": 123
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Run Structured Query
Run a synchronous read-only SQL query over the structured data extracted from one or more collections. Queries execute against three virtual tables — files, entities, and segment_entities — built from each file’s most recent completed extraction.
Each query costs 2 credits. Results are returned inline and stored, so completed runs can be re-fetched via GET /query/. Use GET /query/schema to discover the queryable tables and per-collection fields.
curl --request POST \
--url https://api.cloudglue.dev/v1/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"collections": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"sql": "<string>",
"query": "<string>",
"format": "json",
"max_rows": 1000,
"background": false,
"dry_run": false
}
'import requests
url = "https://api.cloudglue.dev/v1/query"
payload = {
"collections": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"sql": "<string>",
"query": "<string>",
"format": "json",
"max_rows": 1000,
"background": False,
"dry_run": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
collections: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
sql: '<string>',
query: '<string>',
format: 'json',
max_rows: 1000,
background: false,
dry_run: false
})
};
fetch('https://api.cloudglue.dev/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://api.cloudglue.dev/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([
'collections' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'sql' => '<string>',
'query' => '<string>',
'format' => 'json',
'max_rows' => 1000,
'background' => false,
'dry_run' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.cloudglue.dev/v1/query"
payload := strings.NewReader("{\n \"collections\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sql\": \"<string>\",\n \"query\": \"<string>\",\n \"format\": \"json\",\n \"max_rows\": 1000,\n \"background\": false,\n \"dry_run\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.cloudglue.dev/v1/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"collections\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sql\": \"<string>\",\n \"query\": \"<string>\",\n \"format\": \"json\",\n \"max_rows\": 1000,\n \"background\": false,\n \"dry_run\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudglue.dev/v1/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"collections\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"sql\": \"<string>\",\n \"query\": \"<string>\",\n \"format\": \"json\",\n \"max_rows\": 1000,\n \"background\": false,\n \"dry_run\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "query_result",
"status": "completed",
"created_at": 123,
"collections": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"sql": "<string>",
"columns": [
{
"name": "<string>",
"type": "<string>"
}
],
"rows": [
{}
],
"row_count": 123,
"truncated": true,
"dry_run": true,
"usage": {
"files_scanned": 123,
"entity_rows": 123,
"segment_entity_rows": 123,
"engine_ms": 123,
"total_ms": 123
},
"error": {
"code": "<string>",
"message": "<string>"
},
"format": "json",
"download_url": "<string>",
"download_expires_at": 123,
"output_bytes": 123
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Authorizations
Body
Query execution parameters
A natural-language question to run instead of sql. Cloudglue compiles it to SQL against the same virtual schema, runs it, and returns the compiled statement in the response's sql field. Exactly one of sql or query must be provided. Costs 4 credits (refunded if compilation fails); returns 422 if it cannot be compiled.
1 - 2000When true, run the query as a background export: the full result streams to a gzipped csv/jsonl file and the response returns immediately with status 'in_progress' and an id to poll. Requires format 'csv' or 'jsonl'. Reserves 4 credits, reconciled to +1 per 100MB of compressed output. Cannot be combined with dry_run.
Response
Query executed successfully