Skip to main content
GET
/
swap
/
v1
/
{chainId}
/
swap
Generate swap transaction data
curl --request GET \
  --url https://api.akka.finance/swap/v1/{chainId}/swap \
  --header 'apikey: <api-key>'
{
  "dstAmount": "12723902882990271",
  "tx": {
    "from": "0xD3C0F471488523b378F2D9C21939c97300c510F5",
    "to": "0xcce7452db4392b40aa0e1592a7c486e13bf69654",
    "data": "0x...",
    "value": "1000000000000000000",
    "gasPrice": "1000000000",
    "gas": "231973"
  },
  "encodedTx": "0x..."
}

Documentation Index

Fetch the complete documentation index at: https://docs.akka.finance/llms.txt

Use this file to discover all available pages before exploring further.

This endpoint always performs an exact quote (full graph walk) regardless of the chain’s default quote policy. The returned dstAmount is the precise expected output.

Using the response

The response includes a tx object that is ready to sign and broadcast:
const { tx } = swapResponse;

const hash = await walletClient.sendTransaction({
  to: tx.to,
  data: tx.data,
  value: BigInt(tx.value),
  gasPrice: BigInt(tx.gasPrice),
  gas: BigInt(tx.gas),
});

Slippage recommendations

Swap typeRecommended slippage
Stable-to-stable0.1 — 0.5%
Major tokens0.5 — 1%
Low-liquidity tokens1 — 5%

Balance and allowance validation

When from is provided, the API validates:
  • Balance: The wallet has enough tokens to cover the swap amount
  • Allowance: The AKKA Router is approved to spend enough tokens
If either check fails, the API returns a 400 error with a descriptive message.

Authorizations

apikey
string
header
required

API key for authentication. Contact AKKA on Telegram to obtain your key.

Path Parameters

chainId
enum<integer>
required

Blockchain chain ID

Available options:
999
Example:

999

Query Parameters

src
string
required

Source token contract address. Use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee for the native token.

Pattern: ^0x[a-fA-F0-9]{40}$
Example:

"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"

dst
string
required

Destination token contract address.

Pattern: ^0x[a-fA-F0-9]{40}$
Example:

"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb"

amount
string
required

Amount to swap in the smallest unit (wei).

Example:

"1000000000000000000"

from
string

Wallet address executing the swap. When provided, the API validates that the wallet has sufficient token balance and allowance.

Pattern: ^0x[a-fA-F0-9]{40}$
Example:

"0xD3C0F471488523b378F2D9C21939c97300c510F5"

slippage
number
required

Maximum acceptable slippage as a percentage. Range: 0 to 50. Recommended: 0.5 to 3 for most swaps.

Required range: 0 <= x <= 50
Example:

1

gasPrice
string

Custom gas price in wei. If omitted, the current network gas price is used.

Example:

"1000000000"

gasLimit
integer

Custom gas limit. If omitted, the API estimates gas with a 20% safety buffer.

Example:

500000

includeTokensInfo
boolean
default:false

Include srcToken and dstToken metadata in the response.

includeGas
boolean
default:false

Include estimated gas amount in the response.

Response

Swap transaction data generated successfully

dstAmount
string
required

Expected output amount in the smallest unit (wei)

Example:

"12723902882990271"

tx
object
required

Ready-to-sign transaction object. Send this directly to the blockchain.

encodedTx
string
required

ABI-encoded transaction tuple (from, to, data, value, gasPrice, gas) as a hex string. Allows decoding and executing the swap without needing the contract ABI.

Example:

"0x..."

srcToken
object

Source token information (when includeTokensInfo=true)

dstToken
object

Destination token information (when includeTokensInfo=true)

gas
string

Estimated gas amount (when includeGas=true)

Example:

"231973"