API Documentation

Find out details of Application Programming Interfaces (APIs) including request parameters, request headers and other requirements.

To subscribe to updates or changes for this API page, please visit the Email Subscription page, and select under Sections > Statistics

Syntax:
https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=<resource_id>&<parameters>….

Request Parameters

 Parameter Name

 Description

 resource_id

 ID of the resource to be searched.
 Format: resource_id=<resource_id>
 Example: resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6

 filters

 Filters columns based on the specified values.
 Format: filters[<field>]=<one or more values separated by comma>
 Example: filters

[end_of_month]

=2016-04,2016-05,2016-06

 between

 Filters columns based on a range.
 Format: between[<field>]=<lower value (inclusive)>,<higher value (inclusive)>
 Example: between

[end_of_month]

=2008-01,2010-12

 query

 Returns records that contain the search string (only for fields with the “text” type).
 Format: query=<string to search>
 Example: query=dollars

 offset

 Number of rows to offset in the returned results.
 Format: offset=<number of rows to offset>
 Example: offset=50

 limit

 Maximum number of rows to return (default: 100).
 The API will only return a maximum of 100 rows. If you wish to retrieve more than 100 rows, combine this with "offset" (refer to the examples below).
 Format: limit=<maximum number of rows to return>
 Example: limit=10

 fields

 Comma separated string of fields to return.
 Format: fields=<field1>,<field2>….
 Example: fields=end_of_month,m1,m2,m3

 sort

 The returned results will be sorted by this field.
 Format: sort=<field1> <asc|desc>
 Example: sort=end_of_month desc

 

Request Headers 

Header Name

Description

User-Agent

(Mandatory) String that identifies the application type, operating system, software vendor or software version of the requesting software user agent.

Format: <product> / <product-version> <comment>

 

Other Requirements 

Your client needs to support the Server Name Indication (SNI) extension.

 

Response Values (in JSON)

 Response Field

 Description

 offset

 Number of rows offset for the query.

 limit

 Maximum number of rows that is returned for the query.

 total

 Total number of rows matching the selected criteria.

 records

 List of matching results.

 timestamp

 (deprecated) This field is the current time expressed as the number of seconds that have elapsed since January 1,1970. Previously, this field represented the time the row was last updated, expressed as the number of the seconds that have elapsed since January 1, 1970. This field has been deprecated and will be removed in the near future.

Examples
The following examples are based on the Exchange Rates data published on the MAS website.

Return the 10 most recent records

 https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6&limit=10&sort=end_of_month desc

Return the rows for Jan, Apr and Jul 2015

 https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6&limit=10&filters

[end_of_month]

=2015-01,2015-04,2015-07

Return the first 100 rows between the years 2005 and 2015 for USD, Euro and Yen vs the Singapore Dollar

 https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6&limit=100&fields=end_of_month,usd_sgd,eur_sgd,jpy_sgd_100&between

[end_of_month]

=2005-01,2015-12&sort=end_of_month asc

Return the next 100 rows between the years 2005 and 2015 for USD, Euro and Yen vs the Singapore Dollar

 https://eservices.mas.gov.sg/api/action/datastore/search.json?resource_id=10eafb90-11a2-4fbd-b7a7-ac15a42d60b6&limit=100&offset=100&fields=end_of_month,usd_sgd,eur_sgd,jpy_sgd_100&between

[end_of_month]

=2005-01,2015-12&sort=end_of_month asc