Skip to main content
POST
/
2
/
perp
/
quote
Get perp quote
curl --request POST \
  --url https://demo-api.mobula.io/api/2/perp/quote \
  --header 'Content-Type: application/json' \
  --data '
{
  "user": "<string>",
  "baseToken": "<string>",
  "quote": "<string>",
  "leverage": 123,
  "long": true,
  "reduceOnly": true,
  "collateralAmount": 123,
  "orderType": "market",
  "openPrice": 123,
  "tp": 123,
  "sl": 123,
  "amountRaw": 123,
  "maxSlippageP": 123,
  "chainIds": [
    "<string>"
  ],
  "dexes": [
    "gains"
  ],
  "marginMode": 123,
  "referrer": "<string>"
}
'
{
  "success": true,
  "data": {
    "dex": "<string>",
    "marketId": "<string>",
    "chainId": "<string>",
    "payload": {},
    "payloadStr": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.mobula.io/llms.txt

Use this file to discover all available pages before exploring further.

Quotes are informational only. Execution uses the /2/perp/payloads/<action>/2/perp/execute-v2 flow. Use the quote endpoint to preview fills, fees, and which DEX would route best; then call /2/perp/payloads/create-order to build the actual signed payload you submit.

Request Body

user
string
required
Wallet address of the trader. Used to scope the quote (e.g., Lighter account lookup). The quote endpoint does not verify a signature.
baseToken
string
required
Base token address, symbol, or Mobula asset id (e.g., ETH, 0x...).
quote
string
required
Quote/collateral token (typically USDC).
leverage
number
required
Leverage multiplier (e.g., 10 for 10x).
long
boolean
required
true for long, false for short. String form ("true"/"false") is also accepted.
reduceOnly
boolean
required
true if the order should only reduce an existing position (never increase exposure).
collateralAmount
number
required
Collateral to commit, denominated in the quote token units (e.g., 100 USDC).
orderType
string
One of market, limit, stop_limit. Default market.
openPrice
number
Trigger/limit price. Required for limit and stop_limit.
tp
number
Take-profit price. Must be directionally valid (above open for long, below for short).
sl
number
Stop-loss price. Must be directionally valid (below open for long, above for short).
amountRaw
number
Raw position size in base-token units. If omitted, derived from collateralAmount * leverage.
maxSlippageP
number
Max slippage in percent (e.g., 0.5 = 0.5%).
chainIds
string[]
Restrict routing to specific chains (e.g., ["evm:42161"], ["lighter:301"]). Omit to search all supported chains.
dexes
string[]
Restrict routing to specific DEXs. Values: gains, lighter. Omit to consider all.
marginMode
number
0 = cross, 1 = isolated. DEX-specific; ignored when not applicable.
referrer
string
Referrer wallet address for fee sharing.

Response

data
object

Errors

StatusWhenmessage
400Zod validation failedzod validation failed
500No DEX returned a quotecould not find quote
The errors field lists per-DEX failures, formatted as "<dex> - <error>".

Body

application/json
user
string
required

Wallet address of the trader. Used to scope the quote (e.g., Lighter account lookup).

baseToken
string
required

Base token address, symbol, or Mobula asset id.

quote
string
required

Quote/collateral token (typically USDC).

leverage
number
required
long
required
reduceOnly
boolean
required
collateralAmount
number
required
orderType
enum<string>
Available options:
market,
limit,
stop_limit
openPrice
number
tp
number
sl
number
amountRaw
number
maxSlippageP
number
chainIds
string[]
dexes
enum<string>[]
Available options:
gains,
lighter
marginMode
number
referrer
string

Response

200 - application/json

Perp quote response

success
boolean
required
data
object
required