> This page is for NT Prop.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://partner.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://partner.ninjatrader.com/_mcp/server.

# Environments

> API environments (Live and Demo), their URLs, and configuration for the NinjaTrader Partner API

The NinjaTrader Partner API has two **environments** — **Live** and **Demo** — the trading mode an operation runs in. (This is the term the product uses: the Admin Dashboard labels its selector "Environment: Live" / "Environment: Demo.") Each environment is reachable on two sets of URLs: **staging** (for integration testing) and **production** (for real operations). Understanding both is crucial for building a reliable integration.

## Quick Start

#### Staging URLs

Use these for testing and integration work:

* **API Base**: `https://live-api.staging.ninjatrader.dev/v1` (Live) or `https://demo-api.staging.ninjatrader.dev/v1` (Demo)
* **WebSocket**: `wss://live-api.staging.ninjatrader.dev/v1/websocket` or `wss://demo-api.staging.ninjatrader.dev/v1/websocket`
* **Client Access**: `https://trader.staging.ninjatrader.dev/` or `https://web.staging.ninjatrader.dev/`

#### Production URLs

Use these for real operations:

* **API Base**: `https://live.tradovateapi.com/v1` (Live) or `https://demo.tradovateapi.com/v1` (Demo)
* **WebSocket**: `wss://live.tradovateapi.com/v1/websocket` or `wss://demo.tradovateapi.com/v1/websocket`
* **Client Access**: `trader.tradovate.com` or `web.ninjatrader.com`

## Environments: Live and Demo

An **environment** is the trading mode an operation runs in:

* **Live**: Real trading with real money and positions. Any live accounts you own show up in the Live environment. The Live environment must be used to manage certain entities like Tradovate subscriptions, market data subscriptions, and user plugins.
* **Demo**: Simulated trading for evaluation and testing. All of your Demo accounts show up in the Demo environment.

## Staging vs. Production URLs

Staging and production are **not** environments — they are which set of URLs you connect to. Each environment (Live and Demo) is reachable on both:

* **Staging URLs** (`*.staging.ninjatrader.dev`): testing and integration work — test your integration before going live, experiment with new features, and debug issues without affecting real users.
* **Production URLs** (`*.tradovateapi.com`): real client operations and real trading. Use these once your integration has been thoroughly tested and you're ready to serve actual customers.

## API Base URLs

### Staging

* **Live**: `https://live-api.staging.ninjatrader.dev/v1`
* **Demo**: `https://demo-api.staging.ninjatrader.dev/v1`

### Production

* **Live**: `https://live.tradovateapi.com/v1`
* **Demo**: `https://demo.tradovateapi.com/v1`

## Client Access Points

Your users access their accounts through these client applications:

### Staging

* **Tradovate**: `https://trader.staging.ninjatrader.dev/`
* **NinjaTrader**: `https://web.staging.ninjatrader.dev/`

These are your staging point-of-access for clients. When you create a user, you can test their experience using one of these clients.

### Production

* **Tradovate**: `trader.tradovate.com`
* **NinjaTrader**: `web.ninjatrader.com`

These are your production point-of-access for real clients. When a user signs up, they can access their evaluation accounts via one of these clients, the Tradovate or NinjaTrader standalone applications, or the TDV or NT mobile apps.

### Admin Dashboards

* **Staging**: `dashboards.staging.ninjatrader.dev`
* **Production**: `dashboards.tradovate.com`

Use these to manage your users and monitor your integration.

## WebSocket URLs

### Real-Time User Data WebSockets

#### Staging

* `wss://live-api.staging.ninjatrader.dev/v1/websocket` OR
* `wss://demo-api.staging.ninjatrader.dev/v1/websocket`

#### Production

* `wss://live.tradovateapi.com/v1/websocket` OR
* `wss://demo.tradovateapi.com/v1/websocket`

Use the Live or Demo URL for real-time updates in that environment.

### Market Data WebSockets

#### Staging

* `wss://md-api.staging.ninjatrader.dev/v1/websocket`

#### Production

* `wss://md.tradovateapi.com/v1/websocket`

### Market Replay WebSockets

Market Replay is a trader-facing feature for replaying historical market sessions. These URLs serve that feature rather than partner integrations.

#### Staging

* `wss://replay.staging.ninjatrader.dev/v1/websocket`

#### Production

* `wss://replay.tradovateapi.com/v1/websocket`

When using a Market Replay socket, forward all messages (both market data and real-time user data) through the replay socket. Expect all messages from the replay session to come through the replay socket.

## Environment Differences

### Live Environment Capabilities

* Change Tradovate Subscription details
* Cancel or renew subscriptions manually
* Immediately expire a subscription
* Change user plugins (such as TradingView)

### Demo Environment Capabilities

* Change Demo accounts' permissions
* Adjust Demo accounts' max-net liquidities
* Change the Risk Category of a Demo account, useful for:
  * Applying a halted-trading category for an individual account
  * Upgrading an account to a new type
  * Changing an account's baseline risk rules
* Halt trading for an entire category (useful to stop all, or specific categories of, users from trading in an emergency)
* Return an account to its SOD state at a given date (by session date, not calendar date)

## Best Practices

### Choosing where to work

* **Start on staging**: Use the staging URLs for all testing and integration work.
* **Test thoroughly**: Only move to the production URLs when you're confident in your implementation.
* **Use Demo first**: Test in the Demo environment before using Live, even on the production URLs.

### URL Configuration

* **Store URLs as variables**: Store the staging and production URLs as configuration variables in your application.
* **Use URL-set-specific credentials**: Use different authentication credentials for each URL set (staging / production).
* **Handle errors gracefully**: Implement proper error handling for API responses.

### WebSocket Connections

* **Choose the right URL**: Use the appropriate WebSocket URL for your environment and data type.
* **Implement reconnection logic**: WebSocket connections can drop, so implement proper reconnection logic.