Skip to main content
POST
Build a signable partial take-profit / stop-loss intent

Body

application/json
trader
string
required

The trader (position owner). USDC collateral is pulled from and paid out to this address.

tradeIndex
integer
required

Position slot index for this trader + pair (0-based; a trader can hold several positions on the same pair). Read it from GET /v2/positions → trades[].trade.index.

Required range: x >= 0
kind
enum<string>
required

Trigger direction: take_profit closes into profit, stop_loss cuts a loss.

Available options:
take_profit,
stop_loss
coinExposure
required

Exposure to close when triggered, in base-asset units.

side
enum<string>
required

Position direction: long or short.

Available options:
long,
short
pairIndex
integer

Pair index (alternative to pair).

Required range: x >= 0
pair
string

Pair symbol, e.g. ETH/USD (separators /, -, _ accepted; case-insensitive).

Minimum string length: 1
nonce

Replay-protection nonce (uint256; unordered Permit2-style bitmap, not sequential). A random one is generated when omitted — only pass a value to pre-reserve or deterministically retry an intent. Check availability via GET /v2/nonce.

triggerType
enum<string>
default:fixed

fixed = trigger at price; percentage = trigger at signed percentage P&L.

Available options:
fixed,
percentage
price

Trigger price in USD (required with triggerType=fixed).

percentage

Signed P&L percentage trigger, e.g. 15 = +15%, -10 = -10% (required with triggerType=percentage).

openTimestamp

The position's on-chain open timestamp (GET /v2/positions → trades[].trade.timestamp). Binds the request to that exact position instance — a stale value is rejected on-chain. Read from chain automatically when omitted.

Response

Success envelope: ok is true and data carries the payload documented below.

ok
enum<boolean>
required

Always true on success.

Available options:
true
data
object
required

A ready-to-sign EIP-712 payload. Sign {domain, types, primaryType, message} with signTypedData (trader or a registered delegate, per signerRule) and hand the 65-byte r||s||v signature to the Avantis service that executes this intent kind.