OstiumBuilder Service
API ReferenceHTTP APIExchange Operations

Exchange: Open

Build transactions to open new positions.

Alpha Version

The Ostium Builder Service is in Alpha. API endpoints, specifications, and builder URLs may change without notice. Use with caution in production environments.

POST /v1/exchange/open

Builds unsigned transactions to open new trading positions.

Headers

HeaderRequiredDescription
X-Trader-AddressYesTrader wallet address.
X-API-KeyNoDelegated mode (delegate wallet must be verified).
Content-TypeYesapplication/json or text/plain (JSON string).

Request Body

FieldTypeRequiredDescription
openOpenYesThe open action.
spnumberNoSlippage percentage (0-100). Default 0.25. Only applies to market orders — ignored for limit and stop (hardcoded to 0).
bdBuilderConfigNoOptional builder fee configuration.

Open

FieldTypeRequiredDescription
anumberYesPair index.
bbooleanYesDirection: true = long, false = short.
tstringYesOpen type: market, limit, stop.
pstringYesPrice as a numeric string (> 0).
sstringYesCollateral in USD (min 5).
lstringYesLeverage as a numeric string (>= 1).
tpstringNoTake-profit price ("0" resets to default).
slstringNoStop-loss price ("0" resets to default).

BuilderConfig

FieldTypeRequiredDescription
bstringYesBuilder address (0x...).
fnumberYesFee percentage (0-0.5).

Constraints

  • tp and sl must be non-negative when provided.
  • For longs, tp must be above p and sl below p when they are > 0.
  • For shorts, tp must be below p and sl above p when they are > 0.

Response Body (unsigned)

FieldTypeRequiredDescription
transactionsUnsignedTransaction[]YesOne unsigned transaction.

Response Body (delegated)

FieldTypeRequiredDescription
txHashstringYesTransaction hash of the delegated action.
smartAccountAddressstringYesSmart account used for delegation.

Example Request

curl -X POST https://builder.ostiscan.xyz/v1/exchange/open \
  -H "Content-Type: application/json" \
  -H "X-Trader-Address: 0xYourWallet" \
  -d '{"open":{"a":0,"b":true,"p":"42500","s":"100","l":"10","t":"market"},"sp":0.25}'

Response (200, unsigned)

{
  "transactions": [
    { "to": "0x...", "data": "0x...", "value": "0", "from": "0xYourWallet" }
  ]
}

Response (200, delegated)

{
  "txHash": "0x...",
  "smartAccountAddress": "0x..."
}

Errors

See /docs/errors.

On this page