Admin analytics locations
curl --request GET \
--url https://api.example.com/api/v1/admin/analytics/locationsimport requests
url = "https://api.example.com/api/v1/admin/analytics/locations"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/admin/analytics/locations', 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.example.com/api/v1/admin/analytics/locations",
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.example.com/api/v1/admin/analytics/locations"
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.example.com/api/v1/admin/analytics/locations")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/admin/analytics/locations")
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_bodyAnalytics
Admin analytics locations
Top boroughs by current live listing count, read from the latest analytics_daily rollup’s topBoroughs.
GET
/
api
/
v1
/
admin
/
analytics
/
locations
Admin analytics locations
curl --request GET \
--url https://api.example.com/api/v1/admin/analytics/locationsimport requests
url = "https://api.example.com/api/v1/admin/analytics/locations"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/admin/analytics/locations', 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.example.com/api/v1/admin/analytics/locations",
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.example.com/api/v1/admin/analytics/locations"
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.example.com/api/v1/admin/analytics/locations")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/admin/analytics/locations")
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_bodyOverview
The admin dashboard’s “where are listings concentrated?” tile. Returns the top boroughs by current live listing count, taken from the latestanalytics_daily row’s topBoroughs array (capped at 10 entries by the rollup).
Boroughs are derived from each listing’s UK postcode outward-code area (e.g. E1 6AN → E1, SE15 4SW → SE15, W1A 1AA → W1) — see Analytics and rollups. This is not an official London-borough name; it is the postcode area used as a coarse geographic grouping.
Available to any admin role — SUPER, MODERATOR, and FINANCE all read this surface.
Authentication
Bearer <accessToken> with scope: 'admin' required (requireAdmin).
Path parameters
None.Query parameters
None.Request body
None.Response — 200 OK
| Field | Type | Notes | Example |
|---|---|---|---|
asOf | string | null | The date of the rollup row these rows came from, YYYY-MM-DD. null when no rollup has run yet (fresh database, pre-launch). | 2026-05-22 |
items | array | Up to 10 borough breakdowns. Sorted by listingCount descending. Empty [] when asOf is null. |
Location row
| Field | Type | Notes | Example |
|---|---|---|---|
borough | string | UK postcode outward-area code (e.g. E1, SE15, W1). | E1 |
listingCount | integer | Count of current_homes with status: 'LIVE' AND ownerTenancyApproved: true whose postcode falls in this area. | 48 |
demandHits | integer | Reserved — count of user_preferences whose desired-radius covers this borough’s centroid. Hard-zero for MVP (see limitations). | 0 |
{
"asOf": "2026-05-22",
"items": [
{ "borough": "E1", "listingCount": 48, "demandHits": 0 },
{ "borough": "SE15", "listingCount": 41, "demandHits": 0 },
{ "borough": "W1", "listingCount": 33, "demandHits": 0 },
{ "borough": "N1", "listingCount": 27, "demandHits": 0 }
]
}
Empty (no rollup yet) response
{
"asOf": null,
"items": []
}
MVP limitations
demandHitsis always0. The spec calls for it to countuser_preferenceswhose radius covers each borough’s centroid, but that requires a per-borough centroid table + a$geoWithinaggregation per borough — out of scope for the launch slice. Ranking is therefore bylistingCountonly. The rollup worker logs this limitation once at boot.- Borough = postcode outward area, not the official council name.
E1covers parts of Tower Hamlets but is not “Tower Hamlets”. Treat the borough field as a key, not a label. - Staleness up to 24h. Reflects yesterday’s rollup, not live. For “current moment” totals use analytics overview.
Error responses
| Status | Code | Meaning |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, malformed, expired, or non-admin-scope token. |
See also
- Analytics and rollups — the rollup pipeline + borough derivation rules.
- Admin analytics overview — live counters, 60s cache.
- Admin analytics cohorts — per-day rollup metrics.
curl
curl "https://api.swappr.co.uk/api/v1/admin/analytics/locations" \
-H "Authorization: Bearer $ADMIN_ACCESS_TOKEN"
Postman
Seedocs/postman/swappr.postman_collection.json → Admin Analytics → Locations.