5 minute guide

Quick Start

Build your first compliant DeFi transaction in under 5 minutes.

1

Create an Account & Get Your API Key

Register at ilal.tech/login, then go to the API Keys dashboard and click Create API Key.

Your key will look like:
ilal_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Copy and save your key immediately — it will only be shown once.
2

Verify the API is Working

Check the health endpoint — no auth required:

curl
curl https://ilalapi-production.up.railway.app/api/v1/health
Expected response:
json
{
  "status": "ok",
  "service": "ILAL API",
  "database": "connected"
}
3

Build a Swap Transaction

Call POST /defi/swap with your API key. The API returns unsigned calldata — you sign and broadcast it with your own wallet.

curl
curl -X POST https://ilalapi-production.up.railway.app/api/v1/defi/swap \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tokenIn":  "0x4200000000000000000000000000000000000006",
    "tokenOut": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
    "amount":   "1000000000000000",
    "zeroForOne": true,
    "userAddress": "YOUR_WALLET_ADDRESS"
  }'
Response — ready to sign:
json
{
  "success": true,
  "transaction": {
    "to":      "0x2aaf6c55...",
    "data":    "0xf3cd914c...",
    "value":   "0x0",
    "chainId": 84532,
    "gas":     "0x1E8480"
  },
  "instructions": {
    "network": "Base Sepolia (chainId: 84532)",
    "rpcUrl":  "https://sepolia.base.org"
  }
}
4

Sign & Broadcast with Your Wallet

Take result.transaction and send it with your own signer — ethers.js, viem, or wagmi.

TypeScript (ethers.js)
import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://sepolia.base.org');
const signer = new ethers.Wallet(YOUR_PRIVATE_KEY, provider);

// 1. Build the tx via ILAL API
const res = await fetch('https://ilalapi-production.up.railway.app/api/v1/defi/swap', {
  method: 'POST',
  headers: {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    tokenIn:     '0x4200000000000000000000000000000000000006',
    tokenOut:    '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
    amount:      '1000000000000000',
    zeroForOne:  true,
    userAddress: await signer.getAddress(),
  }),
});
const { transaction } = await res.json();

// 2. Sign and broadcast — your key, your transaction
const tx = await signer.sendTransaction(transaction);
console.log('Tx hash:', tx.hash);
await tx.wait();
console.log('Swap confirmed ✓');
TypeScript (viem)
import { createWalletClient, createPublicClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { baseSepolia } from 'viem/chains';

const account = privateKeyToAccount(YOUR_PRIVATE_KEY);
const walletClient = createWalletClient({ account, chain: baseSepolia, transport: http() });

// 1. Build the tx
const res = await fetch('https://ilalapi-production.up.railway.app/api/v1/defi/swap', {
  method: 'POST',
  headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    tokenIn:     '0x4200000000000000000000000000000000000006',
    tokenOut:    '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
    amount:      '1000000000000000',
    zeroForOne:  true,
    userAddress: account.address,
  }),
});
const { transaction } = await res.json();

// 2. Send — your key, your transaction
const hash = await walletClient.sendTransaction({
  to:    transaction.to,
  data:  transaction.data,
  value: BigInt(transaction.value),
});
console.log('Tx hash:', hash);