> For the complete documentation index, see [llms.txt](https://docs.afx.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.afx.xyz/api-reference/exchange/models.md).

# Models

## The Signature object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The ExchangeResponse object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"ExchangeResponse":{"type":"object","properties":{"code":{"type":"integer","description":"`0` = success. See Error Codes section for non-zero values."},"message":{"type":"string"},"data":{"type":"object","nullable":true,"properties":{"txHash":{"type":"string"},"txCode":{"type":"integer"},"txMsg":{"type":"string"}}}}}}}}
```

## The PlaceOrderRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"PlaceOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","orders"],"properties":{"type":{"type":"string","enum":["placeOrder"]},"orders":{"type":"array","minItems":1,"items":{"type":"object","required":["symbolCode","ordPx","ordQty","ordType","ordSide","timeInForce"],"properties":{"symbolCode":{"type":"integer","format":"int64"},"ordPx":{"type":"string","description":"Limit `> 0`, Market `\"0\"`"},"ordQty":{"type":"string"},"ordType":{"type":"string","enum":["LIMIT","MARKET"],"description":"NONE and display-only values MARKET_LIQ_SELLOFF, LIMIT_LIQ_SELLOFF, ADL, and LIQUIDATION must not be sent in requests."},"ordSide":{"type":"string","enum":["BUY","SELL","BUY_CLOSE_HEDGE","SELL_CLOSE_HEDGE"]},"timeInForce":{"type":"string","enum":["GTC","IOC","FOK","POST_ONLY"]},"clOrdId":{"type":"integer","format":"int64"},"parentOrdId":{"type":"integer","format":"int64"},"reduceOnlyOption":{"type":"string","enum":["REDUCE_ONLY","TP_FROM_POSITION","SL_FROM_POSITION"]},"triggerPx":{"type":"string"},"tpslTriggerType":{"type":"string","enum":["LAST_PRICE","MARK_PRICE","INDEX_PRICE"]},"slippagePct":{"type":"string"}}}}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Unix timestamp in milliseconds after which the request expires. null = no expiry; use 0 in the signature payload when this field is null."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The ReplaceOrderRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"ReplaceOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","symbolCode","ordPx","ordQty","ordType","ordSide","timeInForce"],"properties":{"type":{"type":"string","enum":["replaceOrder"]},"symbolCode":{"type":"integer","format":"int64"},"ordPx":{"type":"string","description":"Limit `> 0`, Market `\"0\"`"},"ordQty":{"type":"string"},"ordType":{"type":"string","enum":["LIMIT","MARKET"],"description":"NONE and display-only values MARKET_LIQ_SELLOFF, LIMIT_LIQ_SELLOFF, ADL, and LIQUIDATION must not be sent in requests."},"ordSide":{"type":"string","enum":["BUY","SELL","BUY_CLOSE_HEDGE","SELL_CLOSE_HEDGE"]},"timeInForce":{"type":"string","enum":["GTC","IOC","FOK","POST_ONLY"]},"clOrdId":{"type":"integer","format":"int64","description":"Client order ID. clOrdId or ordId is required."},"ordId":{"type":"integer","format":"int64","description":"System order ID. clOrdId or ordId is required."},"parentOrdId":{"type":"integer","format":"int64"},"reduceOnly":{"type":"string","enum":["REDUCE_ONLY","TP_FROM_POSITION","SL_FROM_POSITION"]},"triggerPx":{"type":"string"},"tpslTriggerType":{"type":"string","enum":["LAST_PRICE","MARK_PRICE","INDEX_PRICE"]},"slippagePct":{"type":"string"}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Unix timestamp in milliseconds after which the request expires. null = no expiry; use 0 in the signature payload when this field is null."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The PlaceBracketOrderRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"PlaceBracketOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","orders"],"properties":{"type":{"type":"string","enum":["placeBracketOrder"]},"orders":{"type":"array","minItems":2,"maxItems":3,"items":{"type":"object","required":["symbolCode","ordPx","ordQty","ordType","ordSide","timeInForce"],"properties":{"symbolCode":{"type":"integer","format":"int64"},"ordPx":{"type":"string","description":"Limit `> 0`, Market `\"0\"`"},"ordQty":{"type":"string"},"ordType":{"type":"string","enum":["LIMIT","MARKET"],"description":"NONE and display-only values MARKET_LIQ_SELLOFF, LIMIT_LIQ_SELLOFF, ADL, and LIQUIDATION must not be sent in requests."},"ordSide":{"type":"string","enum":["BUY","SELL","BUY_CLOSE_HEDGE","SELL_CLOSE_HEDGE"]},"timeInForce":{"type":"string","enum":["GTC","IOC","FOK","POST_ONLY"]},"clOrdId":{"type":"integer","format":"int64"},"parentOrdId":{"type":"integer","format":"int64"},"reduceOnly":{"type":"string","enum":["REDUCE_ONLY","TP_FROM_POSITION","SL_FROM_POSITION"]},"triggerPx":{"type":"string"},"tpslTriggerType":{"type":"string","enum":["LAST_PRICE","MARK_PRICE","INDEX_PRICE"]},"slippagePct":{"type":"string"}}}}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Unix timestamp in milliseconds after which the request expires. null = no expiry; use 0 in the signature payload when this field is null."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The CancelOrderRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"CancelOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","cancels"],"properties":{"type":{"type":"string","enum":["cancelOrder"]},"cancels":{"type":"array","minItems":1,"items":{"type":"object","required":["symbolCode"],"properties":{"symbolCode":{"type":"string"},"clOrdId":{"type":"string","description":"Client order ID (clOrdId or ordId required)"},"ordId":{"type":"string","description":"System order ID (clOrdId or ordId required)"}}}}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The CancelAllRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"CancelAllRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","symbolCode"],"properties":{"type":{"type":"string","enum":["cancelAll"]},"symbolCode":{"type":"integer","format":"int64"},"conditionalOrder":{"type":"boolean","default":false}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The SetLeverageRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"SetLeverageRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","symbolCode","leverage"],"properties":{"type":{"type":"string","enum":["setLeverage"]},"symbolCode":{"type":"integer","format":"int64"},"leverage":{"type":"string","description":">= 1, max 2 decimal places"}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The SetMarginModeRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"SetMarginModeRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","symbolCode","marginMode"],"properties":{"type":{"type":"string","enum":["setMarginMode"]},"symbolCode":{"type":"integer","format":"int64"},"marginMode":{"type":"string","enum":["CROSS","ISOLATED"]}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The AssignPosMarginRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"AssignPosMarginRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","symbolCode","assignedPosMargin"],"properties":{"type":{"type":"string","enum":["assignPosMargin"]},"symbolCode":{"type":"integer","format":"int64"},"assignedPosMargin":{"type":"string","description":"Amount to assign (non-zero)"}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The ApproveAgentRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"ApproveAgentRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","agentAddress","agentName","validitySeconds","dexChain"],"properties":{"type":{"type":"string","enum":["approveAgent"]},"agentAddress":{"type":"string","description":"Agent wallet address (0x hex)"},"agentName":{"type":"string","default":"app.afx.xyz","description":"Agent name. SDK default: app.afx.xyz"},"validitySeconds":{"type":"integer","format":"int64","description":"Agent authorization duration in seconds. 0 means the authorization is valid for 7 days; maximum 365 days."},"dexChain":{"type":"string","enum":["Mainnet","Testnet"]},"referralCode":{"type":"string","description":"Referral code (only effective on first approve)"}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Unix timestamp in milliseconds after which the request expires. null = no expiry; use 0 in the signature payload when this field is null."}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The WithdrawRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"WithdrawRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","destination","amount"],"properties":{"type":{"type":"string","enum":["withdraw"]},"destination":{"type":"string","description":"Recipient address (0x hex)"},"amount":{"type":"string","description":"Withdrawal amount. Minimum mainnet withdrawal: 2 USDC."}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Unix timestamp in milliseconds after which the request expires. For withdrawals, use a longer window such as current time + 3,600,000 milliseconds. null = no expiry; use 0 in the signature payload when this field is null."}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The BindReferralRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"BindReferralRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","referralCode"],"properties":{"type":{"type":"string","enum":["bindReferral"]},"referralCode":{"type":"string"}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The BuilderOrder object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"BuilderOrder":{"type":"object","required":["symbolCode","ordPx","ordQty","ordType","ordSide","timeInForce"],"properties":{"symbolCode":{"type":"integer","format":"int64"},"ordPx":{"type":"string","description":"Limit price; use `0` for a market order"},"ordQty":{"type":"string"},"ordType":{"type":"string","enum":["LIMIT","MARKET","STOP_LIMIT","STOP_MARKET","TAKE_PROFIT_LIMIT","TAKE_PROFIT_MARKET"]},"ordSide":{"type":"string","enum":["BUY","SELL","BUY_CLOSE_HEDGE","SELL_CLOSE_HEDGE"]},"timeInForce":{"type":"string","enum":["GTC","IOC","FOK","POST_ONLY"]},"clOrdId":{"type":"integer","format":"int64"},"parentOrdId":{"type":"integer","format":"int64"},"reduceOnly":{"type":"string","enum":["REDUCE_ONLY","TP_FROM_POSITION","SL_FROM_POSITION"],"description":"`reduceOnlyOption` is accepted as a compatibility alias."},"triggerPx":{"type":"string"},"tpslTriggerType":{"type":"string","enum":["LAST_PRICE","MARK_PRICE","INDEX_PRICE"]},"slippagePct":{"type":"string"}}}}}}
```

## The RegisterBuilderRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"RegisterBuilderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","name","dexChain"],"properties":{"type":{"type":"string","enum":["registerBuilder"]},"name":{"type":"string","minLength":1},"dexChain":{"type":"string","enum":["Mainnet","Testnet"]}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64"},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Sign `0` when omitted or null."}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The ApproveAgentToBuilderRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"ApproveAgentToBuilderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","agentAddress","builderAddress","maxFeeRate","validitySeconds","dexChain"],"properties":{"type":{"type":"string","enum":["approveAgentToBuilder"]},"agentAddress":{"type":"string","description":"Builder agent address"},"builderAddress":{"type":"string","description":"Builder master wallet address"},"maxFeeRate":{"type":"string","description":"Positive decimal string; subject to the configured fee cap"},"validitySeconds":{"type":"integer","format":"int64","minimum":0},"dexChain":{"type":"string","enum":["Mainnet","Testnet"]}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64"},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Sign `0` when omitted or null."}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The RevokeAgentToBuilderRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"RevokeAgentToBuilderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","dexChain"],"properties":{"type":{"type":"string","enum":["revokeAgentToBuilder"]},"dexChain":{"type":"string","enum":["Mainnet","Testnet"]}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64"},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Sign `0` when omitted or null."}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The PlaceBuilderOrderRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"PlaceBuilderOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","order","builder","builderFeeRate"],"properties":{"type":{"type":"string","enum":["placeBuilderOrder"]},"order":{"$ref":"#/components/schemas/BuilderOrder"},"builder":{"type":"string","description":"Builder master wallet address"},"builderFeeRate":{"type":"string","description":"Non-negative decimal string; must not exceed the Trader authorization"}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64"},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Use `0` in the L1 connection ID when omitted or null."},"vaultAddress":{"type":"string","nullable":true}}},"BuilderOrder":{"type":"object","required":["symbolCode","ordPx","ordQty","ordType","ordSide","timeInForce"],"properties":{"symbolCode":{"type":"integer","format":"int64"},"ordPx":{"type":"string","description":"Limit price; use `0` for a market order"},"ordQty":{"type":"string"},"ordType":{"type":"string","enum":["LIMIT","MARKET","STOP_LIMIT","STOP_MARKET","TAKE_PROFIT_LIMIT","TAKE_PROFIT_MARKET"]},"ordSide":{"type":"string","enum":["BUY","SELL","BUY_CLOSE_HEDGE","SELL_CLOSE_HEDGE"]},"timeInForce":{"type":"string","enum":["GTC","IOC","FOK","POST_ONLY"]},"clOrdId":{"type":"integer","format":"int64"},"parentOrdId":{"type":"integer","format":"int64"},"reduceOnly":{"type":"string","enum":["REDUCE_ONLY","TP_FROM_POSITION","SL_FROM_POSITION"],"description":"`reduceOnlyOption` is accepted as a compatibility alias."},"triggerPx":{"type":"string"},"tpslTriggerType":{"type":"string","enum":["LAST_PRICE","MARK_PRICE","INDEX_PRICE"]},"slippagePct":{"type":"string"}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```

## The PlaceBuilderBracketOrderRequest object

```json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"components":{"schemas":{"PlaceBuilderBracketOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","orders","builder","builderFeeRate"],"properties":{"type":{"type":"string","enum":["placeBuilderBracketOrder"]},"orders":{"type":"array","minItems":2,"maxItems":3,"description":"First item is the main order; later items are TP and/or SL orders.","items":{"$ref":"#/components/schemas/BuilderOrder"}},"builder":{"type":"string","description":"Builder master wallet address"},"builderFeeRate":{"type":"string","description":"Non-negative decimal string; must not exceed the Trader authorization"}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64"},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Use `0` in the L1 connection ID when omitted or null."},"vaultAddress":{"type":"string","nullable":true}}},"BuilderOrder":{"type":"object","required":["symbolCode","ordPx","ordQty","ordType","ordSide","timeInForce"],"properties":{"symbolCode":{"type":"integer","format":"int64"},"ordPx":{"type":"string","description":"Limit price; use `0` for a market order"},"ordQty":{"type":"string"},"ordType":{"type":"string","enum":["LIMIT","MARKET","STOP_LIMIT","STOP_MARKET","TAKE_PROFIT_LIMIT","TAKE_PROFIT_MARKET"]},"ordSide":{"type":"string","enum":["BUY","SELL","BUY_CLOSE_HEDGE","SELL_CLOSE_HEDGE"]},"timeInForce":{"type":"string","enum":["GTC","IOC","FOK","POST_ONLY"]},"clOrdId":{"type":"integer","format":"int64"},"parentOrdId":{"type":"integer","format":"int64"},"reduceOnly":{"type":"string","enum":["REDUCE_ONLY","TP_FROM_POSITION","SL_FROM_POSITION"],"description":"`reduceOnlyOption` is accepted as a compatibility alias."},"triggerPx":{"type":"string"},"tpslTriggerType":{"type":"string","enum":["LAST_PRICE","MARK_PRICE","INDEX_PRICE"]},"slippagePct":{"type":"string"}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.afx.xyz/api-reference/exchange/models.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
