Young man smiling

Documentation

The Questrade API allows developers to create their own fully featured trading and analytical applications through their brokerage account.

Error handling

Error format

In case of not being able to successfully service a request the API will return an error response.

The API offers two categories of errors:

  1. General Error – errors that do NOT result in creation of an order with an internal identifier.
  2. Order Processing Error – errors that occur during processing of trade calls (e.g., placing, replacing, canceling an order) that result in an order being created in the platform.

General error response

General error message will consist of properties specified in the table below.

PropertyTypeDescription
code
String
Error code.
message
String
Error description.

Sample

 
  HTTP/1.1 400 Bad Request
  Content-Length: 63
  Content-Type: application/json; charset=utf-8
  Date: Fri, 18 Aug 2014 22:17:16 GMT 
      {
          "code": 3139 ,
           "message": "Invalid route" 
      }   

Order processing error response

Whenever a trading call results in the creation of an order with a unique internal identifier, the platform will return an error response with additional properties (orderId and orders) in addition to standard error fields (code and message) in the response.

PropertyTypeDescription
code
String
Error code.
message
String
Error description.
orderId
Integer
Internal unique identifier assigned to the order
orders
Complex
List of Order records
orders
Complex
See Order record in the above sections of this document

Sample order error response (no order created)

 
  HTTP/1.1 400 Bad Request
  Content-Length: 63
  Content-Type: application/json; charset=utf-8
  Date: Fri, 18 Aug 2014 22:17:16 GMT
      {
           "code": 3139,
           "message": "Invalid route"
      }  

Sample order error response (order created)

 
 HTTP/1.1 200 OK
 Content-Length: 63
 Content-Type: application/json; charset=utf-8
 Date: Fri, 18 Aug 2014 22:17:16 GMT 
      {
           "code": 3054 ,
           "message": "Order was rejected by the exchange" ,
           "orderId": 134353223 ,
           "orders": [
                ...
       ]
     } 
HTTP status
code
HTTP status messageError
code
Error message
404
Not Found
1001
Invalid endpoint.
400
Bad Request
1002
Invalid or malformed argument.
400
Bad Request
1003
Argument length exceeds imposed limit.
400
Bad Request
1004
Missing required argument.
413
Request Entity Too Large
1005
Request length exceeds imposed limit.
429
Too Many Requests
1006
Rate limit exceeded.
500
Internal Server Error
1007
IQ servers responded with a business error.
500
Internal Server Error
1008
IQ servers responded with a technical error.
500
Internal Server Error
1009
IQ servers responded with an unexpected error.
502
Bad Gateway
1010
IQ servers produced an invalid response.
503
Gateway Timeout
1011
IQ servers did not produce a response before a timeout.
405
Method Not Allowed
1012
Method unsupported by endpoint (e.g., GET vs. POST).
400
Bad Request
1013
Requesting anything other than ‘application/json’.
401
Unauthorized
1014
Missing authorization header.
400
Bad Request
1015
Malformed authorization header.
403
Forbidden
1016
Request is out-of-allowed OAuth scopes.
401
Unauthorized
1017
Access token is invalid.
404
Not Found
1018
Account number not found.
404
Not Found
1019
Symbol not found.
404
Not Found
1020
Order not found.
500
Internal Server Error
1021
Unexpected error (with undefined handling).

Downloads

C plus plus

C ++

Dec 18, 2015Version 1.1.0
Release notesDownload API
C sharp

C #/Active X

Dec 18, 2015Version 1.1.0
Release notesDownload API

Already a Questrade client?

Create your first application using your Questrade account.

Integrate your application with Questrade API

Support

Report an issue

Have questions about Questrade's API? Tell us how we can help, send us an email.

Get Started

Request a feature

We want your ideas on how we can improve our API. If you have a suggestion for a minor tweak, a major overhaul, or something brand new, please share it with us.

Get Started
See All