Getting Started

Get access, authenticate, and make your first Trade API call.
View as Markdown

This guide walks you through authenticating with the Trade API and making your first request. By the end, you’ll have a working access token and a confirmed connection to the API.

What You Need

  • A NinjaTrader account with a username and password.
  • API credentials: a client ID (cid) and secret (sec) issued by NinjaTrader. Keep your sec out of public repositories and client-side code.
  • A device identifier: a string of up to 64 characters that permanently identifies the device making requests. You can generate one with a package like DeviceId for C# or device-uuid for JavaScript.

All examples on this page use the Demo environment (demo.tradovateapi.com). Swap in live.tradovateapi.com when you’re ready for Live trading.

1

Get an access token

Exchange your credentials for an access token by calling accessTokenRequest:

cURL
$curl -X POST https://demo.tradovateapi.com/v1/auth/accesstokenrequest \
> -H "Content-Type: application/json" \
> -H "Accept: application/json" \
> -d '{
> "name": "<your username>",
> "password": "<your password>",
> "appId": "Sample App",
> "appVersion": "1.0",
> "cid": 8,
> "sec": "f03741b6-f634-48d6-9308-c8fb871150c2",
> "deviceId": "123e4567-e89b-12d3-a456-426614174000"
> }'

A successful response includes your access token and its expiration time:

1{
2 "accessToken": "<your access token>",
3 "mdAccessToken": "<your market data access token>",
4 "expirationTime": "2021-06-15T15:40:30.056Z",
5 "userStatus": "Active",
6 "userId": 15460,
7 "name": "example-user",
8 "hasLive": true,
9 "outdatedTaC": false,
10 "hasFunded": true,
11 "hasMarketData": true,
12 "outdatedLiquidationPolicy": false
13}

Save your accessToken for REST requests and WebSocket connections to the trading API. If you plan to use the Market Data API, save the mdAccessToken as well.

Tokens last about 90 minutes. To keep a long-running application connected, call renewAccessToken before the token expires rather than requesting a new one. See Authentication & Access for the full token lifecycle, session limits, and two-factor authentication details.

2

Make your first call

Confirm your token works by listing your accounts. Send it as a Bearer value in the Authorization header:

cURL
$curl -X GET 'https://demo.tradovateapi.com/v1/account/list' \
> --header 'Accept: application/json' \
> --header 'Authorization: Bearer <your access token>'

A successful response returns an array of your accounts with their IDs, names, and account details. If you get an HTTP 401 response, your token may be expired or incorrectly formatted.

3

Explore the API

With a working token, you’re ready to build. A few common starting points:

  • Place an order. Call order/placeorder to submit a trade.
  • Check your positions. Call position/list to see your open positions.
  • Stream real-time updates. Open a WebSocket connection to receive order and position events in real time without polling.

Browse the REST API Endpoints for the full list of available operations, or read API Conventions for query and submission patterns.

Next Steps

  • Review Authentication & Access for session limits, token renewal, and two-factor authentication.
  • If your application authenticates other users, see OAuth Integration to delegate authentication to NinjaTrader.
  • Read API Conventions to understand how the API structures queries and submissions.
  • Connect to the WebSocket for real-time order and position updates.
  • Use the Market Data API for real-time quotes, depth of market, and charts.