# Get all positions history

`GET /positions/{accountId}/portfolio/history`

Every position of the account across all markets, open and closed alike, newest first, with the total count for paging.

- Limited to the phase the account is currently in: positions from an earlier phase are not returned.

## Authorization

bearer: http · bearer (required). Personal API key, prefixed with `usk_`.

## Parameters

- path: accountId (string · uuid; required). Trader account identifier. Must belong to the caller.

Type: string · uuid

format: uuid

- query: limit (integer; optional). Page size: how many records to return.

Type: integer

Example: 20

Default: 20

minimum: 1

maximum: 100

- query: offset (integer; optional). How many records to skip before the page.

Type: integer

Example: 0

Default: 0

minimum: 0

maximum: 9007199254740991

## Example · cURL

```bash
curl --request GET 'https://api.upscale.trade/positions/{accountId}/portfolio/history' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY'
```

## Example · JavaScript

```javascript
const response = await fetch("https://api.upscale.trade/positions/{accountId}/portfolio/history", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
  },
});
console.log(response.status, await response.text());
```

## Example · Python

```python
import requests

response = requests.request(
    "GET",
    "https://api.upscale.trade/positions/{accountId}/portfolio/history",
    headers={"Accept":"application/json","Authorization":"Bearer YOUR_API_KEY"},
    timeout=30,
)
print(response.status_code, response.text)
```

## Response 401

**401**  — Unauthorized

## Response 403

**403**  — The account belongs to another user (`account_access_denied`), or the request is authenticated with an API key while `api_trading` is disabled on the account (`api_trading_not_enabled`).

## Response 404

**404**  — No account with this identifier.

## Response 429

**429**  — Rate limit of the API key exceeded (`api_key_rate_limit_exceeded`). `Retry-After` says when to come back; the body carries the bucket (`read` / `write`), the window that tripped, its limit and `retryAt`.

## Response default · PositionsPaginatedResponse

**default** application/json — Response

Type: object[]

[]Schema: PositionsPaginatedResponse

[]Type: object

[]Required fields: data, totalCount

[]Required field types: data (object[]; required), totalCount (number; required)

- []data (object[]; required)

[]data example: [
  {
    "idx": "string",
    "txId": "string",
    "version": 0,
    "openedAt": "2026-05-01T12:30:00.000Z",
    "lastUpdatedAt": "2026-05-01T12:30:00.000Z",
    "closedAt": "2026-05-01T12:30:00.000Z",
    "type": "long",
    "status": "opened",
    "market": "00000000-0000-4000-8000-000000000000",
    "trader": "00000000-0000-4000-8000-000000000000",
    "size": "1000000000",
    "notional": "1000000000",
    "fraction": "1000000000",
    "margin": "1000000000",
    "pnl": "1000000000",
    "funding": "1000000000",
    "rolloverFee": "1000000000",
    "settlementOraclePrice": "1000000000",
    "fee": "1000000000",
    "feeRate": "1000000000",
    "exchangedQuote": "1000000000",
    "exchangedBase": "1000000000",
    "direction": "long",
    "eventName": "addMargin",
    "pnlInEvent": "1000000000",
    "rawPnlInEvent": "1000000000",
    "profitAdjustmentApplied": true,
    "holdingTimeMs": "string",
    "feeInEvent": "1000000000",
    "fundingInEvent": "1000000000",
    "rolloverFeeInEvent": "1000000000",
    "executionFeeRate": "1000000000",
    "executionFeeInEvent": "1000000000",
    "executionFee": "1000000000",
    "timestamp": "2026-05-01T12:30:00.000Z",
    "isOnchain": true,
    "roe": "1000000000",
    "scalpingCoefficient": "1000000000",
    "closeReason": "string"
  }
]

[]data.Type: object[]

[]data.Requested page of positions, newest first.

[]data.[]Type: object

[]data.[]Required fields: idx, txId, version, openedAt, lastUpdatedAt, closedAt, type, status, market, trader, size, notional, fraction, margin, pnl, funding, rolloverFee, settlementOraclePrice, fee, feeRate, exchangedQuote, exchangedBase, direction, eventName, pnlInEvent, rawPnlInEvent, profitAdjustmentApplied, holdingTimeMs, feeInEvent, fundingInEvent, rolloverFeeInEvent, executionFeeRate, executionFeeInEvent, executionFee, timestamp, isOnchain, roe, scalpingCoefficient, closeReason

