New Customer Offer: Pay 0% interest for up to six months on $5K USD when you join Questrade with code 0MARGIN. Open a new margin account.

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.

General error response
PropertycodeTypeStringDescriptionError code.
PropertymessageTypeStringDescriptionError description.

Sample

Plain text
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.

Order processing error response
PropertycodeTypeStringDescriptionError code.
PropertymessageTypeStringDescriptionError description.
PropertyorderIdTypeIntegerDescriptionInternal unique identifier assigned to the order
PropertyordersTypeComplexDescriptionList of Order records
Property Nested property, level 2. ordersType ComplexDescription See Order record in the above sections of this document

Sample order error response (no order created)

Plain text
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)

Plain text
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": [
                ...
       ]
     }
Sample order error response (order created)
HTTP status code404HTTP status messageNot FoundError code1001Error messageInvalid endpoint.
HTTP status code400HTTP status messageBad RequestError code1002Error messageInvalid or malformed argument.
HTTP status code400HTTP status messageBad RequestError code1003Error messageArgument length exceeds imposed limit.
HTTP status code400HTTP status messageBad RequestError code1004Error messageMissing required argument.
HTTP status code413HTTP status messageRequest Entity Too LargeError code1005Error messageRequest length exceeds imposed limit.
HTTP status code429HTTP status messageToo Many RequestsError code1006Error messageRate limit exceeded.
HTTP status code500HTTP status messageInternal Server ErrorError code1007Error messageIQ servers responded with a business error.
HTTP status code500HTTP status messageInternal Server ErrorError code1008Error messageIQ servers responded with a technical error.
HTTP status code500HTTP status messageInternal Server ErrorError code1009Error messageIQ servers responded with an unexpected error.
HTTP status code502HTTP status messageBad GatewayError code1010Error messageIQ servers produced an invalid response.
HTTP status code503HTTP status messageGateway TimeoutError code1011Error messageIQ servers did not produce a response before a timeout.
HTTP status code405HTTP status messageMethod Not AllowedError code1012Error messageMethod unsupported by endpoint (e.g., GET vs. POST).
HTTP status code400HTTP status messageBad RequestError code1013Error messageRequesting anything other than ‘application/json’.
HTTP status code401HTTP status messageUnauthorizedError code1014Error messageMissing authorization header.
HTTP status code400HTTP status messageBad RequestError code1015Error messageMalformed authorization header.
HTTP status code403HTTP status messageForbiddenError code1016Error messageRequest is out-of-allowed OAuth scopes.
HTTP status code401HTTP status messageUnauthorizedError code1017Error messageAccess token is invalid.
HTTP status code404HTTP status messageNot FoundError code1018Error messageAccount number not found.
HTTP status code404HTTP status messageNot FoundError code1019Error messageSymbol not found.
HTTP status code404HTTP status messageNot FoundError code1020Error messageOrder not found.
HTTP status code500HTTP status messageInternal Server ErrorError code1021Error messageUnexpected error (with undefined handling).

Downloads

C plus plus

C ++

Downloads
Dec 18, 2015Version 1.1.0
Release notesDownload API (opens in a new tab)
C sharp

C #/Active X

Downloads
Dec 18, 2015Version 1.1.0
Release notesDownload API (opens in a new tab)

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.

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.

If you are using an api app developed by a third party, you are required to read, understand and accept the end-user license agreement for application program interface. If you are utilizing api access for an api-enabled app you built, you are required to read, understand and accept the Questrade personal application program interface ("api") license agreement ("license agreement"). This agreement can be found below. You may be bound by both agreements.

See All