Skip to navigation

API Keys

View as Markdown

Secure API key authentication for server-to-server communication and automated trading systems, providing high-performance access to the NinjaTrader Partner API.

Overview

API keys provide a secure, efficient authentication method for server-to-server integrations, automated trading systems, and backend applications. API keys don’t require user interaction, making them ideal for automated workflows and risk management.

API Key Types

Production API Keys

  • Use Case: Real users and production

Staging API Keys

  • Use Case: Development and testing

API Key Structure

When you receive an API key, it will include the following fields:

{
"name": "string",
"password": "string",
"appId": "string",
"appVersion": "1.0",
"sec": "string",
"cid": 0
}

appId and appVersion are free-form strings you choose; they are shown to end users in the trading UI.

When you request an access token, you can also include a deviceId: a string of up to 64 characters that uniquely and permanently identifies the device. It’s optional but recommended.

Generating an API Key

Generate your own API key in Web Trader (the recommended approach; NinjaTrader can also create one for you):

  1. Log in to Web Trader.
  2. Click Application Settings in the top right and select the API Access tab.
  3. Click the type of API key to generate.
    • For OAuth-based access, you must provide a redirect URI. See Setting Up OAuth for the full flow.
  4. Complete the fields, set the permissions, and click Generate.
  5. Save the client ID (cid) and secret (sec) somewhere secure.