Skip to main content
POST
/
clients
/
me
/
integrations
/
0x
/
swap
/
price
Get a swap price estimate
curl --request POST \
  --url https://api.portalhq.io/api/v3/clients/me/integrations/0x/swap/price \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "chainId": "<string>",
  "buyToken": "<string>",
  "sellToken": "<string>",
  "sellAmount": "<string>",
  "zeroXApiKey": "<string>",
  "slippageBps": 123,
  "excludedSources": "<string>"
}
'
{
  "data": {
    "rawResponse": {
      "blockNumber": "<string>",
      "buyAmount": "<string>",
      "buyToken": "<string>",
      "fees": {},
      "issues": {},
      "liquidityAvailable": true,
      "minBuyAmount": "<string>",
      "route": {},
      "sellAmount": "<string>",
      "sellToken": "<string>",
      "tokenMetadata": {},
      "totalNetworkFee": "<string>",
      "transaction": {
        "to": "<string>",
        "data": "<string>",
        "gas": "<string>",
        "gasPrice": "<string>",
        "value": "<string>",
        "from": "<string>"
      }
    }
  }
}

Authorizations

Authorization
string
header
required

Client API Key or Client Session Token (CST). Pass as a Bearer token in the Authorization header.

Body

application/json
chainId
string
required

Chain ID in CAIP-2 format (e.g. eip155:1).

buyToken
string
required

Token symbol or address to buy.

sellToken
string
required

Token symbol or address to sell.

sellAmount
string
required

Amount to sell in the smallest unit.

zeroXApiKey
string

Optional 0x API key.

slippageBps
number

Maximum acceptable slippage in basis points.

excludedSources
string

Comma-separated list of liquidity sources to exclude.

Response

Swap price retrieved successfully

data
object