Frequently Asked Questions     How To?     Contact Us     Disclaimer     Developer Guide   
 

Welcome to the EasyData APIs/Data Services

EasyData offers programmatic access to data and metadata through web services, APIs that allow machine-to-machine communication. EasyData API provides users an easy yet powerful way to retrieve data and metadata at series level and use it in their programs.


What are the pre-requisites to use EasyData APIs?

Users need to have an active user account and an API Key to use EasyData APIs. The API Key is valid for 90 days, after which it needs to be regenerated.


How to get API Key?

Users can obtain API Key by following the steps given below:

  1. Go to 'My Data Basket' option available at the top right of your screen.

  2. Go to Login tab shown at the top left of your screen.

  3. Enter your registered email address and password in the given boxes.

  4. Press Submit.

  5. Go to My Account tab shown at the top left of your screen.

  6. Press Generate API Key.

  7. API Key is now available on same screen with its Start and End Date.


API Call Rate Limits

Following limits are placed on the number of API requests for each API Key:

  • Daily Limit: 2,000 requests per day

  • Hourly Limit: 250 requests per hour

The limits are applied across all API calls.


Which APIs are available ?

Presently, EasyData offers following APIs to download both data and metadata at series level:

1. Get Series Data
2. Get Series Metadata

1. Get Series Data

This API is used to retrieve series data in desired format (csv or json). Default is json.

HTTP Request (GET):
https://easydata.sbp.org.pk/api/v1/series/[series_key]/data?[parameter-list]

where [series_key] is fully qualified series key of desire indicator/variable, and [parameter-list] is a list of standard HTTP GET request parameter. Below is the list of parameters applicable for this API:

Query Parameters

Parameter Mandatory Type (format) Default Description
api_key yes string none API key can be generated from My Data Basket under My Account after login.
start_date no ISO Date (YYYY-MM-DD) none The start of a date range when requesting data for a range of dates. If both start_date and end_date are not specified, the API will return only the most recent observation.
end_date no ISO Date (YYYY-MM-DD) Today The end of the date range, when requesting data for a range of dates. If both start_date and end_date are not specified, the API will return only the most recent observation.
format no string json 'json' is the default format; 'csv' is also supported.

Python Example

import requests

res = requests.get("https://easydata.sbp.org.pk/api/v1/series/TS_GP_BOP_WR_M.WR0010/data?api_key="+

                           "FE72FE1E90D209A8AAB3E8DC83B9B8D49511BCE8" ,verify = False)

print(res.text)

Output : '{"columns": ["Dataset Name", "Series Key", "Series Name", "Observation Date", "Observation Value", "Unit", "Observation Status", "Status Comments"], "rows": [["Country-wise Workers\' Remittances", "TS_GP_BOP_WR_M.WR0010", "Total Cash inflow of Workers\' remittances in Pakistan in a month", "2022-07-31", "2523.753816", "Million USD", "Normal", ""]]}'

R Example

api_key <- "FE72FE1E90D209A8AAB3E8DC83B9B8D49511BCE8"

download.file(

    url = paste0(
    "https://easydata.sbp.org.pk/api/v1/series/TS_GP_BOP_WR_M.WR0010/data?api_key=",
    api_key
    ),
  destfile = "output.json",
  mode = "wb",

  method = "curl"

)


2. Get Series Metadata

This API is used to get series metadata in desired format (csv or json), default format is json.

HTTP Request (GET):
https://easydata.sbp.org.pk/api/v1/series/[series_key]/meta?[parameter-list]

where [series_key] is fully qualified series key of desire indicator/variable, and [parameter-list] is a list of standard HTTP GET request parameter. Below is the list of parameters applicable for this API:

Query Parameters

Parameter Mandatory Type (format) Default Description
api_key yes string none API key can be generated from Account Details under My Account after login.
format no string json 'json' is the default format; 'csv' is also supported.



 Welcome Guest | Login | FAQs | Contacts Us | Disclaimer | Developer Guide New Copyright © 2024, All Rights Reserved. | State Bank of Pakistan