Hinkal API
Get Swap Data
Get a swap quote and calldata
GET
/get-swap-datahttps://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
| Name | Type | Description |
|---|---|---|
sessionIdrequired | string (uuid) | Session identifier UUID from POST /create-session |
noncerequired | string (uuid) | Per-request UUID. Echoed back in the response. |
chainIdrequired | string | Chain ID (e.g. 10 for Optimism, 501 for Solana mainnet, 728126428 for Tron mainnet) |
inputTokenAddressrequired | string | Token address to swap from |
outputTokenAddressrequired | string | Token address to swap to |
amountrequired | string | Input amount as a decimal string (e.g. "1.2" for 1.2 USDC) |
slippagePercentage | number | Maximum allowed slippage as a percentage (e.g. 0.5 for 0.5%) |
Header parameters
| Name | Type | Description |
|---|---|---|
x-hinkal-request-signaturerequired | string | Hex-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
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
swapDatarequired | string | Swap calldata to pass to POST /swap |
externalActionIdrequired | string | External action id string to pass to POST /swap (e.g. "Lifi", "Okx") |
outSwapAmountrequired | string | Expected output amount in smallest units |
noncerequired | string | Echoed per-request nonce from the request. |
400Validation error
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
errorrequired | string |
401Invalid signature or reused nonce
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
errorrequired | string |
500Server error
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
errorrequired | string |