Get stats
curl --request GET \
--url https://api.trydatadriver.com/v1/datasets/{table}/statsimport requests
url = "https://api.trydatadriver.com/v1/datasets/{table}/stats"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.trydatadriver.com/v1/datasets/{table}/stats', 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.trydatadriver.com/v1/datasets/{table}/stats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trydatadriver.com/v1/datasets/{table}/stats"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.trydatadriver.com/v1/datasets/{table}/stats")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trydatadriver.com/v1/datasets/{table}/stats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyEndpoints
Get stats
Pre-counted totals broken down by columns. Lets you size queries before pulling rows.
GET
/
v1
/
datasets
/
{table}
/
stats
Get stats
curl --request GET \
--url https://api.trydatadriver.com/v1/datasets/{table}/statsimport requests
url = "https://api.trydatadriver.com/v1/datasets/{table}/stats"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.trydatadriver.com/v1/datasets/{table}/stats', 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.trydatadriver.com/v1/datasets/{table}/stats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trydatadriver.com/v1/datasets/{table}/stats"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.trydatadriver.com/v1/datasets/{table}/stats")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trydatadriver.com/v1/datasets/{table}/stats")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyWhen you’d use this
Before paying the cost of pulling thousands of rows, peek at the counts. “How many tier-1 leads in Texas?” — this answers it in one cheap call. Perfect for dashboards and filter UIs.Query parameters
| Name | Type | Default | Description |
|---|---|---|---|
group_by | string (optional) | tier,state,match_score | Comma-separated column names to break down counts by. Max 5. |
Cached for 60 seconds. This endpoint is hit a lot, so we cache
it. If you need to-the-second precision, use
/search.Request
curl "https://api.trydatadriver.com/v1/datasets/leads/stats?group_by=tier,state" \
-H "Authorization: Bearer YOUR_API_KEY"
Note the quotes around the URL. The
? and = can confuse the
shell, so wrap it.Response
{
"total": 102345,
"group_by": ["tier", "state"],
"groups": [
{ "tier": "1", "state": "AZ", "count": 3214 },
{ "tier": "1", "state": "TX", "count": 5872 },
{ "tier": "1", "state": "CA", "count": 7104 },
{ "tier": "3", "state": "AZ", "count": 1432 },
{ "tier": "4", "state": "AZ", "count": 945 }
],
"cached_at": "2026-05-09T12:14:00Z"
}
groups shows one combination of values plus its count.
So the third row above means: 7,104 leads have tier=1 AND state=CA.
The response includes X-Cache: HIT or X-Cache: MISS so you can
see whether the answer came from the cache.