Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.dzap.io/llms.txt

Use this file to discover all available pages before exploring further.

All API errors share one shape:
{
  "status": "error",
  "code": "ERROR_CODE",
  "message": "Human-readable explanation",
  "details": { ... }
}

Top-level codes

CodeHTTPWhat it meansRecovery
BAD_REQUEST400Validation failed (missing/invalid field)Check details for field-level errors
UNAUTHORIZED401API key missing or invalidRe-issue key; check header format
FORBIDDEN403Endpoint blocked for this keyCheck route permissions
NOT_FOUND404Resource (chain, token, txId) doesn’t existVerify inputs
RATE_LIMITED429Per-IP or per-key cap hitBackoff; honor retryAfter
INTERNAL_SERVER_ERROR500Routing/upstream failureRetry; if persistent, contact support
BAD_GATEWAY502Upstream protocol unavailableRetry; route may be temporarily un-quotable

Routing-specific codes

CodeMeaning
NO_ROUTE_FOUNDNo DEX/bridge can route this pair at this size
INSUFFICIENT_LIQUIDITYRoute exists but liquidity is too thin
SLIPPAGE_TOO_TIGHTEstimated output below minReturn; loosen slippage
AMOUNT_TOO_SMALLBelow provider minimum (often $1 equivalent)
AMOUNT_TOO_LARGEAbove provider maximum (route-specific)
UNSUPPORTED_TOKENToken not in any supported pool
UNSUPPORTED_CHAINChain not in supported set
UNSUPPORTED_PAIRTokens supported individually but not as a pair

Contract-revert errors

When the on-chain transaction reverts, DZap surfaces a structured ContractErrorResponse:
{
  "status": "error",
  "code": "CONTRACT_REVERT",
  "message": "Slippage exceeded",
  "details": {
    "action": "swap",
    "provider": "paraswap",
    "reason": "minOut not met",
    "txHash": "0x..."
  }
}
details.action is the failing leg of a multi-step bundle. Useful for surfacing UI hints (e.g. “swap leg 2 reverted”).

Programmatic handling

try {
  const quotes = await dzap.getTradeQuotes({ ... });
} catch (e: any) {
  if (e.code === 'NO_ROUTE_FOUND') {
    // suggest different tokens/amounts
  } else if (e.code === 'RATE_LIMITED') {
    await sleep(e.retryAfter * 1000);
    return retry();
  } else {
    throw e;
  }
}
The SDK normalizes errors to { code, message, details } regardless of upstream source.