Manage the city catalogue (operating areas with a bounding box) and the adminβcity
assignment that drives every other admin endpoint's scope. Paths are relative to the
/api/v1 prefix; these are back-office endpoints that require an admin token.
Requires an admin bearer token (see Admin auth). Super-admin only.
See Common errors.
| Method | URI | Access | Description |
|---|---|---|---|
GET |
/admin/cities |
Super admin | List all cities with their admin counts |
POST |
/admin/cities |
Super admin | Create a city |
PATCH |
/admin/cities/{cityId} |
Super admin | Update a city |
POST |
/admin/cities/{cityId}/admins |
Super admin | Assign an admin to a city |
DELETE |
/admin/cities/{cityId}/admins/{adminId} |
Super admin | Unassign an admin from a city |
Lists every city (ordered by name) with its assigned-admin count.
Response 200
{
"items": [
{
"id": 1,
"name": "Caracas",
"slug": "caracas",
"is_active": true,
"center_lat": 10.4806,
"center_lng": -66.9036,
"radius_km": 25.0,
"bbox": { "lat_min": 10.3, "lat_max": 10.6, "lng_min": -67.1, "lng_max": -66.7 },
"admins_count": 3
}
]
}
Creates a city. The bounding box must be
well-formed (lat_max >= lat_min, lng_max >= lng_min).
Request body
| Field | Type | Required | Rules |
|---|---|---|---|
name |
string | yes | β€ 120 chars, unique among cities |
is_active |
boolean | no | defaults to true |
center_lat |
number | yes | between β90 and 90 |
center_lng |
number | yes | between β180 and 180 |
radius_km |
number | yes | > 0, β€ 500 |
lat_min |
number | yes | between β90 and 90 |
lat_max |
number | yes | between β90 and 90, >= lat_min |
lng_min |
number | yes | between β180 and 180 |
lng_max |
number | yes | between β180 and 180, >= lng_min |
Response 201 β { "city": { β¦ } } (same shape as a list item, admins_count 0).
Partial update.
Request body
| Field | Type | Required | Rules |
|---|---|---|---|
name |
string | no | β€ 120 chars, unique (excluding this city) |
is_active |
boolean | no | β |
center_lat |
number | no | between β90 and 90 |
center_lng |
number | no | between β180 and 180 |
radius_km |
number | no | > 0, β€ 500 |
lat_min |
number | no | between β90 and 90 |
lat_max |
number | no | between β90 and 90, >= lat_min |
lng_min |
number | no | between β180 and 180 |
lng_max |
number | no | between β180 and 180, >= lng_min |
Response 200 β { "city": { β¦ } }.
Errors
| Status | Body | When |
|---|---|---|
404 |
{ "error": "CityNotFound" } |
Unknown city id |
Assigns an admin to the city (idempotent β re-assigning is a no-op).
Request body
| Field | Type | Required | Rules |
|---|---|---|---|
admin_id |
integer | yes | must be an existing admin |
Response 200 β { "ok": true, "city": { β¦ } } (the city object with an updated
admins_count).
Errors
| Status | Body | When |
|---|---|---|
404 |
{ "error": "CityNotFound" } |
Unknown city id |
Removes the adminβcity assignment.
Response 200
{ "ok": true }
Errors
| Status | Body | When |
|---|---|---|
404 |
{ "error": "CityNotFound" } |
Unknown city id |