Rest operations

Getting started

Getting started

What can I do with the Questrade API

The Questrade API enables you to develop live or practice applications that can access your account data, retrieve market data and assist you with placing trades through your Questrade brokerage account.

If you need assistance, or to see the latest API updates, visit the forums on the Exchange. If you're interested in partnering with Questrade as a company or a developer, visit the Questrade API partnership application page.

Activating IQ API centre

Using your login credentials, log in to Questrade.

1. API welcome page

In the top right corner where you see your login name, select API centre from the drop-down menu. You will be redirected to the API welcome page providing you with more information about the API.

API welcome page

2. Activate API

Once you're ready, click Activate API.

Activate API

3. API access agreement

The API access agreement appears. You need to read and agree to the terms listed in the agreement to proceed. After clicking Agree, you will be one step closer to getting access to Questrade's API.

API access agreement

If you disagree to the terms, access to Questrade API will be denied.

Creating your first personal app

Manual authorization flow:

1. In the API Centre, click Register a personal app.

Register a personal app

2. In the create personal app section, under basic information, enter a name for your application including a brief description and click Save. The personal app is visible under personal applications.

Enter a name

Questrade uses the OAuth 2.0 authorization framework for the APIs. We recommend that you familiarize yourself with this framework before proceeding.

Authorizing your app to access the API

1. In the personal applications page, click New manual authorization.

New manual authorization

The manual authorization appears under personal applications.

The personal app will be visible under personal applications

2. Click Generate new token for manual authorization.

3. A token is generated and appears in the authorization pop-up window. Click Copy token to copy it before clicking Close.

A token is generated and appears in the authorization pop-up window

For security reasons, Questrade does not store the token information in a decrypted format after it is presented. If you forget to copy the token, you must generate a new token, or follow the revoke authorization process. The generated tokens have a limited time span and expire in 7 days from the date and time the token is generated. The time to expiry can be reviewed from the authorization section on the personal applications page.

For security reasons

4. Use the token you copied to redeem it for an access token and the server or practice server URL using the following command:

https://login.questrade.com/oauth2/token?grant_type=refresh_token&refresh_token=<refresh_token>

or

https://practicelogin.questrade.com/oauth2/token?grant_type=refresh_token&refresh_token=<refresh_token>

Sample response

{
	“access_token”: ”C3lTUKuNQrAAmSD/TPjuV/HI7aNrAwDp”,
	“token_type”: ”Bearer”,
	“expires_in”: 300,
	“refresh_token”: ”aSBe7wAAdx88QTbwut0tiu3SYic3ox8F”,
	“api_server”: ”https://api01.iq.questrade.com”
}

5. Attempt your first API call. Use the access token and server URL with the following command to make an authorized call:

Sample request command:

GET /v1/accounts HTTP/1.1
Host: https://api01.iq.questrade.com
Authorization: Bearer C3lTUKuNQrAAmSD/TPjuV/HI7aNrAwDp

Sample response:

{
	“accounts”: [
		{
			“type”: “Margin”,
			“number”: “26598145”,
			“status”: “Active”,
			“isPrimary”: true,
			“isBilling”: true,
			“clientAccountType”: “Individual”
		},
		...
	],
	“userId”: 3000124
}

That’s it! You are now ready to start making requests to Questrade’s IQ platform using your personal access token.

While you are getting accustomed to Questrade's API, you can control API access by going to Security settings in the API centre and setting the General API access option to On or Off as per your preference.

What's next?

Depending on your comfort level, you can either choose to explore Questrade's API methods directory to expand your knowledge, or you can directly access the SDKs and the sample code available for C++ and C# that's included on our website.