API endpoints

Authentication and Rate Limits

The REST API currently operates without authentication requirements, making it easy to get started. However, rate limits are enforced to ensure fair usage and system stability. For high-volume applications requiring higher limits, contact the Madhouse team to discuss dedicated API access.

Supported Networks

Madhouse currently supports the following blockchain networks:

Monad Testnet

Parameter
Val

Chain ID

10143

API Parameter

chain=10143

Status

Active

This Chain ID (10143) is used throughout all code examples in this documentation. When Monad Mainnet and additional chains go live, their respective chain IDs will be documented here. Always use the appropriate chain ID for your target environment.

Future Network Support

Additional blockchain networks will be added as they become available. Mainnet values and multi-chain support are planned for future releases. Subscribe to Madhouse announcements for updates on new network integrations.

Quick Start

curl -X 'GET' \
  'https://api.madhouse.ag/swap/v1/protocols?chain=10143' \
  -H 'accept: application/json'

API endpoints

The following endpoints are currently available and operational:

GET /swap/v1/quote

Returns the optimal swap route along with encoded transaction data ready for blockchain submission. This is the primary endpoint for executing swaps.

GET /swap/v1/tokens

Retrieves a comprehensive list of all tokens supported on a specific chain, including token addresses, symbols, decimals, and verification status.

GET /swap/v1/protocols

Returns all DEX protocols and liquidity sources integrated with Madhouse on a given chain, allowing you to filter routes by preferred protocols.

GET Quote

This endpoint calculates the optimal route for a token swap and returns pre-built transaction calldata that can be submitted directly to the Monad blockchain. The routing algorithm analyzes all available liquidity sources and may split the order across multiple pools to achieve better execution.

Endpoint: GET /swap/v1/quote

The following parameters control the swap quote request:

Parameter
Type
Required
Description
Example

chain

string

Yes

Chain ID

10143

tokenIn

string

Yes

Address of the input token

0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701 (WMON)

tokenOut

string

Yes

Address of the output token

0xf817257fed379853cDe0fa4F97AB987181B1E5Ea (USDC)

amountIn

string

Yes

Amount of input token to swap

1000000000000000000 (1 WMON)

slippage

number

Yes

Maximum acceptable slippage

0.002 (0.2%)

protocols

string

No

Comma-separated list of protocols that will be used for routing (default: all protocols)

uniswap-v2,uniswap-v3

includeTokenInfo

boolean

No

Include detailed token information (default: false)

true

includePoolInfo

boolean

No

Include pool information (default: false)

true

integratorAddress

string

No

Address for fee attribution and tracking. Required if integratorFee > 0

0x203AfE76e5de5fa0Ee542fc7B7B713e1c5425701

integratorFee

string

No

Applicable fee as a percentage in 1e18 scale. Fee is deducted amountIn

5e15 = 0.5%

Example Request:

Example Response:

Important Notes

  • Fee-aware routing: When integratorFee is specified, the API automatically encodes calldata using the fee-aware swap entrypoint, ensuring the fee is properly collected.

  • Slippage protection: The slippage parameter directly controls the tokenToMinAmount field in the transaction calldata, protecting against unfavorable price movements.

  • Wei denomination: Always express amountIn in the token's smallest unit. Use amount * (10 ** decimals) to convert from human-readable amounts.

  • Protocol filtering: Use the protocols parameter to restrict routing to trusted DEXes or to avoid protocols with high gas costs for small trades.

GET Tokens

Returns a comprehensive list of all ERC-20 tokens supported by Madhouse on the specified blockchain. This endpoint is useful for populating token selection dropdowns in user interfaces and validating that a token pair can be traded before requesting a quote.

Endpoint: GET /swap/v1/tokens

Query Parameters:

Parameter
Type
Required
Description
Example

chain

string

Yes

Chain ID

10143 (Monad Testnet)

Example Request:

Example Response:

GET Protocols

Returns a list of all DEX protocols and liquidity sources that Madhouse has integrated on the specified blockchain. This endpoint is useful for understanding which protocols are available for routing, filtering routes to specific DEXes, or displaying protocol information in your user interface.

Endpoint: GET /swap/v1/protocols

Query Parameters:

Parameter
Type
Required
Description
Example

chain

string

Yes

Chain ID

10143 (Monad Testnet)

Example Request:

Example Response:

Use Cases

  • Protocol filtering: Use the protocol IDs to restrict routing to specific DEXes via the protocols parameter in the quote endpoint

  • UI display: Show users which protocols their swap will route through

  • Analytics: Track which protocols provide the best prices for specific token pairs

  • Trust preferences: Allow users to select only protocols they trust or have audited

Example - Filtering by Protocol

This ensures the routing algorithm only considers Uniswap V2 and V3 pools when finding the optimal path, which can be useful for users who prefer established protocols or when you want to avoid certain DEXes.

Supported Protocols

The API supports the following DEX protocols:

Protocol
Type
Monad

Uniswap (v2)

Dex

βœ…

Uniswap (v3)

Dex

βœ…

PancakeSwap (v2)

Dex

βœ…

PancakeSwap (v3)

Dex

βœ…

Balancer

Dex

βœ…

Atlantis (v2)

Dex

βœ…

Atlantis (v4)

Dex

βœ…

OctoSwap (v1)

Dex

βœ…

OctoSwap (v2)

Dex

βœ…

GlacierFi

Dex

βœ…

Purps

Dex

βœ…

LFJ

Dex

βœ…

Clober

Dex

βœ…

Izumi

Dex

βœ…

zkSwap v2

CLOB

βœ…

Crystal

CLOB

βœ…

Kuru

Staking

βœ…

aPriori

Staking

βœ…

Kintsu

Staking

βœ…

Magma

Staking

βœ…

FastLane

Staking

βœ…

Last updated