---
title: "Returns a list of all Locations with Aggregates sorted by 'sort' query string parameter in a format defined by 'format' parameter ('json' | 'xml' | 'csv')."
method: GET
path: "/api/v1/locationsWithAggregates"
tags: ["Locations"]
---

# Returns a list of all Locations with Aggregates sorted by 'sort' query string parameter in a format defined by 'format' parameter ('json' | 'xml' | 'csv').

`GET /api/v1/locationsWithAggregates`

## Request

- Base URL: `https://population.un.org/dataportalapi`
- URL: `https://population.un.org/dataportalapi/api/v1/locationsWithAggregates`
- Auth: none declared
- TypeScript: <https://skmtc.dev/united-nations/apis/data-portal-api/docs/api/v1/locationsWithAggregates/get.ts> (a function with typed inputs; its response is checked against the schema)

<br>Returns a list of all Locations with Aggregates sorted by 'sort' query string parameter in a format defined by 'format' parameter ('json' | 'xml' | 'csv').

## Query parameters

- `pageNumber` integer
- `pageSize` integer
- `sort` string
- `pagingInHeader` boolean
- `format` string

## Response `200`

Returns list of all Locations.

- unknown[]
  - unknown

## Other responses

- `400`: Returns Status 400 BadRequest if passed 'sort' parameter is not a property of the Model class returned.
- `401`: Unauthorized
- `404`: Returns Status 404 NotFound if no locations are returned.
- `406`: Not Acceptable
- `500`: Returns Status 500 Internal Server Error if an exception is thrown by the server.

## Changes

- **2026-11-07** `2f5f5b77ad0d`: 1 info
  - added the new optional `query` request parameter `pagingInHeader`

[Operation history](https://skmtc.dev/united-nations/apis/data-portal-api/changes/api/v1/locationsWithAggregates/get.md)

---

[API](https://skmtc.dev/united-nations/apis/data-portal-api.md) - [All operations](https://skmtc.dev/united-nations/apis/data-portal-api/llms.txt) - [OpenAPI document](https://skmtc.dev/united-nations/apis/data-portal-api/revisions/2f5f5b77ad0d?raw)
