Getting Started with the Quandl API

By 12 Permalink 0

Every single dataset on Quandl is available via our API. The API is simple, consistent and completely free to use. Here’s a quick and easy guide to get you started.


This is not meant to be a formal reference for the Quandl API; merely a quick-start guide. To read the complete and definitive documentation, please click here.
To start using the Quandl API:
Sign up for a free API key

 

Synopsis

Here is an API call for FB stock data in CSV format:

https://www.quandl.com/api/v3/datasets/WIKI/FB/data.csv

Here is the same call, with some additional parameters appended:

https://www.quandl.com/api/v3/datasets/WIKI/FB/data.csv?column_index=4&exclude_column_names=true&rows=3&start_date=2012-11-01&end_date=2013-11-30&order=asc&collapse=quarterly&transform=rdiff

The second call gets FB stock data, but only column 4 (closing prices); it skips column names, truncates the data at 3 rows, selects only data between 2012-11-01 and 2013-11-30, arranges the dates in ascending order, down-samples daily data to quarterly, and computes percentage changes.

 

Usage Rules

API usage is free for registered users; just append your API key to your call like this:

https://www.quandl.com/api/v3/datasets/WIKI/FB/data.csv?api_key=YOURAPIKEYHERE

You can find your API key on your Quandl account settings page.

(For concision, we will not be including the api_key parameter in the remaining examples on this page).

 

Quandl Codes

To download a dataset, you will need to know its “Quandl code”.  In the above example, you downloaded a dataset with the Quandl code “WIKI/FB”.

Every Quandl code has 2 parts: the database code (“WIKI”) which specifies where the data comes from, and the dataset code (“FB”) which identifies the specific time series you want.

You can find Quandl codes on our website, using our data browser.

 

Data Formats

You can get data in CSV, XML or JSON formats.  Just append your preferred format to your Quandl code.

FormatSuffixExample
CSV .csv  https://www.quandl.com/api/v3/datasets/WIKI/FB/data.csv 
XML .xml  https://www.quandl.com/api/v3/datasets/WIKI/FB/data.xml
JSON  .json  https://www.quandl.com/api/v3/datasets/WIKI/FB/data.json

 

Data Manipulation

You can customize the data you receive by passing optional parameters with your API call.  Here are some of the available options:


CustomizationParameters
Sort Order Use “order=asc|desc” to specify the order in which data is returned
Date Range Use “start_date=yyyy-mm-dd” and/or “end_date=yyyy-mm-dd”
Specific Columns  Use “column_index=m” to return only data from column m 
Truncated Rows   Use “rows=n” to return only the first n rows of data 
Data Only Use “exclude_column_names=true” to return only data rows in CSV
Data Frequency  Use “collapse=none|daily|weekly|monthly|quarterly|annual” to sample observations at your desired frequency 
Data Arithmetic  Use “transform=none|diff|rdiff|cumul|normalize” to get changes, % changes, cumulative sums, or returns from 100 

To see a full list of options and their detailed behaviour, please visit our API reference.

 

Getting Metadata

You can use the API to get metadata for the dataset you need, in JSON format, like this:

https://www.quandl.com/api/v3/datasets/WIKI/FB/metadata.json

Or if you prefer XML format, like this:

https://www.quandl.com/api/v3/datasets/WIKI/FB/metadata.xml

You can get both data and metadata in one call like this:

https://www.quandl.com/api/v3/datasets/WIKI/FB.json

Or this:

https://www.quandl.com/api/v3/datasets/WIKI/FB.xml

 

Downloading Lots of Data in One Call

For premium (subscriber-only) databases, you can download the entire database in a single call, like this:

https://www.quandl.com/api/v3/databases/YC/data?download_type=complete

If you just want the last day’s worth of data, do this:

https://www.quandl.com/api/v3/databases/YC/data?download_type=partial

 

Getting a list of datasets or databases

For a list of all databases on Quandl, do this:

https://www.quandl.com/api/v3/databases

For a list of datasets in a given database, do this:

https://www.quandl.com/api/v3/databases/WIKI/codes.json

 

Full Reference

This is not meant to be a complete reference for the Quandl API. See our full API documentation for that.

Get Started Now!

To use Quandl’s API, please sign up for a free API key:
Get Your Free API Key Now

Join more than 90,000 analysts, traders and fintech experts. Get Quandl's latest blog posts delivered directly to your inbox, once a week.

Leave a Reply

Your email address will not be published. Required fields are marked *


12 Comments
  • Craig elliott
    February 22, 2016

    I have a concern do I need an api key from quandl to use plot.y.

    • Chris Harding
      February 24, 2016

      Hello Craig! You would not need an api key to view data on plot.ly. You can simply click on the plot.ly button from any dataset page to access the data.

  • Ravinder reddy
    February 23, 2016

    how can only present trade values …….please help me….
    example i am dsplaying https://www.quandl.com/api/v3/datasets/WIKI/AAPL/data.csv?end_date=2016-02-23 , i need to display present updating values

    • Chris Harding
      February 24, 2016

      Hello Ravinder! I’m not sure I completely understand your question. Can you kindly e-mail us at connect@quandl.com with some additional information so that we can better assist?

  • Sandy Jones
    June 17, 2016

    Hi,

    Can you tell me if this

    “Quandl objects can also be configured via the .configure(options) method. Here is an exmaple:

    var Quandl = require(“quandl”);
    var quandl = new Quandl();

    var options = {
    auth_token: “dsahFHUiewjjd”
    }

    quandl.configure(options);”

    should be in an app.js file? Or should it be in its own file?
    Thanks

    • Carrie Shaw
      June 20, 2016

      Hi Sandy – Thanks for reaching out.
      You are referencing a third party integration that was written by someone outside of Quandl.
      Your best bet is to visit https://github.com/normanjoyner/node-quandl/issues and get support directly from the creator of the integration.

  • bowranger
    July 12, 2016

    Hi. I wonder how do I get certain columns?
    EG: column_index=1,3,5

    • Carrie Shaw
      July 13, 2016

      Hello –
      The best way to do this is to get the whole dataset and then remove the columns you don’t need. There is no way to just get the three columns.

  • Prashant
    August 1, 2016

    Hi. I have a query. I want end of day prices (for a given day only) for a list of stocks in one API call either in excel, json or xml format. Currently I am making one dataset API call for each stock (using dataset_code) which is not an effective way of fetching data. I need following values, OPEN, HIGH,LOW,LAST,TOTTRDQTY and TOTTRDVAL for a list of 100 stocks in a single API call.What is the best way to go about doing it?

    • Carrie Shaw
      August 2, 2016

      Hi – if you are using a premium database, you can use the bulk download feature to accomplish this. Otherwise you have to make single api calls. Can you kindly confirm the name or code of the database you are working with? I might be able to offer additional suggestions based on the database.

  • RK
    August 12, 2016

    Excellent API service, and very well documented.
    Thanks for giving this away for free! 🙂

    • Carrie Shaw
      August 12, 2016

      Glad you like it!