> ## 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.

# Quickstart

> Go from zero to your first token swap in 5 steps

This guide walks you through a complete token swap on HyperEVM (chain ID `999`) — from checking allowance to executing the swap.

## Prerequisites

* An API key ([get one on Telegram](https://t.me/akka_finance))
* A wallet with tokens on HyperEVM
* Tokens to swap (this example swaps HYPE for UBTC)

<Steps>
  <Step title="Check allowance">
    Before swapping an ERC-20 token, check if the AKKA Router is allowed to spend it. For native token swaps (HYPE), skip to step 3.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -H "apikey: YOUR_API_KEY" \
        "https://api.akka.finance/swap/v1/999/approve/allowance?tokenAddress=0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb&walletAddress=YOUR_WALLET_ADDRESS"
      ```

      ```javascript JavaScript (viem) theme={null}
      const response = await fetch(
        'https://api.akka.finance/swap/v1/999/approve/allowance?' +
        new URLSearchParams({
          tokenAddress: '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb',
          walletAddress: 'YOUR_WALLET_ADDRESS',
        }),
        { headers: { apikey: 'YOUR_API_KEY' } }
      );

      const { allowance } = await response.json();
      console.log('Current allowance:', allowance);
      ```
    </CodeGroup>

    Response:

    ```json theme={null}
    { "allowance": "0" }
    ```

    If `allowance` is `0` or less than your swap amount, proceed to step 2. Otherwise, skip to step 3.
  </Step>

  <Step title="Approve token spending">
    Generate and submit an approval transaction so the AKKA Router can spend your tokens.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -H "apikey: YOUR_API_KEY" \
        "https://api.akka.finance/swap/v1/999/approve/transaction?tokenAddress=0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb"
      ```

      ```javascript JavaScript (viem) theme={null}
      const response = await fetch(
        'https://api.akka.finance/swap/v1/999/approve/transaction?' +
        new URLSearchParams({
          tokenAddress: '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb',
        }),
        { headers: { apikey: 'YOUR_API_KEY' } }
      );

      const approveTx = await response.json();
      // approveTx = { data, gasPrice, to, value }

      // Sign and send the approval transaction with your wallet
      const hash = await walletClient.sendTransaction({
        to: approveTx.to,
        data: approveTx.data,
        value: BigInt(approveTx.value),
      });

      // Wait for confirmation
      await publicClient.waitForTransactionReceipt({ hash });
      ```
    </CodeGroup>

    Response:

    ```json theme={null}
    {
      "data": "0x095ea7b3...",
      "gasPrice": "100000000",
      "to": "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb",
      "value": "0"
    }
    ```

    <Warning>
      Submit this transaction to the blockchain and wait for it to be confirmed before proceeding.
    </Warning>
  </Step>

  <Step title="Get a quote">
    Check the expected output amount before executing the swap.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -H "apikey: YOUR_API_KEY" \
        "https://api.akka.finance/swap/v1/999/quote?src=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&dst=0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb&amount=1000000000000000000&includeTokensInfo=true"
      ```

      ```javascript JavaScript (viem) theme={null}
      const response = await fetch(
        'https://api.akka.finance/swap/v1/999/quote?' +
        new URLSearchParams({
          src: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
          dst: '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb',
          amount: '1000000000000000000', // 1 HYPE
          includeTokensInfo: 'true',
        }),
        { headers: { apikey: 'YOUR_API_KEY' } }
      );

      const quote = await response.json();
      console.log('Expected output:', quote.dstAmount);
      ```
    </CodeGroup>

    Response:

    ```json theme={null}
    {
      "dstAmount": "205340622987446484992",
      "srcToken": {
        "address": "0x5555555555555555555555555555555555555555",
        "symbol": "WHYPE",
        "name": "Wrapped HYPE",
        "decimals": 18,
        "logoUri": null
      },
      "dstToken": {
        "address": "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb",
        "symbol": "UBTC",
        "name": "Universal BTC",
        "decimals": 18,
        "logoUri": null
      }
    }
    ```
  </Step>

  <Step title="Execute the swap">
    Generate the swap transaction data and submit it to the blockchain.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -H "apikey: YOUR_API_KEY" \
        "https://api.akka.finance/swap/v1/999/swap?src=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&dst=0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb&amount=1000000000000000000&from=YOUR_WALLET_ADDRESS&slippage=1"
      ```

      ```javascript JavaScript (viem) theme={null}
      const response = await fetch(
        'https://api.akka.finance/swap/v1/999/swap?' +
        new URLSearchParams({
          src: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
          dst: '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb',
          amount: '1000000000000000000', // 1 HYPE
          from: 'YOUR_WALLET_ADDRESS',
          slippage: '1', // 1% slippage tolerance
        }),
        { headers: { apikey: 'YOUR_API_KEY' } }
      );

      const swap = await response.json();
      console.log('Expected output:', swap.dstAmount);
      ```
    </CodeGroup>

    Response:

    ```json theme={null}
    {
      "dstAmount": "12723902882990271",
      "tx": {
        "from": "0xYOUR_WALLET_ADDRESS",
        "to": "0xcce7452db4392b40aa0e1592a7c486e13bf69654",
        "data": "0x...",
        "value": "1000000000000000000",
        "gasPrice": "1000000000",
        "gas": "231973"
      },
      "encodedTx": "0x..."
    }
    ```
  </Step>

  <Step title="Sign and broadcast">
    Submit the transaction object from step 4 to the blockchain.

    ```javascript JavaScript (viem) theme={null}
    const { tx } = swap;

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

    const receipt = await publicClient.waitForTransactionReceipt({ hash });
    console.log('Swap confirmed:', receipt.transactionHash);
    ```

    <Tip>
      The `tx` object is ready to use directly — no ABI encoding required. Just pass it to your wallet's `sendTransaction` method.
    </Tip>
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Full Working Example" icon="code" href="/guides/first-swap">
    Complete TypeScript implementation you can copy and run.
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/get-quote">
    Explore all endpoints with the interactive playground.
  </Card>
</CardGroup>
