---
title: "Returns a list of Locations filtered by one or more {codes} ('m49', 'iso2' or 'iso3') separated by semi-column (;) or comma (,). This is MORE STRICT (all or none) version of the 2 versions of same endpoint"
method: GET
path: "/api/v1/locations/{codes}"
tags: ["Locations"]
---

# Returns a list of Locations filtered by one or more {codes} ('m49', 'iso2' or 'iso3') separated by semi-column (;) or comma (,). This is MORE STRICT (all or none) version of the 2 versions of same endpoint

`GET /api/v1/locations/{codes}`

## Request

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

<br>Filtering options: \
            \
            <br>* To filter Locations by ISO3 codes: in place of {codes} parameter, pass in comma (,) or semi-column (;) delimited list of ISO 3166-1 (alpha-3) codes \
            <br>* To filter Locations by ISO2 codes: in place of {codes} parameter, pass in comma (,) or semi-column (;) delimited list of ISO 3166-1 (alpha-2) codes \
            <br>* To filter Locations by numberical M49 codes: in place of {codes} parameter, pass in comma (,) or semi-column (;) delimited list of ISO 3166-1 (numerical M49) codes \
            \
            <br>Note: \
            \
            <br>* If one or more Location 'codes' do not exist in database, this version (more strict) of endpoint returns HTTP Status Code 404 - NotFound while it lists wrong codes in the Response body. \
            <br>Please use Version 2 of this endpoint (more relaxed) that returns data for all 'codes' that the macth is found for, while lists in 'X-DP-Validation' Response Header those that didn't match

## Path parameters

- `codes` string, required

## Query parameters

- `sort` string
- `format` string

## Response `200`

Returns a list of all Locations filtered by (1) ISO 3166-1 (alpha-3), (2) ISO 3166-1 (alpha-2) or (3) ISO 3166-1 (numerical M49) codes.

- LocationFlatDto[]
  - `id` integer
  - `name` string, nullable
  - `iso3` string, nullable
  - `iso2` string, nullable
  - `longitude` number, double, nullable
  - `latitude` number, double, nullable

## Other responses

- `400`: Returns Status 400 BadRequest if 'codes' do not exist or different types of 'codes' are mixed together or 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 or 'code(s)' passed in do not exist in the database. Response body contains the list of all non-existent 'codes'.
- `406`: Not Acceptable
- `500`: Returns Status 500 Internal Server Error if an exception is thrown from the Database, Repository or Web API code.

---

[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)
