Hinkal API

Get Swap Data

Get a swap quote and calldata

GET/get-swap-data
https://api.hinkal.io/get-swap-data

Returns the best available swap route, its calldata, and the expected output amount. Works for both EVM and Solana chains — for Solana it returns an OKX quote.

Read-only — requires an active session. Pass sessionId and nonce as query parameters and include x-hinkal-request-signature: secp256k1_sign(SHA256("GET /get-swap-data\n" + queryString)) in the headers.

Query parameters

NameTypeDescription
sessionIdrequiredstring (uuid)Session identifier UUID from POST /create-session
noncerequiredstring (uuid)Per-request UUID. Echoed back in the response.
chainIdrequiredstringChain ID (e.g. 10 for Optimism, 501 for Solana mainnet, 728126428 for Tron mainnet)
inputTokenAddressrequiredstringToken address to swap from
outputTokenAddressrequiredstringToken address to swap to
amountrequiredstringInput amount as a decimal string (e.g. "1.2" for 1.2 USDC)
slippagePercentagenumberMaximum allowed slippage as a percentage (e.g. 0.5 for 0.5%)

Header parameters

NameTypeDescription
x-hinkal-request-signaturerequiredstringHex-encoded compact secp256k1 signature: secp256k1_sign(SHA256(binding + "\n" + payload)), where binding is "<METHOD> <routePath>" (this route's own method and path, e.g. "POST /deposit" or "GET /balance") and payload is JSON.stringify(body) for POST requests or the raw query string for GET requests. Binding the route into the signed digest stops a signature captured for one endpoint from being replayed against another. See Authentication for the full signing scheme.

Responses

200Swap quote
NameTypeDescription
successrequiredboolean
One of: true
swapDatarequiredstringSwap calldata to pass to POST /swap
externalActionIdrequiredstringExternal action id string to pass to POST /swap (e.g. "Lifi", "Okx")
outSwapAmountrequiredstringExpected output amount in smallest units
noncerequiredstringEchoed per-request nonce from the request.
400Validation error
NameTypeDescription
successrequiredboolean
One of: false
errorrequiredstring
401Invalid signature or reused nonce
NameTypeDescription
successrequiredboolean
One of: false
errorrequiredstring
500Server error
NameTypeDescription
successrequiredboolean
One of: false
errorrequiredstring