Access fundamental information about your trading account. Retrieve details such as your account ID, currency, and current cash balance.
Trading 212 Public API (v0)
Welcome to the official API reference for the Trading 212 Public API! This guide provides all the information you need to start building your own trading applications and integrations.
This API is currently in beta and is under active development. We're continuously adding new features and improvements, and we welcome your feedback.
We provide two distinct environments for development and trading:
- Paper Trading (Demo):
https://demo.trading212.com/api/v0 - Live Trading (Real Money):
https://live.trading212.com/api/v0
You can test your applications extensively in the paper trading environment without risking real funds before moving to live trading.
Please be aware of the following limitations for any order placement:
- Supported account types: The Trading 212 Public API is enabled and usable only for Invest and Stocks ISA account types.
- Live trading order types: For the live (real money) environment, only Market Orders are supported for execution via the API.
- Order execution: Orders can be executed only in the primary account currency
- Multi-currency: Multi-currency accounts are not currently supported through the API. Meaning your account, position and result values in the responses will be in the primary account currency.
- Authentication: Every request to the API must be authenticated using a secure key pair. See the Authentication section below for details.
- Rate Limiting: All API calls are subject to rate limits to ensure fair usage and stability. See the Rate Limiting section for a full explanation.
- IP Restrictions: For enhanced security, you can optionally restrict your API keys to a specific set of IP addresses from within your Trading 212 account settings.
- Selling Orders: To execute a sell order, you must provide a negative value for the
quantityparameter (e.g.,-10.5). This is a core convention of the API.
This simple example shows you how to retrieve your account's cash balance.
First, you must generate your API keys from within the Trading 212 app. For detailed instructions, please visit our Help Centre:
Once you have your API Key and API Secret, you can make your first call using cURL:
# Step 1: Replace with your actual credentials and Base64-encode them.
# The `-n` is important as it prevents adding a newline character.
CREDENTIALS=$(echo -n "<YOUR_API_KEY>:<YOUR_API_SECRET>" | base64)
# Step 2: Make the API call to the live environment using the encoded credentials.
curl -X GET "https://live.trading212.com/api/v0/equity/account/cash" \
-H "Authorization: Basic $CREDENTIALS"The API uses a secure key pair for authentication on every request. You must provide your API Key as the username and your API Secret as the password, formatted as an HTTP Basic Authentication header.
The Authorization header is constructed by Base64-encoding your API_KEY:API_SECRET string and prepending it with Basic .
To ensure high performance and fair access for all users, all API endpoints are subject to rate limiting.
IMPORTANT NOTE: All rate limits are applied on a per-account basis, regardless of which API key is used or which IP address the request originates from.
Specific rate limits are detailed in the reference for each endpoint.
Every API response includes the following headers to help you manage your request frequency and avoid hitting limits.
x-ratelimit-limit: The total number of requests allowed in the current time period.x-ratelimit-period: The duration of the time period in seconds.x-ratelimit-remaining: The number of requests you have left in the current period.x-ratelimit-reset: A Unix timestamp indicating the exact time when the limit will be fully reset.x-ratelimit-used: The number of requests you have already made in the current period.
The rate limiter allows for requests to be made in bursts. For example, an endpoint with a limit of 50 requests per 1 minute does not strictly mean you can only make one request every 1.2 seconds. Instead, you could:
- Make a burst of all 50 requests in the first 5 seconds of a minute. You would then need to wait for the reset time indicated by the
x-ratelimit-resetheader before making more requests. - Pace your requests evenly, for example, by making one call every 1.2 seconds, ensuring you always stay within the limit.
In addition to the general rate limits on HTTP calls, some actions have their own functional limits. For example, there is a maximum of 50 pending orders allowed per ticker, per account.
Here are some additional resources that you may find helpful.
- Trading 212 API Terms
- Trading 212 Community Forum - A great place to ask questions and share what you've built.
Equity Orders
⚠️ Order Limitations
- Orders can be executed only in the main account currency
- Only Market Orders are supported for the live (real money) environment
Place, monitor, and cancel equity trade orders. This section provides the core functionality for programmatically executing your trading strategies for stocks and ETFs.
https://demo.trading212.com/api/v0/equity/orders
https://live.trading212.com/api/v0/equity/orders
- curl
- Go
- Python
- Node.js
- Java
curl -i -X GET \
-u <username>:<password> \
https://demo.trading212.com/api/v0/equity/ordersOK
The number of shares requested in the order. A negative number indicates a sell order. Applicable to orders placed by quantity.
The current state of the order in its lifecycle.
The strategy used to place the order, either by QUANTITY or VALUE. The API currently only supports placing orders by QUANTITY.
The type of the order, which determines its execution logic.
The monetary value of the order in your account's currency. Applicable to orders placed by value. Note: Placing orders by value is not currently supported via the API but can be done through other Trading 212 platforms.
[ { "creationTime": "2019-08-24T14:15:22Z", "extendedHours": true, "filledQuantity": 0, "filledValue": 0, "id": 0, "limitPrice": 0, "quantity": 0, "status": "LOCAL", "stopPrice": 0, "strategy": "QUANTITY", "ticker": "AAPL_US_EQ", "type": "LIMIT", "value": 0 } ]
Request
Rate Limit: 1 request per 2 seconds
Creates a new Limit order, which executes at a specified price or better.
- To place a buy order, use a positive
quantity. The order will fill at thelimitPriceor lower. - To place a sell order, use a negative
quantity. The order will fill at thelimitPriceor higher.
Order Limitations
- Orders can be executed only in the main account currency
- Only Market Orders are supported for the live (real money) environment
Important: In this beta version, this endpoint is not idempotent. Sending the same request multiple times may result in duplicate orders.
The target price for the order. For a buy order, this is the maximum price you are willing to pay. For a sell order, this is the minimum price you are willing to accept.
The number of shares or units to trade. Use a positive number (e.g., 10.5) for a BUY order and a negative number (e.g., -10.5) for a SELL order. The value cannot be zero.
The unique identifier for the instrument you want to trade. You can retrieve a list of available tickers from the /equity/metadata/instruments endpoint.
Specifies how long the order remains active.
DAY: The order will automatically expire if not executed by midnight in the time zone of the instrument's exchange.GOOD_TILL_CANCEL: The order remains active indefinitely until it is either filled or explicitly cancelled by you.
https://demo.trading212.com/api/v0/equity/orders/limit
https://live.trading212.com/api/v0/equity/orders/limit
- curl
- Go
- Python
- Node.js
- Java
curl -i -X POST \
-u <username>:<password> \
https://demo.trading212.com/api/v0/equity/orders/limit \
-H 'Content-Type: application/json' \
-d '{
"limitPrice": 100.23,
"quantity": 0.1,
"ticker": "AAPL_US_EQ",
"timeValidity": "DAY"
}'OK
The number of shares requested in the order. A negative number indicates a sell order. Applicable to orders placed by quantity.
The current state of the order in its lifecycle.
The strategy used to place the order, either by QUANTITY or VALUE. The API currently only supports placing orders by QUANTITY.
The type of the order, which determines its execution logic.
{ "creationTime": "2019-08-24T14:15:22Z", "extendedHours": true, "filledQuantity": 0, "filledValue": 0, "id": 0, "limitPrice": 0, "quantity": 0, "status": "LOCAL", "stopPrice": 0, "strategy": "QUANTITY", "ticker": "AAPL_US_EQ", "type": "LIMIT", "value": 0 }
Request
Rate Limit: 50 requests per 1 minute
Creates a new Market order, which is an instruction to trade a security immediately at the next available price.
To place a buy order, use a positive
quantity.To place a sell order, use a negative
quantity.extendedHours: Set totrueto allow the order to be filled outside of the standard trading session.If placed when the market is closed, the order will be queued to execute when the market next opens.
Order Limitations
- Orders can be executed only in the main account currency
- Only Market Orders are supported for the live (real money) environment
Warning: Market orders can be subject to price slippage, where the final execution price may differ from the price at the time of order placement.
Important: In this beta version, this endpoint is not idempotent. Sending the same request multiple times may result in duplicate orders.
If 'true', allows the order to be filled outside of regular trading hours. If the order is placed when the market is fully closed, it will be queued for the next market open.
The number of shares or units to trade. Use a positive number (e.g., 10.5) for a BUY order and a negative number (e.g., -10.5) for a SELL order. The value cannot be zero.
https://demo.trading212.com/api/v0/equity/orders/market
https://live.trading212.com/api/v0/equity/orders/market
- curl
- Go
- Python
- Node.js
- Java
curl -i -X POST \
-u <username>:<password> \
https://demo.trading212.com/api/v0/equity/orders/market \
-H 'Content-Type: application/json' \
-d '{
"extendedHours": true,
"quantity": 0.1,
"ticker": "AAPL_US_EQ"
}'OK
The number of shares requested in the order. A negative number indicates a sell order. Applicable to orders placed by quantity.
The current state of the order in its lifecycle.
The strategy used to place the order, either by QUANTITY or VALUE. The API currently only supports placing orders by QUANTITY.
The type of the order, which determines its execution logic.
{ "creationTime": "2019-08-24T14:15:22Z", "extendedHours": true, "filledQuantity": 0, "filledValue": 0, "id": 0, "limitPrice": 0, "quantity": 0, "status": "LOCAL", "stopPrice": 0, "strategy": "QUANTITY", "ticker": "AAPL_US_EQ", "type": "LIMIT", "value": 0 }
Request
Rate Limit: 1 request per 2 seconds
Creates a new Stop order, which places a Market order once the stopPrice is reached.
To place a buy stop order, use a positive
quantity.To place a sell stop order (commonly a 'stop-loss'), use a negative
quantity.The
stopPriceis triggered by the instrument's Last Traded Price (LTP).
Order Limitations
- Orders can be executed only in the main account currency
- Only Market Orders are supported for the live (real money) environment
Important: In this beta version, this endpoint is not idempotent. Sending the same request multiple times may result in duplicate orders.
The number of shares or units to trade. Use a positive number (e.g., 10.5) for a BUY order and a negative number (e.g., -10.5) for a SELL order. The value cannot be zero.
The price at which the Stop order triggers a Market order. The trigger is based on the instrument's Last Traded Price (LTP).
The unique identifier for the instrument to trade. Retrieve from the /equity/metadata/instruments endpoint.
Specifies how long the order remains active.
DAY: The order will automatically expire if not executed by midnight in the time zone of the instrument's exchange.GOOD_TILL_CANCEL: The order remains active indefinitely until it is either filled or explicitly cancelled by you.
https://demo.trading212.com/api/v0/equity/orders/stop
https://live.trading212.com/api/v0/equity/orders/stop
- curl
- Go
- Python
- Node.js
- Java
curl -i -X POST \
-u <username>:<password> \
https://demo.trading212.com/api/v0/equity/orders/stop \
-H 'Content-Type: application/json' \
-d '{
"quantity": 0.1,
"stopPrice": 100.23,
"ticker": "AAPL_US_EQ",
"timeValidity": "DAY"
}'OK
The number of shares requested in the order. A negative number indicates a sell order. Applicable to orders placed by quantity.
The current state of the order in its lifecycle.
The strategy used to place the order, either by QUANTITY or VALUE. The API currently only supports placing orders by QUANTITY.
The type of the order, which determines its execution logic.
{ "creationTime": "2019-08-24T14:15:22Z", "extendedHours": true, "filledQuantity": 0, "filledValue": 0, "id": 0, "limitPrice": 0, "quantity": 0, "status": "LOCAL", "stopPrice": 0, "strategy": "QUANTITY", "ticker": "AAPL_US_EQ", "type": "LIMIT", "value": 0 }
Request
Rate Limit: 1 request per 2 seconds
Creates a new Stop-Limit order, combining features of a Stop and a Limit order. The direction of the trade (buy/sell) is determined by the sign of the quantity field.
Execution Logic:
- When the instrument's Last Traded Price (LTP) reaches the specified
stopPrice, the order is triggered. - A Limit order is then automatically placed at the specified
limitPrice.
This two-step process helps protect against price slippage that can occur with a standard Stop order.
Order Limitations
- Orders can be executed only in the main account currency
- Only Market Orders are supported for the live (real money) environment
Important: In this beta version, this endpoint is not idempotent. Sending the same request multiple times may result in duplicate orders.
The price for the subsequent Limit order that is placed after the stopPrice is triggered. This defines the maximum price for a buy or minimum price for a sell.
The number of shares or units to trade. Use a positive number (e.g., 10.5) for a BUY order and a negative number (e.g., -10.5) for a SELL order. The value cannot be zero.
The price at which the order triggers. The trigger is based on the instrument's Last Traded Price (LTP). Once triggered, a Limit order is placed at the limitPrice.
The unique identifier for the instrument to trade. Retrieve from the /equity/metadata/instruments endpoint.
Specifies how long the order remains active.
DAY: The order will automatically expire if not executed by midnight in the time zone of the instrument's exchange.GOOD_TILL_CANCEL: The order remains active indefinitely until it is either filled or explicitly cancelled by you.
https://demo.trading212.com/api/v0/equity/orders/stop_limit
https://live.trading212.com/api/v0/equity/orders/stop_limit
- curl
- Go
- Python
- Node.js
- Java
curl -i -X POST \
-u <username>:<password> \
https://demo.trading212.com/api/v0/equity/orders/stop_limit \
-H 'Content-Type: application/json' \
-d '{
"limitPrice": 100.23,
"quantity": 0.1,
"stopPrice": 100.23,
"ticker": "AAPL_US_EQ",
"timeValidity": "DAY"
}'OK
The number of shares requested in the order. A negative number indicates a sell order. Applicable to orders placed by quantity.
The current state of the order in its lifecycle.
The strategy used to place the order, either by QUANTITY or VALUE. The API currently only supports placing orders by QUANTITY.
The type of the order, which determines its execution logic.
{ "creationTime": "2019-08-24T14:15:22Z", "extendedHours": true, "filledQuantity": 0, "filledValue": 0, "id": 0, "limitPrice": 0, "quantity": 0, "status": "LOCAL", "stopPrice": 0, "strategy": "QUANTITY", "ticker": "AAPL_US_EQ", "type": "LIMIT", "value": 0 }
https://demo.trading212.com/api/v0/equity/orders/{id}
https://live.trading212.com/api/v0/equity/orders/{id}
- curl
- Go
- Python
- Node.js
- Java
curl -i -X DELETE \
-u <username>:<password> \
'https://demo.trading212.com/api/v0/equity/orders/{id}'https://demo.trading212.com/api/v0/equity/orders/{id}
https://live.trading212.com/api/v0/equity/orders/{id}
- curl
- Go
- Python
- Node.js
- Java
curl -i -X GET \
-u <username>:<password> \
'https://demo.trading212.com/api/v0/equity/orders/{id}'Order found
The number of shares requested in the order. A negative number indicates a sell order. Applicable to orders placed by quantity.
The current state of the order in its lifecycle.
The strategy used to place the order, either by QUANTITY or VALUE. The API currently only supports placing orders by QUANTITY.
The type of the order, which determines its execution logic.
{ "creationTime": "2019-08-24T14:15:22Z", "extendedHours": true, "filledQuantity": 0, "filledValue": 0, "id": 0, "limitPrice": 0, "quantity": 0, "status": "LOCAL", "stopPrice": 0, "strategy": "QUANTITY", "ticker": "AAPL_US_EQ", "type": "LIMIT", "value": 0 }