Skip to content

Bot API

Read token facts and get a quote with no sign-in and no wallet: a key is only needed to build a swap.

7
open endpoints
3
keyed endpoints
3
routers
0
sign-in to read

Try it

Token facts
curl "https://trnch.fun/elysium/api/bot/v1/check?token=0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0"

Endpoints

MethodEndpointWhat it doesAccess
GET/api/bot/v1/check?token=Facts read on chain for a tokenNo key
GET/api/bot/v1/scan?wallet=Tokens a wallet holds, facts for the largestNo key
GET/api/bot/v1/top?limit=Top tokens by 24h pool volumeNo key
GET/api/bot/v1/statsChain, routers, fees, activityNo key
POST/api/bot/v1/quoteQuote across three routersNo key
GET/api/bot/v1/register?wallet=Message to sign for a keyNo key
POST/api/bot/v1/registerCreate a key from the signatureNo key
POST/api/bot/v1/buyBuild a buy transactionKey
POST/api/bot/v1/sellBuild a sell transactionKey
POST/api/bot/v1/buildBuild a swap from a chosen routeKey

GET /check

No key. Facts read on chain, never a verdict. sellTest: bought, transferred and sold in a simulation at the time of the read, through the pool in poolTested, at checkedAt: sold, taxed, blocked or not-checked, and the measured loss. A simulation now; a token can behave differently later or towards other wallets. hookFee: the launch hook rate in basis points, when the pool has one. liquidity: whether a pool was found and its estimate in dollars. creator.launches: tokens the same creator launched before this one. sellTest.sizes: the sell test at two sizes. launchpad, template, forcedTransfer: the launch hook (named only when proven), the token template, and whether the owner or creator could move the tokens of a buyer without approval in a simulation; a fact not read says not checked. screened is always false. 20 calls per minute per IP.

curl "https://trnch.fun/elysium/api/bot/v1/check?token=0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0"

# Response: { token, chainId, screened: false, sellTest, hookFee, liquidity, creator, meaning }
# sellTest: { class: sold | taxed | blocked | not-checked, lossPct, method }, poolTested, checkedAt

POST /quote

No key. The best route for a swap across Uniswap, KyberSwap and LI.FI: input and output token, amountIn in the smallest unit of the input token, slippage as a fraction (0.01 is 1%). HYPE is the zero address. Decimals default to 18: set them for USDC (6). The answer lists each route with its output amount, net of the Trnch fee.

curl -X POST "https://trnch.fun/elysium/api/bot/v1/quote" \
  -H "Content-Type: application/json" \
  -d '{
    "tokenIn": "0x0000000000000000000000000000000000000000",
    "tokenOut": "0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0",
    "amountIn": "1000000000000000000",
    "decimalsIn": 18,
    "decimalsOut": 18,
    "slippage": 0.01
  }'

# HYPE is the zero address. Response: { best, routes, feeBps, ... }

Get a key

GET /register?wallet=0x... returns a message; sign it with that wallet (personal_sign) and POST /register { wallet, message, signature }. The key is shown once. The wallet holds 10 USDC or 0.15 HYPE (402 otherwise), 3 keys at most per wallet. A key works for the wallet that created it: swaps built with it always pay that wallet.

curl "https://trnch.fun/elysium/api/bot/v1/register?wallet=0xYOUR_WALLET"
# sign the returned message with that wallet (personal_sign), then:
curl -X POST "https://trnch.fun/elysium/api/bot/v1/register" \
  -H "Content-Type: application/json" \
  -d '{ "wallet": "0xYOUR_WALLET", "message": "...", "signature": "0x..." }'
Authorization: Bearer trnch_bot_YOUR_KEY

POST /buy and POST /sell

Key required. One call to trade: every router is asked, the best route is kept and the transaction is built for the wallet of your key. /buy takes token and either amountUsd (paid in USDC) or amountIn with tokenIn. /sell takes token and either percent of the balance your wallet holds or amount in token units, and pays you in USDC. slippageBps is optional (default 100, from 10 to 5000). The answer is { router, quote, feeBps, approval, tx, chainId, from }.

buy example
curl -X POST "https://trnch.fun/elysium/api/bot/v1/buy" \
  -H "Authorization: Bearer trnch_bot_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "token": "0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0", "amountUsd": 5, "slippageBps": 100 }'

# Response: { router, quote, feeBps, approval, tx, chainId, from }
# Send approval first when it is not null, then tx, both signed by your wallet.
sell example
curl -X POST "https://trnch.fun/elysium/api/bot/v1/sell" \
  -H "Authorization: Bearer trnch_bot_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "token": "0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0", "percent": 100, "slippageBps": 100 }'

# Or an exact amount, in token units: { "token": "0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0", "amount": "1234.5" }

POST /build

Key required. The transaction of the router named by a quote, for the wallet of your key and nobody else. There is no receiver field: any extra field is refused. The route is quoted again and checked when you build, so sign it soon after.

curl -X POST "https://trnch.fun/elysium/api/bot/v1/build" \
  -H "Authorization: Bearer trnch_bot_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "router": "kyberswap",
    "tokenIn": "0xb47c4c8f73f009cc0c0d3f92b388d13e293f0b65",
    "tokenOut": "0xe45a355d9e9cad2ad85f2d03e3ee3102a036acf0",
    "amountIn": "5000000",
    "decimalsIn": 6,
    "decimalsOut": 18,
    "slippage": 0.01
  }'

# router: kyberswap | lifi | direct, as named by a quote

Limits and fee

  • 60 calls per minute per key, 30 of them quotes, builds, buys or sells. Above that you get 429 with a retry-after header. Open routes are limited per IP.
  • Trnch takes a fee on swaps built through the API. It is taken inside the route you sign and returned as feeBps: the amounts we return are net of it.
  • While the fee recipient of the chain is not configured, buy, sell and build answer 503 and build nothing. Quotes and facts keep working.
  • Errors are JSON: an error field and the matching HTTP status (400, 401, 402, 404, 429, 503).

Your bot signs

Trnch never signs for you, never holds your funds and never sees a private key. The API gives you facts and transactions; your bot signs them with its own key and sends them to the chain. Never share a wallet key or a seed phrase with anyone.