Hinkal API
Get Fee
Get the fee amount for an operation
GET
/get-feehttps://api.hinkal.io/get-fee
Returns the relay fee amount for the given operation. Withdraw, transfer, and swap all
compute this fee automatically, so calling this endpoint first is optional — use it to
show the fee to a user before they confirm, or to lock in an exact feeAmount by passing
it into the transaction request.
Read-only — requires an active session. Pass sessionId and nonce as query parameters
and include x-hinkal-request-signature: secp256k1_sign(SHA256("GET /get-fee\n" + queryString))
in the headers.
Solana-specific parameters:
amounts[]— provide the transaction amounts so the server can calculate the exact nullifier count (used to estimate ATA creation costs).mintFrom— for Solana swap fee estimation, pass the input token address so the server can estimate the OKX Associated Token Account cost.
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) |
feeTokenrequired | string | Token address used to pay the fee |
tokenAddressesrequired | string[] | Token addresses involved in the operation |
externalActionIdrequired | string | External action id string (e.g. "Transact", "Okx", "Lifi") |
amounts | string[] | (Solana only) Transaction amounts used to calculate nullifier count for accurate fee estimation. Provide the amounts that will be used in the subsequent transaction. |
mintFrom | string | (Solana swap only) Input token mint address for OKX ATA cost estimation. |
ref | string | Referral code, checked the same way as by the route it quotes. With Transact, a ref that
carries a custom Hinkal fee returns that rate in hinkalVariableRateBps. The same rate applies
on /withdraw, /transfer, /private-send and /private-send-bridge. Custom fees don't apply
to swaps, so with Okx or Lifi only whitelisted referral codes are accepted, as in
POST /swap. Any other ref is rejected with 400. |
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
200Fee amount
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
feeAmountrequired | string | Flat fee covering network and relaying costs, in the fee token's smallest unit. |
hinkalVariableRateBpsrequired | integer | Hinkal fee in bps. The default is 10. For Transact, a custom rate from ref takes
precedence over one stored for the Hinkal Partner API key in x-api-key. The total
variable fee charged is hinkalVariableRateBps + partnerFeeBps (0 when absent). |
partnerFeeBps | integer | Hinkal Partner fee in bps added on top of the Hinkal fee. Present only when the
request carries a valid Hinkal Partner API key in x-api-key. |
breakdown | one of | How feeAmount was derived, in the chain's own fee terms. All currency amounts are integer
strings in the native coin's smallest unit: wei (EVM, 18 decimals), lamports (Solana, 9),
sun (Tron, 6). networkFee is the sum of the chain's components.
feeAmount = networkFee / 10^nativeDecimals × priceRatio × 10^feeTokenDecimals, rounded
down, where priceRatio = nativeTokenPriceUSD / feeTokenPriceUSD. Recomputing it can differ
from feeAmount by 1 smallest unit due to floating-point rounding. |
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 |