Documentation

Obtain an Authorization Code

Authorization codes are created when a user authorizes your application for access to their account. You can enable a user to do this by sending them to a specific URL.

Scopes

Scopes are used to give a level of access control to our customers. When a customer approves access to an application, they will be prompted to approve the scope of your application. The scope is enforced at the access token level and cannot be changed without asking a user to authorize your application again.

Available scopes:

Scope Description
read Read-only access to account data
write Read/Write access to account data (does not include placing or updating trades)
market Access market data (does not include streaming)
trade Update and place trades
stream Create streaming sessions for use with the Streaming API

Exchange

If the user authorizes your application, a call will be made to the callback URL registered with your application. That callback will look something like:

http://mycallbackurl.example.com?code={authcode}&state={state}

  • code - Your authorization code
  • state - The same unique string you sent in the request above

Note: The reason the state is sent back to you is to make sure no-one is tampering with this exchange. If it’s different than the original you should abort the exchange and start over.

If everything checks out, you’ve got an authorization code you can exchange for an access token (Congrats!).

Endpoint

Method
GET
URL
/v1/oauth/authorize?client_id={consumer key}&scope={scopes}&state={state}

Query Parameters

client_id
Your application consumer key
Required: true
scope
Comma-delimited list of required scopes for your application to function
Required: true
state
Any unique string generated by your application
Required: true

Response

Since this call should be made in a browser, a successful response will be a 302 redirect to Tradier Brokerage’s web site where the user can log in and authorize.

Example

Command

$ curl https://api.tradier.com/v1/oauth/authorize?client_id=098f6bcd4621d373cade4e832627b4f6&scope=read&state=ohai

Request

GET /oauth/authorize?client_id=098f6bcd4621d373cade4e832627b4f6&scope=read&state=ohai HTTP/1.1
Host: api.tradier.com
Accept: */*

Response

HTTP/1.1 302
Location: https://brokerage.tradier.com/oauth/authorize?client_id=098f6bcd4621d373cade4e832627b4f6&scope=read&state=ohai
Content-Length: 0

Tradier Inc. and its corresponding technology services (including API services) are distinct and separate from the services provided by Tradier Brokerage Inc. For more information regarding the services of Tradier, Inc., please contact techsupport@tradier.com. For more information regarding the services of Tradier Brokerage, Inc. please contact service@tradierbrokerage.com. Tradier Brokerage Inc. Member FINRA/SIPC

© 2017 Tradier Inc.
  • 11016 Rushmore Drive, Suite 350
  • Charlotte, NC 28277

All materials contained on this site and specifically the API documentation pages are protected by United States copyright law and may not be copied, reproduced, distributed, transmitted, displayed, published or broadcast without the prior written permission of Tradier Inc. The Structure, Format, Layout, Examples and Design of the pages are owned by Tradier Inc, and any efforts to willfully or accidently duplicate a whole or part of the pages on this site is a violation of United States copyright law.