OAuth Integration
If your application acts on behalf of other users, use OAuth so each user authenticates with NinjaTrader directly instead of handing their credentials to your app. This page covers the authorization-code flow: the user approves your app, you receive a single-use code, and you exchange that code for an access token.
A complete, runnable Node/Express version of this flow is in the OAuth example project.
Prerequisites
- A
client_idandclient_secretissued by NinjaTrader for your application. - A redirect URI you control, registered with your credentials. NinjaTrader returns the user to this URI with the authorization code after they authenticate.
Keep your client_secret out of public access — store it in an environment variable or secret manager, not in client-side code or a public repository.
The Flow
OAuth authentication is a three-step process:
- Redirect the user to the authorize URL.
- Receive a single-use code at your redirect URI.
- Exchange the code for an access token.
Step 1 — Redirect to the Authorize URL
Send the user to the authorize endpoint with response_type=code, your client_id, and your redirect_uri:
The user sees the NinjaTrader login screen and approves your application.
For the Demo environment, use https://trader-d.tradovate.com/oauth.
Step 2 — Receive the Code
After the user authenticates, NinjaTrader redirects to your redirect_uri with a single-use code in the query string. Extract it:
Step 3 — Exchange the Code for an Access Token
Send a form-encoded POST to the token endpoint with grant_type=authorization_code and the same redirect_uri you used in Step 1:
For the Demo environment, exchange the code at https://live-api-d.tradovate.com/auth/oauthtoken.
A successful response includes an access_token and expires_in (the token’s lifetime in seconds). On failure, the response includes error and error_description.
Using the Token
Send the access token on each request using the Bearer scheme — for example, to read the authenticated user with me:
The token is valid for the expires_in window. When it expires, run the flow again to obtain a new one. For session limits and token renewal on the credential flow, see Authentication & Access.
Other grant types (such as client_credentials and jwt-bearer) exist for server-to-server and Connect integrations. They’re documented in the Connect docs, not here.

