Guide for bots and agents
Five calls take a program from "which token?" to a transaction it signs itself. The swap calls are free; token search, facts and prices are pay-per-call over x402. Nothing is custodial and nothing here is a recommendation.
| Step | Endpoint | Per call |
|---|---|---|
| Find a token by name, symbol or address | solana-token-search | $0.003 |
| Read its on-chain facts (authorities, supply, top holders) | solana-token-facts | $0.01 |
| Current USD price for up to 50 mints | solana-token-price | $0.003 |
| Quote a swap (route, impact, fee) | GET /api/swap/quote | free |
| Get an unsigned transaction for your wallet | POST /api/swap/build | free |
How it fits together
- Search returns mint addresses with decimals and a verified flag. Use the mint address, not the symbol: many tokens share names.
- Facts tell you whether the issuer can still mint or freeze, how concentrated holdings are and how liquid the token is. They are numbers, not a verdict; your program decides what to do with them.
- A quote shows the expected output, the minimum after slippage, price impact, route and the fee, which is already included.
- The transaction call returns a base64 versioned transaction that is not signed. Your program checks it, signs it with its own key and submits it with
sendTransactionto any Solana RPC node, or posts it tohttps://ambolt.dev/api/swap/executewith therequestId.
Paying from code
Each call returns 402 with the price. An x402 client pays in USDC (Base or Solana) and retries. Example with the official client (illustrative; keep the key in an environment variable and use a wallet with a small balance):
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
const pay = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(privateKeyToAccount(process.env.PAYER_KEY)) }],
});
const API = "https://api.ambolt.dev/v1";
const found = await (await pay(`${API}/solana-token-search?query=bonk&limit=3`)).json();
const mint = found.tokens[0].mint;
const facts = await (await pay(`${API}/solana-token-facts?mint=${mint}`)).json();
// decide with your own rules, then:
const q = new URLSearchParams({ inputMint: "So11111111111111111111111111111111111111112", outputMint: mint,
amount: "10000000", taker: process.env.SOLANA_PUBKEY });
const swap = await (await pay(`${API}/solana-swap-transaction?${q}`)).json();
// swap.transaction is unsigned: deserialize, sign with your Solana key, send with your own RPC.
Good to know
- One flat fee is included in every quote.
- Calls that fail are not charged. The API is rate limited per IP; if you need more, spread calls or ask via the Apify Actor page.
- Prices, tokens and facts change every block. Quotes expire within seconds.
- Tokens can be worthless or malicious. Nothing here is investment advice.