[]data.[]Required field types: idx (string · nullable; required), txId (string · nullable; required), version (number; required), openedAt (string · date-time; required), lastUpdatedAt (string · date-time; required), closedAt (string · date-time · nullable; required), type (string · enum; required), status (string · enum; required), market (string · uuid; required), trader (string · uuid; required), size (string · int32; required), notional (string · int32; required), fraction (string · int32; required), margin (string · int32; required), pnl (string · int32 · nullable; required), funding (string · int32 · nullable; required), rolloverFee (string · int32; required), settlementOraclePrice (string · int32; required), fee (string · int32; required), feeRate (string · int32; required), exchangedQuote (string · int32; required), exchangedBase (string · int32; required), direction (string · enum; required), eventName (string · enum; required), pnlInEvent (string · int32; required), rawPnlInEvent (string · int32; required), profitAdjustmentApplied (boolean; required), holdingTimeMs (string · nullable; required), feeInEvent (string · int32; required), fundingInEvent (string · int32; required), rolloverFeeInEvent (string · int32; required), executionFeeRate (string · int32; required), executionFeeInEvent (string · int32; required), executionFee (string · int32; required), timestamp (string · date-time; required), isOnchain (boolean; required), roe (string · int32; required), scalpingCoefficient (string · int32; required), closeReason (string · nullable; required)

- []data.[]idx (string · nullable; required)

[]data.[]idx example: string

[]data.[]idx.Type: string · nullable

[]data.[]idx.Position identifier. Same value as `txId`.

- []data.[]txId (string · nullable; required)

[]data.[]txId example: string

[]data.[]txId.Type: string · nullable

[]data.[]txId.Position identifier. Kept for backward compatibility, always equal to `idx`.

- []data.[]version (number; required)

[]data.[]version example: 0

[]data.[]version.Type: number

[]data.[]version.Revision of the position: incremented by every event applied to it.

- []data.[]openedAt (string · date-time; required)

[]data.[]openedAt example: 2026-05-01T12:30:00.000Z

[]data.[]openedAt.Type: string · date-time

[]data.[]openedAt.When the position was opened.

[]data.[]openedAt.format: date-time

- []data.[]lastUpdatedAt (string · date-time; required)

[]data.[]lastUpdatedAt example: 2026-05-01T12:30:00.000Z

[]data.[]lastUpdatedAt.Type: string · date-time

[]data.[]lastUpdatedAt.When the last event was applied to the position.

[]data.[]lastUpdatedAt.format: date-time

- []data.[]closedAt (string · date-time · nullable; required)

[]data.[]closedAt example: 2026-05-01T12:30:00.000Z

[]data.[]closedAt.Type: string · date-time · nullable

[]data.[]closedAt.When the position was closed; null while it is still open.

[]data.[]closedAt.format: date-time

- []data.[]type (string · enum; required)

[]data.[]type example: long

[]data.[]type.Type: string · enum

[]data.[]type.Direction of the position. Same value as `direction`.

[]data.[]type.Allowed values: ["long","short"]

- []data.[]status (string · enum; required)

[]data.[]status example: opened

[]data.[]status.Type: string · enum

[]data.[]status.Whether the position is still open, closed by the trader, or liquidated.

[]data.[]status.Allowed values: ["opened","closed","liquidated"]

- []data.[]market (string · uuid; required)

[]data.[]market example: 00000000-0000-4000-8000-000000000000

[]data.[]market.Type: string · uuid

[]data.[]market.Market the position is held on.

[]data.[]market.format: uuid

[]data.[]market.pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$

- []data.[]trader (string · uuid; required)

[]data.[]trader example: 00000000-0000-4000-8000-000000000000

[]data.[]trader.Type: string · uuid

[]data.[]trader.Trader account the position belongs to.

[]data.[]trader.format: uuid

[]data.[]trader.pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$

- []data.[]size (string · int32; required)

[]data.[]size example: 1000000000

[]data.[]size.Type: string · int32

[]data.[]size.Position size in base asset units, fp9 raw.

[]data.[]size.format: int32

[]data.[]size.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]notional (string · int32; required)

[]data.[]notional example: 1000000000

[]data.[]notional.Type: string · int32

[]data.[]notional.Open notional of the position in quote currency, fp9 raw — size at entry price.

[]data.[]notional.format: int32

[]data.[]notional.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]fraction (string · int32; required)

[]data.[]fraction example: 1000000000

[]data.[]fraction.Type: string · int32

[]data.[]fraction.Always `0`. Kept for backward compatibility.

[]data.[]fraction.format: int32

[]data.[]fraction.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]margin (string · int32; required)

[]data.[]margin example: 1000000000

[]data.[]margin.Type: string · int32

[]data.[]margin.Margin currently backing the position, fp9 raw. Moves with pnl, funding and manual margin changes.

[]data.[]margin.format: int32

[]data.[]margin.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]pnl (string · int32 · nullable; required)

[]data.[]pnl example: 1000000000

[]data.[]pnl.Type: string · int32 · nullable

[]data.[]pnl.Realised pnl accumulated over every event of the position, fp9 raw.

