Norges Bank

API for open data

Data queries are performed against the REST API through the following URL / query string:

RESOURCE

The service is available through  https.
The service entrypoint is data.norges-bank.no/api.
The resource for data queries is data.
In addition to data queries, metadata can be queried. The resources for these queries are described in the  SDMX REST specification. Metadata queries return XML according to the  SDMX-ML specification.

The identifier of the dataflow («dataset») that is being queried.

Consists of the dataflow identificator and optionally a version number (if multiple versions of the dataflow exist) separated by a comma. If version is omitted the latest version of the flow will be returned. 

Example: EXR, 2.0 (with versioning) EXR (without versioning) identifies the exchange rate dataflow.

An overview of the available dataflows can be found in available data. The service also offers programmatic access to information about what data is available (see the specification). A broad range of metadata can be retrieved but given the limited set of data published by the bank, a call to retrieve details on available dataflows will be sufficient for most use cases: https://data.norges-bank.no/api/dataflow/all?references=children

The key specifies what data should be returned by the dataflow. Each dataflow consists of a set of dimensions that together uniquely identify what data should be retrieved from the flow. This is called a series key in SDMX. 

As an example the dataflow for exchange rates consists of the following dimensions: 

  1. The frequency of observations (B for business day)
  2. The base currency  (e.g. CHF)
  3. The quote currency (always NOK)
  4. The type of rate (always SP for spot)

In order to build the key the dimensions are joined together with a dot. For the above example this would result in: D.CHF.NOK.SP.

The available data section contains details about each dataflows dimensions. This information can also be obtained programmatically. For the EXR dataflow the call would be: https://data.norges-bank.no/api/dataflow/all/EXR?detail=full&references=descendants.

Wildcards can be used by omitting a value for the dimension: D..NOK.SP will return exchange rates for all currencies.

The OR  operator can be used to specify multiple values: D.CHF+USD.NOK.SP will return exchange rates for Swiss francs and US dollars. 

PARAMETERS

Limits what observations should be retrieved by specifying a date range. The supplied values should be formatted according to ISO 8601. The supported formats will depend on what frequencies the dataflow offers. 
  • Year: YYYY (2012)
  • Quarter: YYY-MM-DD (2012-Q4)
  • Month: YYYY-MM (2012-11)
  • Day: YYYY-MM-DD (2012-11-05)

StartPeriod=2011&EndPeriod=2015 will retrieve observations from 2011 to 2015.

StartPeriod=2011 will retrieve observations from 2011 to the last available data.

EndPeriod=2015 will retrieve observations from the first available observation until (and including) 2015.

Can be used to restrict the number of observations returned counting from the start or the end of the series.

If a series starts in 1990  firstNObservations=3 will return observations  for 1990, 1991 and 1992.

If a series ends in 2016 lastNObservations=3 will return observations for 2014, 2015 and 2016.

The detail parameter is used to specify the level of detail of the response from the service. 

Norges Bank publishes a limited set of data. In most cases the default setting of full will not overwhelm clients with data. Other possible values are:

  • full – Everything is returned (default)
  • dataonly – Attributes are excluded from the returned message
  • serieskeysonly – Only series are returned without observations or attributes. Can be used to list the series matching a query.
  • nodata – Series and attributes are returned, but no data.

The format parameter is used to specify how the return messages content should be formatted. The default setting is XML (SDMX structure specific).

FormatValue
XML

Structure specific sdmx-compact-2.1  Documentation

Generic sdmx-generic-2.1Documentation

 
JSON

SDMX-JSON sdmx-jsonDocumentation

The format is in beta.

Excel

Only codes excel

Include names excel-both

CSV

Periods on rows csv

Periods on columns (time series) csv-ts

Indicates the language the API should return. In addition the parameter specifies the decimal separator to be used in the csv format. The API supports English en and Norwegian no.
Use this parameter for specifying a custom name for the file returned by the service.

EXAMPLES

The last published (lastNObservations=1) business day (B) exchange rate for all currencies(the empty value specifies "all") in JSON format (format=sdmx-json) from the EXR dataflow (latest version):
https://data.norges-bank.no/api/data/EXR/B..NOK.SP?lastNObservations=1&format=sdmx-json
The monthly (M) exchange rate for Swiss francs (CHF) and (+) US dollars (USD) since 2010 (startPeriod=2010) as XML (format=sdmx-compact-2.1) from the EXR dataflow (latest version).

https://data.norges-bank.no/api/data/EXR/M.CHF+USD.NOK.SP?startPeriod=2010&format=sdmx-compact-2.1

All monthly(M) exchange rates for Swiss francs (CHF) as a delimited flatfile (csv) with English locale (locale=en): full stop as decimal sign and semicolon as delimiter.
https://data.norges-bank.no/api/data/EXR/M.CHF.NOK.SP?format=csv&locale=en 
Published 19 May 2017 13:00
Published 19 May 2017 13:00