For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integrating Your Key

Add your key to Hinkal API calls, choose the right key for where your code runs, and check that calls are credited to you.

Add one header to the Hinkal API calls you already make:

x-api-key: hk_sk_live_…

The key goes on top of your normal authentication and doesn't replace any of it:

  • Normal-mode sessions: keep sending the session fields and x-hinkal-request-signature.

  • EIP-712 sessions: keep putting the per-transaction signature in the body. Don't add x-hinkal-request-signature to transaction calls on an EIP-712 session, because the API rejects that with 403. GET /get-fee uses the request signature in both modes.

x-api-key isn't part of the signed payload, so adding it doesn't change how you sign. See Authentication.

The API checks the session and signature first and the key second. A request with a bad signature fails as usual, whatever key it carries.


Routes that read the key

Method
Route
What you get

POST

/withdraw, /transfer, /swap, /private-send, /private-send-bridge

Volume and commission

POST

/deposit, /deposit-for-other, /deposit-solana-for-other, /proofless-deposit

Volume only

POST

/receive-vault-recover

Volume only

GET

/get-fee

Your current fee in the response. No transaction is recorded.

Every other route ignores the key, including /create-session, /balance, /get-swap-data, /receive-address, /withdraw-stuck-utxos and /recover-stuck-bridge-balance. /withdraw-stuck-utxos and /recover-stuck-bridge-balance move funds but are never credited to you.

Deposits that arrive at a receive address aren't credited to you either, because /receive-address doesn't read the key.


Choose the key for where your code runs

Your backend holds the wallet, opens the session and signs every request. Send the secret key from the server. This uses the helpers from Examples:

The same header goes on /transfer, /swap, /private-send (Private Send) and the deposit routes.

Users connect their own wallet in your web app, and the browser opens the session and signs each request. Send the publishable key, and add every origin your app is served from to the key's list. See Allowed origins.

The API accepts cross-origin requests, so x-api-key and x-hinkal-request-signature pass the browser's preflight check. The helpers in Examples use Node's crypto and Buffer, so replace those with browser equivalents first, for example @noble/hashes for SHA-256 and crypto.getRandomValues for random bytes.

Never put the secret key in browser code.

Native apps send no Origin header, so a publishable key always returns 403 from them, and a secret key must never ship inside an app. Send the app's calls through a small proxy on your backend that adds the secret key.

Because x-api-key isn't part of the signature, the proxy can add it without breaking the request. Forward the body byte for byte: the API checks the signature against the raw body, so parsing and re-serializing the JSON can break it. The app still signs the Hinkal route, such as /withdraw, not your proxy's path, because the API binds the signature to its own route. In Express, mount the proxy route before any JSON body parser.

For GET routes such as /get-fee, forward the query string unchanged for the same reason. Rate-limit the proxy: everything sent through it is credited to you.


Check that the key works

Call GET /get-fee with your key. The full call is on Go Live. With a valid key the response includes partnerFeeBps. Without a key, or with a value that doesn't start with hk_, it doesn't.

  • feeAmount is the flat network and relayer fee, in the fee token's smallest unit.

  • hinkalVariableRateBps is the Hinkal fee. It's 10 unless Hinkal set a custom rate for you.

  • partnerFeeBps is your fee as the API sees it right now. It's 0 until you set a fee.

  • breakdown shows how feeAmount was calculated, using each chain's own fee fields. See GET /get-fee in the API reference.

  • nonce echoes the nonce from your request.

Your first keyed call also completes step 2 of the Go-live card.


Common mistakes

  • Sending your company name as ref. The key handles attribution. A body ref that isn't on Hinkal's legacy list fails with 400 Invalid ref: '…' is not a whitelisted referral.

  • Routing traffic through the SDK, WaaS or MCP. None of them send or read the key.

  • Running with a fee of 0. Calls are still credited to you, but they earn nothing. Each transaction is recorded with the fee in force when it ran, and later fee changes don't apply to it.


Credited transactions show up on the Transactions page once they confirm on-chain. If a call with your key fails, see Errors and Limits.

Last updated