[]data.[]pnl.format: int32

[]data.[]pnl.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]funding (string · int32 · nullable; required)

[]data.[]funding example: 1000000000

[]data.[]funding.Type: string · int32 · nullable

[]data.[]funding.Funding paid (negative) or received (positive) over the life of the position, fp9 raw.

[]data.[]funding.format: int32

[]data.[]funding.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]rolloverFee (string · int32; required)

[]data.[]rolloverFee example: 1000000000

[]data.[]rolloverFee.Type: string · int32

[]data.[]rolloverFee.Always `0`. Kept for backward compatibility.

[]data.[]rolloverFee.format: int32

[]data.[]rolloverFee.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]settlementOraclePrice (string · int32; required)

[]data.[]settlementOraclePrice example: 1000000000

[]data.[]settlementOraclePrice.Type: string · int32

[]data.[]settlementOraclePrice.Always `1000000000` (1.0). Kept for backward compatibility.

[]data.[]settlementOraclePrice.format: int32

[]data.[]settlementOraclePrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]fee (string · int32; required)

[]data.[]fee example: 1000000000

[]data.[]fee.Type: string · int32

[]data.[]fee.Trading fees charged over the life of the position, fp9 raw.

[]data.[]fee.format: int32

[]data.[]fee.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]feeRate (string · int32; required)

[]data.[]feeRate example: 1000000000

[]data.[]feeRate.Type: string · int32

[]data.[]feeRate.Fee rate applied to the position, fp9 raw fraction (`1000000` = 0.1%).

[]data.[]feeRate.format: int32

[]data.[]feeRate.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]exchangedQuote (string · int32; required)

[]data.[]exchangedQuote example: 1000000000

[]data.[]exchangedQuote.Type: string · int32

[]data.[]exchangedQuote.Quote amount exchanged by the most recent event, fp9 raw.

[]data.[]exchangedQuote.format: int32

[]data.[]exchangedQuote.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]exchangedBase (string · int32; required)

[]data.[]exchangedBase example: 1000000000

[]data.[]exchangedBase.Type: string · int32

[]data.[]exchangedBase.Base amount exchanged by the most recent event, fp9 raw.

[]data.[]exchangedBase.format: int32

[]data.[]exchangedBase.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]direction (string · enum; required)

[]data.[]direction example: long

[]data.[]direction.Type: string · enum

[]data.[]direction.Direction of the position.

[]data.[]direction.Allowed values: ["long","short"]

- []data.[]eventName (string · enum; required)

[]data.[]eventName example: addMargin

[]data.[]eventName.Type: string · enum

[]data.[]eventName.Type of the most recent event applied to the position.

[]data.[]eventName.Allowed values: ["addMargin","removeMargin","closePosition","increasePosition","liquidate","forceClose","payFunding"]

- []data.[]pnlInEvent (string · int32; required)

[]data.[]pnlInEvent example: 1000000000

[]data.[]pnlInEvent.Type: string · int32

[]data.[]pnlInEvent.Realised pnl of the most recent event, fp9 raw.

[]data.[]pnlInEvent.format: int32

[]data.[]pnlInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]rawPnlInEvent (string · int32; required)

[]data.[]rawPnlInEvent example: 1000000000

[]data.[]rawPnlInEvent.Type: string · int32

[]data.[]rawPnlInEvent.Realised pnl of the most recent event before the 60-second adjustment, fp9 raw. Differs from `pnlInEvent` only when the adjustment fired.

[]data.[]rawPnlInEvent.format: int32

[]data.[]rawPnlInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]profitAdjustmentApplied (boolean; required)

[]data.[]profitAdjustmentApplied example: true

[]data.[]profitAdjustmentApplied.Type: boolean

[]data.[]profitAdjustmentApplied.Whether the 60-second adjustment capped the profit of the most recent event — inside a minute of an open or increase the position pnl cannot grow above what it was at that moment.

- []data.[]holdingTimeMs (string · nullable; required)

[]data.[]holdingTimeMs example: string

[]data.[]holdingTimeMs.Type: string · nullable

[]data.[]holdingTimeMs.How long the position was held before the most recent close, in milliseconds, counted from the open or the last increase. Null on events that are not closes.

- []data.[]feeInEvent (string · int32; required)

[]data.[]feeInEvent example: 1000000000

[]data.[]feeInEvent.Type: string · int32

[]data.[]feeInEvent.Fee charged by the most recent event, fp9 raw.

[]data.[]feeInEvent.format: int32

[]data.[]feeInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]fundingInEvent (string · int32; required)

[]data.[]fundingInEvent example: 1000000000

[]data.[]fundingInEvent.Type: string · int32

[]data.[]fundingInEvent.Funding settled by the most recent event, fp9 raw.

