Errors

Understand API errors and fix common integration issues.

Error format

Errors return a JSON object with an error field.

{
  "error": "Missing required parameters: tokenIn, tokenOut, amount"
}

HTTP status codes

400 invalid parameters

This means the request is malformed.

Common causes:

  • missing required fields

  • invalid address format

  • non-integer amount

Fixes:

  • pass every required parameter

  • use checksum-safe or valid hex addresses

  • send raw token amounts as integer strings

404 no route found

This means Dirol could not find executable liquidity for the pair and amount.

Fixes:

  • try a smaller amount

  • verify both token addresses

  • remove aggressive excludeSources filters

502 upstream or calldata failure

This means quoting or calldata generation failed upstream.

Fixes:

  • retry the request

  • refresh token metadata

  • request a fresh /swap before execution

504 timeout

This means the quote request took too long.

Fixes:

  • retry with the same parameters

  • reduce request frequency bursts

  • try again without exclusions

Common mistakes

Using human-readable amounts

amount must use raw units.

Example:

  • 1 WMON = 1000000000000000000

  • 1 USDC = 1000000

Calling /quote and expecting calldata

/quote only returns routing data.

Use /swap when you need tx.to, tx.data, and tx.value.

Forgetting recipient on /swap

recipient is required on /swap.

Use a valid Monad address.

Forgetting token approval

ERC-20 input tokens must be approved before sending the swap transaction.

Approve the aggregator address from tx.to.

Handling native MON like an ERC-20

For native MON, request the route with WMON as tokenIn.

Then send the transaction with value = amountIn.

Debug checklist

  • confirm the chain is Monad Mainnet with ID 143

  • confirm tokenIn, tokenOut, and recipient are valid addresses

  • confirm amount matches the token decimals

  • confirm approvals are in place for ERC-20 swaps

  • confirm excluded sources still leave a valid route

Last updated