Accounts
Accounts, open positions, and history
Account overview
/accounts/{owner}Path parameters
ownerstringrequiredWallet address
Pattern^(0[xX])?[0-9a-fA-F]{1,64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d
Query parameters
limitstringPage size: canonical decimal (digits only, no sign, whitespace or leading zero), 1 to 18446744073709551615, else 400 bad_request; an empty value is omitted. The service clamps it to
api.max-page-limit.Pattern^(0|[1-9][0-9]*)$Example50accountsCursorstringAccount id cursor (address) from
accountsNextCursor.Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dpositionsCursorstringPosition id cursor (decimal).
Example1042claimsCursorstringClaim id cursor (decimal).
Example5531
Responses
Accounts, free balance, open positions, and queue rank, as public camelCase JSON. Every integer is an n-suffixed decimal string ("5000000n"). Each account carries pendingOrders (requested, not yet finalized two-step orders, opens and closes) and pendingOpenOrders (the pending opens only). Compare pendingOpenOrders with /config maxPendingOrders before a request-open; closes are never capped. limit, accountsCursor, positionsCursor and claimsCursor are forwarded when present.
application/json
dataAccountOverviewrequiredAccounts, open positions and queued claims of a wallet, each paged with its own cursor.
accountsAccount[]requiredaccountsNextCursorstring | nullnextAccountNoncestringrequiredPattern^-?(0|[1-9][0-9]*)n$Example3nownerstringrequiredPattern^0x[0-9a-f]{64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dpositionsPosition[]requiredpositionsNextCursorstring | nullqueueAccountClaimsrequiredThe queued claims of a wallet and what is ahead of its first one.
Example request
curl 'https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d'const res = await fetch("https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d");
const { data } = await res.json();Example response (200)
{
"data": {
"accounts": [
{
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"closeDelegates": [],
"delegates": [
{
"delegate": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"expiryMs": "1796677200000n"
}
],
"delegatesCount": "24n",
"exchangeId": "0x2e53756af142bc2768c9bae0d2acae16558e68ab11dc71987dbfc96e4dd40819",
"free": "100000000n",
"nonce": "3n",
"openNotional": "1850000000000n",
"opener": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"pendingMint": "1500000000000n",
"pendingMintBasis": "42500000n",
"pendingOpenOrders": "24n",
"pendingOrders": "24n"
}
],
"accountsNextCursor": "string",
"nextAccountNonce": "3n",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"positions": [
{
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"attribution": "owner",
"autoCloseAtMs": "1796677200000n",
"bustWad": "67550000000000000000n",
"closeFeePpm": "500n",
"confWad": "30000000000000000n",
"deadbandPpm": "1000n",
"entryWad": "74250000000000000000n",
"exitKind": "close",
"factorBps": "10000n",
"fillBustWad": "67550000000000000000n",
"isLong": true,
"leverage": "10n",
"margin": "100000000n",
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"midWad": "74250000000000000000n",
"notional": "1000000000n",
"openTx": "string",
"openedAtMs": "1796677200000n",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"positionId": "1042n",
"slDroppedReason": "string",
"status": "open",
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"trader": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"triggers": {
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"firing": true,
"firingEtaMs": "1796677200000n",
"firingKind": "string",
"firingMaxEpoch": "912n",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"paused": true,
"positionId": "1042n",
"status": "pending",
"stopLossDropped": {
"ms": "1796677200000n",
"reason": "string",
"wad": "74250000000000000000n"
},
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"voidReason": "string"
},
"winFeeBps": "2000n",
"winningExposure": "1850000000000n"
}
],
"positionsNextCursor": "string",
"queue": {
"aheadCount": "17n",
"aheadNet": "100000000n",
"claims": [
{
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"claimId": "5531n",
"enqueuedTx": "string",
"feeRemaining": "800000n",
"harvestedTx": "string",
"net": "100000000n",
"onTopRemaining": "800000n",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"positionId": "1042n",
"remaining": "100000000n",
"status": "queued",
"timestampMs": "1796677200000n"
}
],
"claimsNextCursor": "string"
}
}
}Account equity history
/accounts/{owner}/equityPath parameters
ownerstringrequiredWallet address
Pattern^(0[xX])?[0-9a-fA-F]{1,64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d
Query parameters
rangestringrequiredRequired.
24h,7d,30dorall; anything else (missing or empty included) is 400 bad_request.One of24h7d30dall
Responses
The owner's account equity over time from hourly snapshots (the hour's latest observation; an account with no open position gets a row only when its equity changed), plus current: the equity now from one read (null without an account or position, or while the indexer lags). Equity = free balance + open positions' margin + unrealized PnL, summed over the owner's trading accounts; a position's margin + unrealized PnL is what closing it at the indexed oracle mid would pay after fees (without a fresh price, its margin, counted in unpricedPositions). Queued payouts and wallet USDC are not included. History starts when the service began recording. Every integer is an n-suffixed decimal string; unrealizedPnl may be negative.
application/json
dataEquityHistoryrequiredThe owner's hourly equity snapshots for the range and the equity now. Equity = free balance + open positions' margin + unrealized PnL (what closing each at the indexed oracle mid would pay after fees; without a fresh price, at its margin), summed over the owner's trading accounts. USDC base units (6 decimals).
bucketMsstringrequiredSnapshot spacing (one row per hour, the hour's latest observation).
Pattern^-?(0|[1-9][0-9]*)n$Example3600000ncurrentnull | EquityPointrequiredfromMsstring | nullrequiredThe window start; null for
all.Pattern^-?(0|[1-9][0-9]*)n$Example1796677200000npointsEquityPoint[]requiredOldest first, at most 500; the first is the last snapshot at or before
fromMs.rangestringrequired"24h","7d","30d"or"all", as requested.One of24h7d30dalltoMsstringrequiredThe request time.
Pattern^-?(0|[1-9][0-9]*)n$Example1796677200000n
Example request
curl 'https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/equity?range=24h'const res = await fetch("https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/equity?range=24h");
const { data } = await res.json();Example response (200)
{
"data": {
"bucketMs": "3600000n",
"current": {
"equity": "1850000000000n",
"free": "100000000n",
"margin": "100000000n",
"openPositions": "1n",
"tsMs": "1796677200000n",
"unpricedPositions": "0n",
"unrealizedPnl": "-12500000n"
},
"fromMs": "1796677200000n",
"points": [
{
"equity": "1850000000000n",
"free": "100000000n",
"margin": "100000000n",
"openPositions": "1n",
"tsMs": "1796677200000n",
"unpricedPositions": "0n",
"unrealizedPnl": "-12500000n"
}
],
"range": "7d",
"toMs": "1796677200000n"
}
}Account history
/accounts/{owner}/historyPath parameters
ownerstringrequiredWallet address
Pattern^(0[xX])?[0-9a-fA-F]{1,64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d
Query parameters
cursorstringExample0xc00d9a508112ec1dff7df53f35f096e26af4ec600dc291264b483d27aeb18b75limitstringPage size: canonical decimal (digits only, no sign, whitespace or leading zero), 1 to 18446744073709551615, else 400 bad_request; an empty value is omitted.
Pattern^(0|[1-9][0-9]*)$Example50
Responses
Deposits, withdrawals, opens, closes, and liquidations. A position closed by the equity session force close has exitKind session.
application/json
dataHistoryPagerequiredNewest first.
itemsHistoryItem[]requirednextCursorstring | null
Example request
curl 'https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/history'const res = await fetch("https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/history");
const { data } = await res.json();Example response (200)
{
"data": {
"items": [
{
"kind": "deposit",
"payload": {
"amount": "100000000n"
},
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"id": "7n",
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"openStopLossWad": "71500000000000000000n",
"openTakeProfitWad": "78000000000000000000n",
"positionId": "1042n",
"timestampMs": "1796677200000n",
"triggerFiredAtMs": "1796677200000n",
"triggerKind": "string",
"triggerPriceWad": "74250000000000000000n",
"txDigest": "c3CE1sYJ2ufo1E8wNhVahkJbu66F4tMxpTXLeW3o8QSA"
}
],
"nextCursor": "string"
}
}Open positions
/accounts/{owner}/positionsPath parameters
ownerstringrequiredWallet address
Pattern^(0[xX])?[0-9a-fA-F]{1,64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d
Query parameters
cursorstringPosition id cursor (decimal) from
nextCursor.Example50limitstringPage size: canonical decimal (digits only, no sign, whitespace or leading zero), 1 to 18446744073709551615, else 400 bad_request; an empty value is omitted.
Pattern^(0|[1-9][0-9]*)$Example50
Responses
Open positions and nextCursor. cursor and limit are forwarded when present. autoCloseAtMs is when an equity position is force-closed at session end (null otherwise).
application/json
dataPositionsPagerequiredOpen positions by id.
nextCursorstring | nullpositionsPosition[]required
Example request
curl 'https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/positions'const res = await fetch("https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/positions");
const { data } = await res.json();Example response (200)
{
"data": {
"nextCursor": "string",
"positions": [
{
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"attribution": "owner",
"autoCloseAtMs": "1796677200000n",
"bustWad": "67550000000000000000n",
"closeFeePpm": "500n",
"confWad": "30000000000000000n",
"deadbandPpm": "1000n",
"entryWad": "74250000000000000000n",
"exitKind": "close",
"factorBps": "10000n",
"fillBustWad": "67550000000000000000n",
"isLong": true,
"leverage": "10n",
"margin": "100000000n",
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"midWad": "74250000000000000000n",
"notional": "1000000000n",
"openTx": "string",
"openedAtMs": "1796677200000n",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"positionId": "1042n",
"slDroppedReason": "string",
"status": "open",
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"trader": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"triggers": {
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"firing": true,
"firingEtaMs": "1796677200000n",
"firingKind": "string",
"firingMaxEpoch": "912n",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"paused": true,
"positionId": "1042n",
"status": "pending",
"stopLossDropped": {
"ms": "1796677200000n",
"reason": "string",
"wad": "74250000000000000000n"
},
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"voidReason": "string"
},
"winFeeBps": "2000n",
"winningExposure": "1850000000000n"
}
]
}
}On-chain TP/SL levels
/accounts/{owner}/trigger-levelsPath parameters
ownerstringrequiredWallet address
Pattern^(0[xX])?[0-9a-fA-F]{1,64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d
Responses
On-chain TP/SL commitments of the wallet (parchment_triggers package): per open position its latest edit by chain order (revision is caller-supplied and informational), else the levels committed with the open request that created it; then pending open requests with levels. Records only: the trigger service acts on owner-signed triggers (POST /triggers), not on these. All integers are js_bigint strings.
application/json
dataChainTriggerLevelsViewrequiredGET /accounts/{owner}/trigger-levels.levelsChainTriggerLevels[]requiredaccountIdstringrequiredPattern^0x[0-9a-f]{64}$Example0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691positionIdstring | nullThe open position; null while the open request (
requestId) is pending.Pattern^(0|[1-9][0-9]*)n$Example1042nrequestIdstring | nullThe open request the levels were committed with (
sourceopen).Pattern^0x[0-9a-f]{64}$Example0xe4685be89af887adcea9b6bd3842cb9276e839bad0c361f0380ab288ae8a0b05revisionstring | nullThe edit's caller-supplied revision (
setonly; unchecked on chain, informational).Pattern^(0|[1-9][0-9]*)n$Example1nsenderstringrequiredPattern^0x[0-9a-f]{64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dsourcestringrequiredopen: committed with the open request;set: an edit (set_trigger_levels).stopLossWadstring | nullScaled by 1e18 (WAD).
Pattern^(0|[1-9][0-9]*)n$Example71500000000000000000ntakeProfitWadstring | nullWAD price.
Pattern^(0|[1-9][0-9]*)n$Example78000000000000000000ntimestampMsstringrequiredMilliseconds.
Pattern^(0|[1-9][0-9]*)n$Example1796677200000ntxDigeststringrequiredPattern^[1-9A-HJ-NP-Za-km-z]{32,44}$Examplec3CE1sYJ2ufo1E8wNhVahkJbu66F4tMxpTXLeW3o8QSA
Example request
curl 'https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/trigger-levels'const res = await fetch("https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/trigger-levels");
const { data } = await res.json();Example response (200)
{
"data": {
"levels": [
{
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"positionId": "1042n",
"requestId": "0xe4685be89af887adcea9b6bd3842cb9276e839bad0c361f0380ab288ae8a0b05",
"revision": "1n",
"sender": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"source": "string",
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"timestampMs": "1796677200000n",
"txDigest": "c3CE1sYJ2ufo1E8wNhVahkJbu66F4tMxpTXLeW3o8QSA"
}
]
}
}TP/SL triggers
/accounts/{owner}/triggersPath parameters
ownerstringrequiredWallet address
Pattern^(0[xX])?[0-9a-fA-F]{1,64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d
Query parameters
cursorstringOpaque cursor from the previous page's nextCursor.
Example0xc00d9a508112ec1dff7df53f35f096e26af4ec600dc291264b483d27aeb18b75limitstringPage size: canonical decimal (digits only, no sign, whitespace or leading zero), 1 to 18446744073709551615, else 400 bad_request; an empty value is omitted. The service clamps it to
api.max-page-limit, which is also its default.Pattern^(0|[1-9][0-9]*)$Example50
Responses
One page of public attached trigger rows and recent terminal outcomes ({ triggers, nextCursor }; nextCursor is an opaque page token, null on the last page). Pending open intents (lapsed ones included) and open digests are omitted by the service. Rows may include paused, stopLossDropped {reason, ms, wad}, voidReason (order_not_filled, not_in_transaction, ambiguous_open, aborted, expired, cancelled, over_cap, attach_impossible, lapse_evicted), firing, firingMaxEpoch and firingEtaMs. ETA is an estimate, not proof of expiry. All integers are n-suffixed decimal strings.
application/json
dataTriggersrequirednextCursorstring | nullOpaque cursor of the next page (pass it as
cursor); null on the last page.triggersTriggerView[]requiredTrigger rows; unsent open digests are omitted.
Example request
curl 'https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/triggers'const res = await fetch("https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/triggers");
const { data } = await res.json();Example response (200)
{
"data": {
"nextCursor": "string",
"triggers": [
{
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"firing": true,
"firingEtaMs": "1796677200000n",
"firingKind": "string",
"firingMaxEpoch": "912n",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"paused": true,
"positionId": "1042n",
"status": "pending",
"stopLossDropped": {
"ms": "1796677200000n",
"reason": "string",
"wad": "74250000000000000000n"
},
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"voidReason": "string"
}
]
}
}Trading referral
/accounts/{walletAddress}/trading-referralPath parameters
walletAddressstringrequiredWallet address
Pattern^(0[xX])?[0-9a-fA-F]{1,64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d
Responses
referrer (null when unbound), refereeCount, totalEarned and pending (integers as n-suffixed decimal strings, "5000000n").
application/json
dataTradingReferralrequiredpendingstringrequiredPattern^-?(0|[1-9][0-9]*)n$Example100000000nrefereeCountstringrequiredWallets bound to this one as their referrer.
Pattern^-?(0|[1-9][0-9]*)n$Example24nreferrerstring | nullThe wallet's referrer; null when unbound.
Pattern^0x[0-9a-f]{64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dtotalEarnedstringrequiredPattern^-?(0|[1-9][0-9]*)n$Example100000000n
Example request
curl 'https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/trading-referral'const res = await fetch("https://api.parchment.trade/accounts/0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d/trading-referral");
const { data } = await res.json();Example response (200)
{
"data": {
"pending": "100000000n",
"refereeCount": "24n",
"referrer": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"totalEarned": "100000000n"
}
}Position
/positions/{id}Path parameters
idstringrequiredPosition id: canonical decimal (digits only, no sign, whitespace or leading zero). A canonical decimal above 18446744073709551615 names no position and is 404 position_not_found without calling the service.
Example1042
Responses
One position ({ position }), including autoCloseAtMs (equity session end, else null). The service's typed response, as public camelCase JSON.
application/json
dataPositionResponserequiredpositionPositionrequiredOne position, open or exited.
accountIdstring | nullPattern^0x[0-9a-f]{64}$Example0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691attributionstringrequiredWho sent a position's open.
One ofownerdelegateunindexed_accountautoCloseAtMsstring | nullOpen positions on equity markets: when the session force close settles it.
Pattern^-?(0|[1-9][0-9]*)n$Example1796677200000nbustWadstring | nullScaled by 1e18 (WAD).
Pattern^-?(0|[1-9][0-9]*)n$Example67550000000000000000ncloseFeePpmstring | nullParts per million.
Pattern^-?(0|[1-9][0-9]*)n$Example500nconfWadstring | nullScaled by 1e18 (WAD).
Pattern^-?(0|[1-9][0-9]*)n$Example30000000000000000ndeadbandPpmstring | nullParts per million.
Pattern^-?(0|[1-9][0-9]*)n$Example1000nentryWadstring | nullScaled by 1e18 (WAD).
Pattern^-?(0|[1-9][0-9]*)n$Example74250000000000000000nexitKindnull | stringfactorBpsstring | nullBasis points (1/10000).
Pattern^-?(0|[1-9][0-9]*)n$Example10000nfillBustWadstring | nullLiquidation price at the fill, not the requested stop-loss price.
Pattern^-?(0|[1-9][0-9]*)n$Example67550000000000000000nisLongbooleanrequiredleveragestring | nullnotional / margin.Pattern^-?(0|[1-9][0-9]*)n$Example10nmarginstring | nullPattern^-?(0|[1-9][0-9]*)n$Example100000000nmarketIdstringrequiredPattern^0x[0-9a-f]{64}$Example0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645midWadstring | nullScaled by 1e18 (WAD).
Pattern^-?(0|[1-9][0-9]*)n$Example74250000000000000000nnotionalstring | nullPattern^-?(0|[1-9][0-9]*)n$Example1000000000nopenTxstring | nullopenedAtMsstring | nullMilliseconds.
Pattern^-?(0|[1-9][0-9]*)n$Example1796677200000nownerstringrequiredPattern^0x[0-9a-f]{64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dpositionIdstringrequiredPattern^-?(0|[1-9][0-9]*)n$Example1042nslDroppedReasonstring | nullService-recorded stop-loss drop reason, independent of the current trigger legs.
statusstringrequiredOne ofopenclosedliquidatedstopLossWadstring | nullScaled by 1e18 (WAD).
Pattern^(0|[1-9][0-9]*)n$Example71500000000000000000ntakeProfitWadstring | nullScaled by 1e18 (WAD).
Pattern^(0|[1-9][0-9]*)n$Example78000000000000000000ntraderstringrequiredSender of the open.
Pattern^0x[0-9a-f]{64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dtriggersnull | TriggerViewwinFeeBpsstring | nullBasis points (1/10000).
Pattern^-?(0|[1-9][0-9]*)n$Example2000nwinningExposurestring | nullPattern^-?(0|[1-9][0-9]*)n$Example1850000000000n
Example request
curl 'https://api.parchment.trade/positions/1042'const res = await fetch("https://api.parchment.trade/positions/1042");
const { data } = await res.json();Example response (200)
{
"data": {
"position": {
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"attribution": "owner",
"autoCloseAtMs": "1796677200000n",
"bustWad": "67550000000000000000n",
"closeFeePpm": "500n",
"confWad": "30000000000000000n",
"deadbandPpm": "1000n",
"entryWad": "74250000000000000000n",
"exitKind": "close",
"factorBps": "10000n",
"fillBustWad": "67550000000000000000n",
"isLong": true,
"leverage": "10n",
"margin": "100000000n",
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"midWad": "74250000000000000000n",
"notional": "1000000000n",
"openTx": "string",
"openedAtMs": "1796677200000n",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"positionId": "1042n",
"slDroppedReason": "string",
"status": "open",
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"trader": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"triggers": {
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"firing": true,
"firingEtaMs": "1796677200000n",
"firingKind": "string",
"firingMaxEpoch": "912n",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"paused": true,
"positionId": "1042n",
"status": "pending",
"stopLossDropped": {
"ms": "1796677200000n",
"reason": "string",
"wad": "74250000000000000000n"
},
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"voidReason": "string"
},
"winFeeBps": "2000n",
"winningExposure": "1850000000000n"
}
}
}Set or clear TP/SL
/triggersRequest body (required)
SetTriggersRequest · application/jsonaccountIdstringrequiredAccount owned by the signer.
Example0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691expiresAtMsstringrequiredProof expiry and monotonic revision time, Unix ms.
Pattern^(0|[1-9][0-9]*)n$Example1796677200000nisLongboolean | nullSide signed for the open target.
marketIdstring | nullMarket signed for the open target.
Example0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645openTxBytesBase64string | nullBCS Transaction (padded standard base64) whose digest must equal open_tx_digest. Required on open intents that set a leg so the service records the transaction's epoch bound (unbounded opens are refused); may be omitted on an open clear (both legs null); refused on position targets.
openTxDigeststring | nullDigest of the future open transaction.
Examplex21Xc3621WJsDb7MdBCf9GZ9v9vh3UnWrdWRADfTKNCqownerstringrequiredWallet signing the personal message.
Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dpositionIdstring | nullExisting position; mutually exclusive with the open target fields.
Pattern^(0|[1-9][0-9]*)n$Example1042nsignaturestringrequiredSui personal-message signature, base64.
stopLossWadstring | nullSL price in exact 18 decimal WAD units; null clears it.
Pattern^(0|[1-9][0-9]*)n$Example71500000000000000000ntakeProfitWadstring | nullTP price in exact 18 decimal WAD units; null clears it.
Pattern^(0|[1-9][0-9]*)n$Example78000000000000000000n
Responses
Set or clear both legs with a newer owner-signed proof. Target: positionId OR openTxDigest+marketId+isLong; explicit null for unused fields is absent. Open intents that set a leg carry openTxBytesBase64 (padded standard base64 BCS Transaction with finite maximum epoch) for digest/expiry verification; an open clear (both legs null) may omit it, and a position target refuses it. Each leg closes the whole position. Both null legs clear, including while paused. Integers are n-suffixed decimal strings; the signed seven-line message uses plain decimals. Responses omit open digests and signature material.
application/json
dataTriggerViewrequiredaccountIdstringrequiredOwning account.
Pattern^0x[0-9a-f]{64}$Example0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691firingboolean | nullA signed close may still execute; edits are fenced until resolved.
firingEtaMsstring | nullBest known end of the epoch validity window, Unix ms; absent if unavailable.
Pattern^(0|[1-9][0-9]*)n$Example1796677200000nfiringKindstring | nullLeg currently submitting, tp or sl.
firingMaxEpochstring | nullLast epoch in which the saved close may execute; resolved when chain epoch exceeds it.
Pattern^(0|[1-9][0-9]*)n$Example912nisLongbooleanrequiredPosition direction.
marketIdstringrequiredMarket for both legs.
Pattern^0x[0-9a-f]{64}$Example0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645ownerstringrequiredWallet owner.
Pattern^0x[0-9a-f]{64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dpausedboolean | nullMissing close grant pauses evaluation while retaining the legs.
positionIdstring | nullPosition once the open attaches.
Pattern^(0|[1-9][0-9]*)n$Example1042nstatusstringrequiredpending, attached, armed, idle, firing, submitted, fired, closed or void.
One ofpendingattachedarmedidlefiringsubmittedfiredclosedvoidstopLossDroppednull | StopLossDroppedstopLossWadstring | nullArmed SL WAD.
Pattern^(0|[1-9][0-9]*)n$Example71500000000000000000ntakeProfitWadstring | nullArmed TP WAD.
Pattern^(0|[1-9][0-9]*)n$Example78000000000000000000nvoidReasonstring | nullTerminal reason for a recent void open intent.
Example request
curl -X POST 'https://api.parchment.trade/triggers' \
-H 'Content-Type: application/json' \
-d '{
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"expiresAtMs": "1796677200000n",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"openTxBytesBase64": "string",
"openTxDigest": "x21Xc3621WJsDb7MdBCf9GZ9v9vh3UnWrdWRADfTKNCq",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"positionId": "1042n",
"signature": "string",
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n"
}'const res = await fetch("https://api.parchment.trade/triggers", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"expiresAtMs": "1796677200000n",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"openTxBytesBase64": "string",
"openTxDigest": "x21Xc3621WJsDb7MdBCf9GZ9v9vh3UnWrdWRADfTKNCq",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"positionId": "1042n",
"signature": "string",
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n"
}),
});
const { data } = await res.json();Example response (200)
{
"data": {
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"firing": true,
"firingEtaMs": "1796677200000n",
"firingKind": "string",
"firingMaxEpoch": "912n",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"paused": true,
"positionId": "1042n",
"status": "pending",
"stopLossDropped": {
"ms": "1796677200000n",
"reason": "string",
"wad": "74250000000000000000n"
},
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"voidReason": "string"
}
}Bind prepared TP/SL to an open
/triggers/bindRequest body (required)
BindTriggersRequest · application/jsonaccountIdstringrequiredExample0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691intentIdstringrequiredExampled54daa1bcef482122fedd0b7c675ff7copenTxBytesBase64stringrequiredThe signed open
Transaction, BCS, padded standard base64.ownerstringrequiredExample0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dsignaturesstring[]requiredIts base64 Sui signatures; the sender's (owner or the delegate that signed the prepare) must be one.
Responses
Binds a prepared intent to its signed open transaction, whose sender signed it: the legs become that open's intent (attached at once if the open already filled). One intent binds one transaction; a repeat with the same one answers the same. Integers in the trigger row are n-suffixed decimal strings.
application/json
dataTriggerViewrequiredaccountIdstringrequiredOwning account.
Pattern^0x[0-9a-f]{64}$Example0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691firingboolean | nullA signed close may still execute; edits are fenced until resolved.
firingEtaMsstring | nullBest known end of the epoch validity window, Unix ms; absent if unavailable.
Pattern^(0|[1-9][0-9]*)n$Example1796677200000nfiringKindstring | nullLeg currently submitting, tp or sl.
firingMaxEpochstring | nullLast epoch in which the saved close may execute; resolved when chain epoch exceeds it.
Pattern^(0|[1-9][0-9]*)n$Example912nisLongbooleanrequiredPosition direction.
marketIdstringrequiredMarket for both legs.
Pattern^0x[0-9a-f]{64}$Example0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645ownerstringrequiredWallet owner.
Pattern^0x[0-9a-f]{64}$Example0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dpausedboolean | nullMissing close grant pauses evaluation while retaining the legs.
positionIdstring | nullPosition once the open attaches.
Pattern^(0|[1-9][0-9]*)n$Example1042nstatusstringrequiredpending, attached, armed, idle, firing, submitted, fired, closed or void.
One ofpendingattachedarmedidlefiringsubmittedfiredclosedvoidstopLossDroppednull | StopLossDroppedstopLossWadstring | nullArmed SL WAD.
Pattern^(0|[1-9][0-9]*)n$Example71500000000000000000ntakeProfitWadstring | nullArmed TP WAD.
Pattern^(0|[1-9][0-9]*)n$Example78000000000000000000nvoidReasonstring | nullTerminal reason for a recent void open intent.
Example request
curl -X POST 'https://api.parchment.trade/triggers/bind' \
-H 'Content-Type: application/json' \
-d '{
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"intentId": "d54daa1bcef482122fedd0b7c675ff7c",
"openTxBytesBase64": "string",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"signatures": []
}'const res = await fetch("https://api.parchment.trade/triggers/bind", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"intentId": "d54daa1bcef482122fedd0b7c675ff7c",
"openTxBytesBase64": "string",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"signatures": []
}),
});
const { data } = await res.json();Example response (200)
{
"data": {
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"firing": true,
"firingEtaMs": "1796677200000n",
"firingKind": "string",
"firingMaxEpoch": "912n",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"paused": true,
"positionId": "1042n",
"status": "pending",
"stopLossDropped": {
"ms": "1796677200000n",
"reason": "string",
"wad": "74250000000000000000n"
},
"stopLossWad": "71500000000000000000n",
"takeProfitWad": "78000000000000000000n",
"voidReason": "string"
}
}Prepare TP/SL for a pending open
/triggers/prepareRequest body (required)
PrepareTriggersRequest · application/jsonaccountIdstringrequiredExample0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691expiresAtMsstringrequiredCanonical decimal unix ms.
intentIdstringrequired32 lowercase hex digits: 16 random bytes the client chose, used once.
Exampled54daa1bcef482122fedd0b7c675ff7cisLongbooleanrequiredmarketIdstringrequiredExample0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645ownerstringrequiredExample0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0dsignaturestringrequiredstopLossWadstring | nullCanonical decimal WAD, or null.
takeProfitWadstring | nullCanonical decimal WAD, or null.
Responses
TP/SL for an open that is still being built, checked like an open intent and stored under the intent id until a signed open is bound to it (POST /triggers/bind) or the proof expires. Arms nothing by itself. Decimals are plain strings, as signed.
application/json
dataPreparedIntentrequiredexpiresAtMsstringrequiredintentIdstringrequiredExampled54daa1bcef482122fedd0b7c675ff7c
Example request
curl -X POST 'https://api.parchment.trade/triggers/prepare' \
-H 'Content-Type: application/json' \
-d '{
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"expiresAtMs": "string",
"intentId": "d54daa1bcef482122fedd0b7c675ff7c",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"signature": "string",
"stopLossWad": "string",
"takeProfitWad": "string"
}'const res = await fetch("https://api.parchment.trade/triggers/prepare", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"accountId": "0xad23e722f3542ae36c276c1b303e30ae77c840a84db89c7215fa87bf92006691",
"expiresAtMs": "string",
"intentId": "d54daa1bcef482122fedd0b7c675ff7c",
"isLong": true,
"marketId": "0x6e6238eb4f69bfcc3e884a7d20904eb0995ca2e42c95dc8560d5a417486ab645",
"owner": "0x77b909b550ed11c45f1378c03c0954c0d77d320cdc938e35509564b1e505ce0d",
"signature": "string",
"stopLossWad": "string",
"takeProfitWad": "string"
}),
});
const { data } = await res.json();Example response (200)
{
"data": {
"expiresAtMs": "string",
"intentId": "d54daa1bcef482122fedd0b7c675ff7c"
}
}