API Reference / Balances and Positions
List Account Positions
getAccountsAccountNumberPositions/accounts/{account_number}/positionsBase URL: https://api.cert.tastyworks.com (Sandbox) · https://api.tastyworks.com (Production)
Returns the account's positions. A position with a quantity of 0 is considered closed and is purged overnight, so by default only open positions are returned; pass include-closed-positions to include them. Filter by symbol, underlying-symbol, instrument-type, or underlying-product-code, and use net-positions to group by instrument type and symbol. The endpoint does not return live profit/loss or a mark unless include-marks is set; for up-to-date P/L, combine the cost-basis fields here with live quote data from streaming market data.
Code samples
curl -X GET 'https://api.cert.tastyworks.com/accounts/5WX01234/positions?underlying-symbol[]=AAPL&symbol=AAPL&instrument-type=Bond&include-closed-positions=true&underlying-product-code=ES&partition-keys=%7Bpartition-keys%7D&net-positions=true&include-marks=true' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'User-Agent: tastytrade-docs-example/1.0'import requests
url = "https://api.cert.tastyworks.com/accounts/5WX01234/positions?underlying-symbol[]=AAPL&symbol=AAPL&instrument-type=Bond&include-closed-positions=true&underlying-product-code=ES&partition-keys=%7Bpartition-keys%7D&net-positions=true&include-marks=true"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"User-Agent": "tastytrade-docs-example/1.0",
}
resp = requests.get(url, headers=headers)
print(resp.status_code, resp.json())const resp = await fetch("https://api.cert.tastyworks.com/accounts/5WX01234/positions?underlying-symbol[]=AAPL&symbol=AAPL&instrument-type=Bond&include-closed-positions=true&underlying-product-code=ES&partition-keys=%7Bpartition-keys%7D&net-positions=true&include-marks=true", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"User-Agent": "tastytrade-docs-example/1.0",
},
})
const data = await resp.json()
console.log(resp.status, data)package main
import (
"net/http"
"io"
"fmt"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.cert.tastyworks.com/accounts/5WX01234/positions?underlying-symbol[]=AAPL&symbol=AAPL&instrument-type=Bond&include-closed-positions=true&underlying-product-code=ES&partition-keys=%7Bpartition-keys%7D&net-positions=true&include-marks=true", nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Set("User-Agent", "tastytrade-docs-example/1.0")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(resp.Status, string(out))
}import java.net.URI;
import java.net.http.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.cert.tastyworks.com/accounts/5WX01234/positions?underlying-symbol[]=AAPL&symbol=AAPL&instrument-type=Bond&include-closed-positions=true&underlying-product-code=ES&partition-keys=%7Bpartition-keys%7D&net-positions=true&include-marks=true"))
.header("Authorization", "Bearer YOUR_ACCESS_TOKEN")
.header("User-Agent", "tastytrade-docs-example/1.0")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode() + " " + resp.body());Parameters
| Name | In | Type | Description |
|---|---|---|---|
| underlying-symbol | query | array | An array of Underlying symbol(s) for positions (example: underlying-symbol[]={value1}&underlying-symbol[]={value2}) e.g. ["AAPL"] |
| symbol | query | string | A single symbol. Stock Ticker Symbol `AAPL`, \
OCC Option Symbol `AAPL 191004P00275000`, \
TW Future Symbol `/ESZ9`, or \
TW Future Option Symbol `./ESZ9 EW4U9 190927P2975` e.g. "AAPL" |
| instrument-type | query | string | The type of Instrument enum: Bond, Cryptocurrency, Currency Pair, Equity, Equity Offering, Equity Option, Future, Future Option, Index, Unknown, Warrant e.g. "Bond" |
| include-closed-positions | query | boolean | If closed positions should be included in the query e.g. true |
| underlying-product-code | query | string | The underlying Future's Product code. i.e `ES` e.g. "ES" |
| partition-keys | query | array | Account partition keys (example: partition-keys[]={value1}&partition-keys[]={value2}) |
| net-positions | query | boolean | Returns net positions grouped by instrument type and symbol e.g. true |
| include-marks | query | boolean | Include current quote mark (note: can decrease performance) e.g. true |
| account_number* | path | string | e.g. "5WX01234" |
Responses
Example response
{
"data": {
"items": [
{
"account-number": "5WX01234",
"symbol": "AAPL",
"instrument-type": "Equity",
"underlying-symbol": "AAPL",
"quantity": "100",
"quantity-direction": "Long",
"close-price": "282.48",
"average-open-price": "288.7",
"average-yearly-market-close-price": "123.18",
"average-daily-market-close-price": "282.48",
"mark": "285.10",
"mark-price": "285.10",
"multiplier": 1,
"cost-effect": "Credit",
"is-suppressed": false,
"is-frozen": false,
"restricted-quantity": "0.0",
"expires-at": "2024-12-20T21:15:00.000+00:00",
"fixing-price": "0.0",
"deliverable-type": "Equity",
"realized-day-gain": "0.0",
"realized-day-gain-effect": "None",
"realized-day-gain-date": "2026-06-08",
"realized-today": "0.0",
"realized-today-effect": "None",
"realized-today-date": "2026-06-08",
"created-at": "2022-08-22T17:56:51.872+00:00",
"updated-at": "2026-06-08T21:49:54.095+00:00",
"order-id": 123456
}
]
},
"context": "/accounts/{account_number}/positions",
"pagination": {
"per-page": 0,
"page-offset": 0,
"item-offset": 0,
"total-items": 0,
"total-pages": 0,
"current-item-count": 0
}
}Schema
datarequiredobjectitemsrequiredarray<object>{29 fields}
contextrequiredstringexample:
"/accounts/{account_number}/positions"paginationobjectPaging metadata, present on paginated list responses.
per-pageintegerpage-offsetintegeritem-offsetintegertotal-itemsintegertotal-pagesintegercurrent-item-countinteger
Example response
{
"error": {
"code": "unauthorized",
"message": "No valid access token was provided; access tokens expire after 15 minutes."
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Example response
{
"error": {
"code": "not_permitted",
"message": "User not permitted access"
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Example response
{
"error": {
"code": "string",
"message": "string",
"errors": [
{
"code": "string",
"message": "string",
"domain": "string"
}
]
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Example response
{
"error": {
"code": "string",
"message": "string",
"errors": [
{
"code": "string",
"message": "string",
"domain": "string"
}
]
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Related
- Rate-limit class:
read· idempotent — Rate limits & backoff - Error reference — codes, causes, and fixes
Agents: this page is also Markdown (with the embedded OpenAPI definition) — append .md or send Accept: text/markdown. Index at /llms.txt.