curl --request GET \
--url https://data.kushiro.app/api/v1/metrics/aggregateimport requests
url = "https://data.kushiro.app/api/v1/metrics/aggregate"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://data.kushiro.app/api/v1/metrics/aggregate', 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://data.kushiro.app/api/v1/metrics/aggregate",
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://data.kushiro.app/api/v1/metrics/aggregate"
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://data.kushiro.app/api/v1/metrics/aggregate")
.asString();require 'uri'
require 'net/http'
url = URI("https://data.kushiro.app/api/v1/metrics/aggregate")
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_body{
"source": "kushiro_population_by_town",
"group_by": "town",
"agg": "latest",
"buckets": [
{
"value": "中央町",
"aggregated_value": 1234,
"count": 264,
"unit": "persons",
"metric": "population_total",
"period": {
"granularity": "month",
"start_date": "2026-04-01",
"end_date": "2026-04-30",
"label": "2026-04"
}
}
],
"total": 67000,
"truncated": false
}{
"error": "invalid query parameters",
"issues": [
{
"path": "source",
"message": "Invalid input: expected string, received undefined"
}
]
}{
"error": "internal server error"
}Aggregate numeric data
Returns DB-side facet aggregation over fact_metric (e.g. “top 10 towns by latest population”) so clients avoid fetching every row to aggregate locally. source and group_by are required. Buckets are ordered by aggregated_value and capped at limit; truncated flags when more buckets exist.
curl --request GET \
--url https://data.kushiro.app/api/v1/metrics/aggregateimport requests
url = "https://data.kushiro.app/api/v1/metrics/aggregate"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://data.kushiro.app/api/v1/metrics/aggregate', 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://data.kushiro.app/api/v1/metrics/aggregate",
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://data.kushiro.app/api/v1/metrics/aggregate"
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://data.kushiro.app/api/v1/metrics/aggregate")
.asString();require 'uri'
require 'net/http'
url = URI("https://data.kushiro.app/api/v1/metrics/aggregate")
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_body{
"source": "kushiro_population_by_town",
"group_by": "town",
"agg": "latest",
"buckets": [
{
"value": "中央町",
"aggregated_value": 1234,
"count": 264,
"unit": "persons",
"metric": "population_total",
"period": {
"granularity": "month",
"start_date": "2026-04-01",
"end_date": "2026-04-30",
"label": "2026-04"
}
}
],
"total": 67000,
"truncated": false
}{
"error": "invalid query parameters",
"issues": [
{
"path": "source",
"message": "Invalid input: expected string, received undefined"
}
]
}{
"error": "internal server error"
}Query Parameters
Source ID to query.
1Aggregation axis.
town, age_bucket, category, metric, period Aggregation function. latest returns the value of the most recent period within each bucket; delta returns (latest - previous) and adds previous_value / previous_period / delta_pct to each bucket.
sum, avg, min, max, latest, delta Sort direction for aggregated_value. desc returns the top N.
asc, desc Pre-filter by metric name (exact). Repeat the parameter to match any of several metrics. Takes precedence over metric_prefix.
201Pre-filter by metric name prefix. Ignored when metric is also supplied.
1Inclusive lower bound for period.start_date in YYYY-MM-DD format.
^\d{4}-\d{2}-\d{2}$"2026-04-01"
Inclusive upper bound for period.end_date in YYYY-MM-DD format.
^\d{4}-\d{2}-\d{2}$"2026-04-01"
Pre-filter by exact town name.
1Pre-filter by exact age label.
1Pre-filter by dim_category.kind.
1Pre-filter by dim_category.code.
1Maximum number of buckets to return. Defaults to 100.
1 <= x <= 1000Response
Metric aggregation result.