Welcome to the United Nations
Portal accessibility toolbar
Increase contrast
Increase font size
Decrease font size
Reset page style

API documentation

About the Indicators API

The UN Water Indicators API provides access to data accumulated for various sources. Most of these indicators are available online. The API provides programmatic access to this same data. Many data series date back over 50 years, and can be used to create interesting applications.

The Indicators API provides access to databases, including:

  • WHO
  • UNDP
  • UNICEF
  • FAO
  • And many more

How to use the Indicators API

 For example: https://sdg6data.org/api/indicator/6.1.1?_format=json

Besides making calls to the API using an application or custom program, you can also put any of the example API URL endpoints given in the documentation, or your own custom calls, into a web browser and view the results. If you choose to receive the result in JSON format you can use the JSON View Firefox plugin for easily viewing JSON results directly in Firefox.

There are also third party applications and libraries that can make using the API easier depending on your objectives. 

Please check the Basic call structure below:

The API documentation below shows how these data can be accessed for usage within your application.

https://sdg6data.org/api/indicator/{indicator_code}?_format=xml

Request Parameters:

{indicator_code} – This can be any SDG 6 Indicator code. Indicator code is a part of API URL and it is a mandatory to pass in API call.

https://sdg6data.org/api/indicator/6.1.1?_format=xml

Above URL will return data for all the year and all country of 6.1.1

_format : Output format. API supports 2 format. xml or json. This parameter is Mandatory as per Drupal 8 RESTful Webservice Standards.

https://sdg6data.org/api/indicator/6.1.1?_format=xml

https://sdg6data.org/api/indicator/6.1.1?_format=json

per_page : number of results per page, for pagination of the result-set. Default setting is 50

https://sdg6data.org/api/indicator/6.1.1?_format=xml&per_page=20

page – utility parameter for paging through a large result-set. Indicates the page number requested from the recordset.

https://sdg6data.org/api/indicator/6.1.1?_format=xml&page=2

date – date-range by year, month or quarter that scopes the result-set. A range is indicated using the colon separator

https://sdg6data.org/api/indicator/6.1.1?_format=xml&date=2000:2001

Display all the Indicator data using indicator query with multiple countries parameters

https://sdg6data.org/api/indicator/6.1.1?_format=json&country=CAN,ALB

Display all the Indicator data using indicator query

https://sdg6data.org/api/indicator/all?_format=json

Indicator API Queries

Indicators represent data like National, Urban, Rural Areas , water availability and use, water resource management, number of deaths, number of missing and many more. Indicator queries return the following information in the response:

  • Goal
  • Target
  • Indicator
  • SeriesCode
  • SeriesDescription
  • GeoAreaType
  • GeoAreaName
  • GeoAreaCode
  • TimePeriod
  • Value
  • Time_Detail
  • Source
  • FootNote
  • Nature
  • Units
  • Age
  • Bounds
  • Frequency
  • Level_Status
  • Location
  • Reporting_Type
  • Sex

Sample Request Format: Indicator Query

To request all indicators: https://sdg6data.org/api/indicator/all?_format=json

To request the indicator 6.1.1, use its indicator code,

6.1.1

Sample Response Format: Indicator Query

<response>
<item key="0">
<page>0</page>
<pages>11593</pages>
<per_page>50</per_page>
<total>579635</total>
</item>
<item key="1">
<item key="0">
<Goal/>
<Target/>
<Indicator>6.1.1
</Indicator>
<SeriesCode/>
<SeriesDescription>Drinking water, At least basic service</SeriesDescription>
<GeoAreaType>Country</GeoAreaType>
<GeoAreaName>ABW</GeoAreaName>
<GeoAreaCode>533</GeoAreaCode>
<TimePeriod>2000</TimePeriod>
<Value>94.488806355508</Value>
<Time_Detail/>
<Source>WHO, UNICEF</Source>
<FootNote/>
<Nature/>
<Units/>
<Age/>
<Bounds/>
<Frequency/>
<Level_Status/>
<Location>National</Location>
<Reporting_Type/>
<Sex/>
<SDG_6_Data_Portal_level><![CDATA]6.1.1 Proportion of population using safely managed drinking water service (%) > At least basic service > National
[{
  "page":0,
  "pages":11593,
  "per_page":50,
  "total":579635
  },
  [{
  "Goal":null,
  "Target":null,
  "Indicator":"6.1.1",
  "SeriesCode":null,
  "SeriesDescription":"Drinking water, At least basic service",
  "GeoAreaType":"Country",
  "GeoAreaName":"ABW",
  "GeoAreaCode":"533",
  "TimePeriod":"2000",  
  "Value":"94.488806355508",
  "Time_Detail":null,
  "Source":"WHO, UNICEF",
  "FootNote":null,
  "Nature":null,
  "Units":null,
  "Age":null,
  "Bounds":null,
  "Frequency":null,
  "Level_Status":null,
  "Location":"National",
  "Reporting_Type":null,
  "Sex":null,
  "SDG_6_Data_Portal_level":"6.1.1 Proportion of population using safely managed drinking water service (%) \u003E At least basic service \u003E National"
  }]
 ]

Sample Response Format: Indicator Query with country filter :

[{"page":0,
"pages":2804,
"per_page":50,
"total":140199},
[{"Goal":null, 
"Target":null, 
"Indicator":"6.1.1", 
"SeriesCode":null, 
"SeriesDescription":"Drinking water, At least basic service", 
"GeoAreaType":"Country", 
"GeoAreaName":"ABW", 
"GeoAreaCode":"533", 
"TimePeriod":"2000", 
"Value":"94.488806355508", 
"Time_Detail":null, 
"Source":"WHO,UNICEF", 
"FootNote":null, 
"Nature":null, 
"Units":null, 
"Age":null, 
"Bounds":null, 
"Frequency":null, 
"Level_Status":null, 
"Location":"National", 
"Reporting_Type":null, 
"Sex":null, 
"SDG_6_Data_Portal_level":"6.1.1 Proportion of population using safely managed drinking water service (%) \u003E At least basic service \u003E National"}]

You can download country list with ISO3 codes here

API Access / Authentication

API keys and other authentication methods are no longer necessary to access the API.