Real Time APIs

Example Request For Real Time API

PM 2.5

get

https://api-open.data.gov.sg/v2/real-time/api/pm25

  • Updated hourly from NEA.

  • Readings are provided for each major region in Singapore

  • Filter for specific date or date-time by providing date in query parameter.

    • use YYYY-MM-DD format to retrieve all of the readings for that day

    • use YYYY-MM-DDTHH:mm:ss to retrieve the latest readings at that moment in time

    • example: ?date=2024-07-16 or ?date=2024-07-16T23:59:00

  • If date is not provided in query parameter, API will return the latest reading

  • The region_metadata field in the response provides longitude/latitude information for the regions. You can use that to place the readings on a map.

  • Unit of measure for readings is µg/m3.

Authorizations
Query parameters
datestringOptional

SGT date for which to retrieve data (YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)

paginationTokenstringOptional

Pagination token for retrieving subsequent data pages (only exists when there is a next page available for requests with date filters)

Responses
200
PM 2.5 Information
application/json
get
GET /v2/real-time/api/pm25 HTTP/1.1
Host: api-open.data.gov.sg
x-api-key: YOUR_API_KEY
Accept: */*
{
  "code": 1,
  "errorMsg": null,
  "data": {
    "regionMetadata": [
      {
        "name": "West",
        "labelLocation": {
          "latitude": 1.35735,
          "longitude": 103.7
        }
      }
    ],
    "items": [
      {
        "date": "2024-07-17T00:00:00.000Z",
        "updatedTimestamp": "2024-07-17T14:15:43+08:0",
        "timestamp": "2024-07-17T06:00:00.000Z",
        "readings": {
          "pm25_one_hourly": {
            "national": 24,
            "east": 18,
            "west": 12,
            "north": 11,
            "south": 8,
            "central": 7
          }
        }
      }
    ],
    "paginationToken": "b2Zmc2V0PTEwMA== (you will see this token only if next page exists)"
  }
}

Last updated

Was this helpful?