Run SQL against one connected sheet
curl --request POST \
--url https://api.dataville.com/api/v1/datasets/{id}/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sql": "SELECT * FROM sheet_data LIMIT 10"
}
'import requests
url = "https://api.dataville.com/api/v1/datasets/{id}/query"
payload = { "sql": "SELECT * FROM sheet_data LIMIT 10" }
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({sql: 'SELECT * FROM sheet_data LIMIT 10'})
};
fetch('https://api.dataville.com/api/v1/datasets/{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://api.dataville.com/api/v1/datasets/{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([
'sql' => 'SELECT * FROM sheet_data LIMIT 10'
]),
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.dataville.com/api/v1/datasets/{id}/query"
payload := strings.NewReader("{\n \"sql\": \"SELECT * FROM sheet_data LIMIT 10\"\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.dataville.com/api/v1/datasets/{id}/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sql\": \"SELECT * FROM sheet_data LIMIT 10\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dataville.com/api/v1/datasets/{id}/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 \"sql\": \"SELECT * FROM sheet_data LIMIT 10\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"row_count": 123,
"rows": [
{}
],
"sql_executed": "<string>"
}{
"status": "error",
"message": "<string>"
}{
"error": "Unauthorized",
"message": "No token provided"
}{
"status": "error",
"message": "Dataset not found."
}{
"status": "error",
"message": "<string>"
}Connected sheets
Run SQL against one connected sheet
A SELECT-only sandbox scoped to a single dataset. Reference the sheet as
sheet_data in the SQL. Accepts an API key as well as a Clerk session, so
connected data is queryable programmatically.
curl -X POST https://api.dataville.com/api/v1/datasets/my-budget-2026/query \
-H "Authorization: Bearer $DATAVILLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"sql":"SELECT category, SUM(amount) FROM sheet_data GROUP BY 1"}'
POST
/
api
/
v1
/
datasets
/
{id}
/
query
Run SQL against one connected sheet
curl --request POST \
--url https://api.dataville.com/api/v1/datasets/{id}/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sql": "SELECT * FROM sheet_data LIMIT 10"
}
'import requests
url = "https://api.dataville.com/api/v1/datasets/{id}/query"
payload = { "sql": "SELECT * FROM sheet_data LIMIT 10" }
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({sql: 'SELECT * FROM sheet_data LIMIT 10'})
};
fetch('https://api.dataville.com/api/v1/datasets/{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://api.dataville.com/api/v1/datasets/{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([
'sql' => 'SELECT * FROM sheet_data LIMIT 10'
]),
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.dataville.com/api/v1/datasets/{id}/query"
payload := strings.NewReader("{\n \"sql\": \"SELECT * FROM sheet_data LIMIT 10\"\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.dataville.com/api/v1/datasets/{id}/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sql\": \"SELECT * FROM sheet_data LIMIT 10\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dataville.com/api/v1/datasets/{id}/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 \"sql\": \"SELECT * FROM sheet_data LIMIT 10\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"row_count": 123,
"rows": [
{}
],
"sql_executed": "<string>"
}{
"status": "error",
"message": "<string>"
}{
"error": "Unauthorized",
"message": "No token provided"
}{
"status": "error",
"message": "Dataset not found."
}{
"status": "error",
"message": "<string>"
}Authorizations
A Dataville API key, sent as Authorization: Bearer dataville_.... Clients
that cannot set headers may pass the same key as ?token=.
Path Parameters
The dataset's UUID or its friendly slug (e.g. my-budget-2026).
Body
application/json
Maximum string length:
10000Example:
"SELECT * FROM sheet_data LIMIT 10"
Was this page helpful?