Skip to main content

GET /quote

Calculate the optimal swap route and expected output amount for a token pair.

Base URL: https://swap.charisma.rocks/api/v1/quote

This endpoint performs on-the-fly path-finding across every vault currently loaded in the Charisma routing graph. It does not broadcast a transaction or reserve liquidity – it's purely informational and may be called client-side.

Query parameters

NameTypeRequiredDescription
tokenInstringContract ID (or .stx) of the input token.
tokenOutstringContract ID of the desired output token.
amountinteger (micro-units)Amount of tokenIn in the token's smallest unit (e.g. micro-STX).

Example request

curl "https://swap.charisma.rocks/api/v1/quote?tokenIn=.stx&tokenOut=SP2ZNGJ85ENDY6QRHQ5P2D4FXKGZWCKTB2T0Z55KS.charisma-token&amount=1000000"

Successful response

{
"success": true,
"data": {
"amountIn": 1000000,
"amountOut": 238941,
"expectedPrice": 0.238941,
"minimumReceived": 237746,
"route": {
"hops": [
{
"vault": "SP2ZNGJ85ENDY6QRHQ5P2D4FXKGZWCKTB2T0Z55KS.stx-wbtc-vault",
"opcode": 0
}
]
}
}
}
FieldDescription
amountInAmount that was quoted (micro-units).
amountOutEstimated output in micro-units of tokenOut.
expectedPriceEffective price (tokenOut per tokenIn).
minimumReceivedOutput after applying the default 1 % slippage buffer.
routeHop sequence that would be executed on-chain.

Error responses

HTTPBodyReason
400{ "success": false, "error": "Missing tokenIn parameter" }Required param absent
400{ "success": false, "error": "Invalid amount parameter." }amount not a positive integer
500{ "success": false, "error": "Failed to get quote" }Internal failure while generating route

Rate limits

Unauthenticated clients are limited to 30 requests / 10 s per IP address.