[]data.[]fundingInEvent.format: int32

[]data.[]fundingInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]rolloverFeeInEvent (string · int32; required)

[]data.[]rolloverFeeInEvent example: 1000000000

[]data.[]rolloverFeeInEvent.Type: string · int32

[]data.[]rolloverFeeInEvent.Always `0`. Kept for backward compatibility.

[]data.[]rolloverFeeInEvent.format: int32

[]data.[]rolloverFeeInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]executionFeeRate (string · int32; required)

[]data.[]executionFeeRate example: 1000000000

[]data.[]executionFeeRate.Type: string · int32

[]data.[]executionFeeRate.Always `0`. Kept for backward compatibility.

[]data.[]executionFeeRate.format: int32

[]data.[]executionFeeRate.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]executionFeeInEvent (string · int32; required)

[]data.[]executionFeeInEvent example: 1000000000

[]data.[]executionFeeInEvent.Type: string · int32

[]data.[]executionFeeInEvent.Always `0`. Kept for backward compatibility.

[]data.[]executionFeeInEvent.format: int32

[]data.[]executionFeeInEvent.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]executionFee (string · int32; required)

[]data.[]executionFee example: 1000000000

[]data.[]executionFee.Type: string · int32

[]data.[]executionFee.Always `0`. Kept for backward compatibility.

[]data.[]executionFee.format: int32

[]data.[]executionFee.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]timestamp (string · date-time; required)

[]data.[]timestamp example: 2026-05-01T12:30:00.000Z

[]data.[]timestamp.Type: string · date-time

[]data.[]timestamp.Timestamp of the most recent event. Same value as `lastUpdatedAt`.

[]data.[]timestamp.format: date-time

- []data.[]isOnchain (boolean; required)

[]data.[]isOnchain example: true

[]data.[]isOnchain.Type: boolean

[]data.[]isOnchain.Always `true`. Kept for backward compatibility.

- []data.[]roe (string · int32; required)

[]data.[]roe example: 1000000000

[]data.[]roe.Type: string · int32

[]data.[]roe.Return on equity of the position — realised pnl over the margin put up, fp9 raw fraction.

[]data.[]roe.format: int32

[]data.[]roe.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]scalpingCoefficient (string · int32; required)

[]data.[]scalpingCoefficient example: 1000000000

[]data.[]scalpingCoefficient.Type: string · int32

[]data.[]scalpingCoefficient.Dynamic spread multiplier the position was charged, fp9 raw (`1000000000` = 1.0). Above 1 when the trade fell inside the market scalping window.

[]data.[]scalpingCoefficient.format: int32

[]data.[]scalpingCoefficient.pattern: ^(?:-?[1-9][0-9]*|0)$

- []data.[]closeReason (string · nullable; required)

[]data.[]closeReason example: string

[]data.[]closeReason.Type: string · nullable

[]data.[]closeReason.Why the platform closed the position (for example `weekly_session_risk_close`). Null for positions closed by the trader and for open ones.

- []totalCount (number; required)

[]totalCount example: 0

[]totalCount.Type: number

[]totalCount.Total number of positions matching the request, across all pages.

Example



```json
[
  {
    "data": [
      {
        "idx": "string",
        "txId": "string",
        "version": 0,
        "openedAt": "2026-05-01T12:30:00.000Z",
        "lastUpdatedAt": "2026-05-01T12:30:00.000Z",
        "closedAt": "2026-05-01T12:30:00.000Z",
        "type": "long",
        "status": "opened",
        "market": "00000000-0000-4000-8000-000000000000",
        "trader": "00000000-0000-4000-8000-000000000000",
        "size": "1000000000",
        "notional": "1000000000",
        "fraction": "1000000000",
        "margin": "1000000000",
        "pnl": "1000000000",
        "funding": "1000000000",
        "rolloverFee": "1000000000",
        "settlementOraclePrice": "1000000000",
        "fee": "1000000000",
        "feeRate": "1000000000",
        "exchangedQuote": "1000000000",
        "exchangedBase": "1000000000",
        "direction": "long",
        "eventName": "addMargin",
        "pnlInEvent": "1000000000",
        "rawPnlInEvent": "1000000000",
        "profitAdjustmentApplied": true,
        "holdingTimeMs": "string",
        "feeInEvent": "1000000000",
        "fundingInEvent": "1000000000",
        "rolloverFeeInEvent": "1000000000",
        "executionFeeRate": "1000000000",
        "executionFeeInEvent": "1000000000",
        "executionFee": "1000000000",
        "timestamp": "2026-05-01T12:30:00.000Z",
        "isOnchain": true,
        "roe": "1000000000",
        "scalpingCoefficient": "1000000000",
        "closeReason": "string"
      }
    ],
    "totalCount": 0
  }
]
```