> For the complete documentation index, see [llms.txt](https://hinkal-team.gitbook.io/hinkal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hinkal-team.gitbook.io/hinkal/hinkal-api/api-reference/get-fee.md).

# Get Fee

## Get the fee amount for an operation

> 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\
> &#x20; exact nullifier count (used to estimate ATA creation costs).\
> \- \`mintFrom\` — for Solana swap fee estimation, pass the input token address so the\
> &#x20; server can estimate the OKX Associated Token Account cost.<br>

```json
{"openapi":"3.0.3","info":{"title":"Hinkal API","version":"1.0.0"},"tags":[{"name":"Get Fee"}],"servers":[{"url":"https://api.hinkal.io","description":"Production"}],"paths":{"/get-fee":{"get":{"operationId":"getFee","summary":"Get the fee amount for an operation","description":"Returns the relay fee amount for the given operation. Withdraw, transfer, and swap all\ncompute this fee automatically, so calling this endpoint first is optional — use it to\nshow the fee to a user before they confirm, or to lock in an exact `feeAmount` by passing\nit into the transaction request.\n\nRead-only — requires an active session. Pass `sessionId` and `nonce` as query parameters\nand include `x-hinkal-request-signature: secp256k1_sign(SHA256(\"GET /get-fee\\n\" + queryString))`\nin the headers.\n\n**Solana-specific parameters:**\n- `amounts[]` — provide the transaction amounts so the server can calculate the\n  exact nullifier count (used to estimate ATA creation costs).\n- `mintFrom` — for Solana swap fee estimation, pass the input token address so the\n  server can estimate the OKX Associated Token Account cost.\n","tags":["Get Fee"],"parameters":[{"$ref":"#/components/parameters/XHinkalRequestSignature"},{"name":"sessionId","in":"query","required":true,"description":"Session identifier UUID from POST /create-session","schema":{"type":"string","format":"uuid"}},{"name":"nonce","in":"query","required":true,"description":"Per-request UUID. Echoed back in the response.","schema":{"type":"string","format":"uuid"}},{"name":"chainId","in":"query","required":true,"description":"Chain ID (e.g. 10 for Optimism, 501 for Solana mainnet)","schema":{"type":"string"}},{"name":"feeToken","in":"query","required":true,"description":"Token address used to pay the fee","schema":{"type":"string"}},{"name":"tokenAddresses","in":"query","required":true,"description":"Token addresses involved in the operation","schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true},{"name":"externalActionId","in":"query","required":true,"description":"External action id string (e.g. \"Transact\", \"Okx\", \"Lifi\")","schema":{"type":"string"}},{"name":"amounts","in":"query","required":false,"description":"(Solana only) Transaction amounts used to calculate nullifier count for accurate\nfee estimation. Provide the amounts that will be used in the subsequent transaction.\n","schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true},{"name":"mintFrom","in":"query","required":false,"description":"(Solana swap only) Input token mint address for OKX ATA cost estimation.","schema":{"type":"string"}}],"responses":{"200":{"description":"Fee amount","headers":{},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"feeAmount":{"type":"string"},"nonce":{"type":"string","description":"Echoed per-request `nonce` from the request."}},"required":["success","feeAmount","nonce"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"parameters":{"XHinkalRequestSignature":{"name":"x-hinkal-request-signature","in":"header","required":true,"schema":{"type":"string"},"description":"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 /refresh-cache\"` 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](/enclave-api/authentication) for the full signing scheme."}},"responses":{"BadRequest":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailedResponse"}}}},"Unauthorized":{"description":"Invalid signature or reused nonce","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailedResponse"}}}},"ServerError":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailedResponse"}}}}},"schemas":{"FailedResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string"}},"required":["success","error"]}}}}
```
