GET
/
api
/
v1
/
admin
/
analytics
/
locations
Admin analytics locations
curl --request GET \
  --url https://api.example.com/api/v1/admin/analytics/locations
import 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_body

Overview

The admin dashboard’s “where are listings concentrated?” tile. Returns the top boroughs by current live listing count, taken from the latest analytics_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 6ANE1, SE15 4SWSE15, W1A 1AAW1) — 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

FieldTypeNotesExample
asOfstring | nullThe 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
itemsarrayUp to 10 borough breakdowns. Sorted by listingCount descending. Empty [] when asOf is null.

Location row

FieldTypeNotesExample
boroughstringUK postcode outward-area code (e.g. E1, SE15, W1).E1
listingCountintegerCount of current_homes with status: 'LIVE' AND ownerTenancyApproved: true whose postcode falls in this area.48
demandHitsintegerReserved — 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

  • demandHits is always 0. The spec calls for it to count user_preferences whose radius covers each borough’s centroid, but that requires a per-borough centroid table + a $geoWithin aggregation per borough — out of scope for the launch slice. Ranking is therefore by listingCount only. The rollup worker logs this limitation once at boot.
  • Borough = postcode outward area, not the official council name. E1 covers 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

StatusCodeMeaning
401UNAUTHENTICATEDMissing, malformed, expired, or non-admin-scope token.

See also

curl

curl "https://api.swappr.co.uk/api/v1/admin/analytics/locations" \
  -H "Authorization: Bearer $ADMIN_ACCESS_TOKEN"

Postman

See docs/postman/swappr.postman_collection.jsonAdmin Analytics → Locations.