Documentation

Obtain an Access Token

Access tokens are the keys used for API access. These tokens should be protected like passwords! You can obtain an access token by exchanging an authorization code. This call is authenticated using Basic Authentication implemented in HTTP specification. Your application consumer key will serve as your username and the consumer secret the password.

Unlike other requests to the Tradier API, this request only returns JSON due to the OAuth 2.0 specification and for compatibility with most OAuth clients.

Endpoint

Method
POST
URL
/v1/oauth/accesstoken

Headers

Content-type
application/x-www-form-urlencoded
Authorization
HTTP Basic Authentication
Username: Your application consumer key
Password: Your application consumer secret

Form Parameters

code
the authorization code received in the previous callback
grant_type
Value MUST be set to "authorization_code".

Response

Field Description
access_token your access token
expires_in time in seconds before token expires
scope authorized scope of the token
issued_at Date timestamp when the token was issued
status Current status of the token -- this is for future use only.

Example

Command

$ curl -X POST https://api.tradier.com/v1/oauth/accesstoken -d "grant_type=authorization_code&code=PRpnf1o7"

Request

POST /oauth/accesstoken HTTP/1.1
Host: api.tradier.com
Accept: */*
Authorization: Basic OUkyWGpoZWRHYlBxYUlOZEd2SzBWdXRadEpwTDRIOU46R0tWS3E1akpNc0hTUlZsMQ==
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=PRpnf1o7

Response

HTTP/1.1 200 OK
Content-Type: application/json
Accept: */*
Host: api.tradier.com

{
  "access_token": "oG8RUzo33zKy3gghjkGh2au2LEWA8",
  "expires_in": 86399,
  "issued_at": "2014-05-28T09:33:35-04:00",
  "scope": "read write trade market stream",
  "status": "approved"
}


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.