POST /quote
This endpoint returns one or more quotes for a given asset route and amount. Each quote includes the expected output amount, estimated fill time, and transaction payloads ready to be signed and submitted to the blockchain.
TypeScript Types: Generate types for this API with a single command. See Type Generation.
API Reference: For detailed schema definitions and interactive testing, see the API Reference.
Request
Endpoint
POST /quoteHeaders
x-api-key: YOUR_API_KEY
Content-Type: application/jsonBody Parameters
Check the API reference for a detailed list of accepted parameters
Example Request
import type { components } from './m0-swap'; // From type generation
type Quote = components['schemas']['Quote'];
const response = await fetch('https://gateway.m0.xyz/v1/orchestration/quote', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': YOUR_API_KEY,
},
body: JSON.stringify({
route: {
source: {
chain: 'Ethereum',
address: '0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b', // M token
},
destination: {
chain: 'Base',
address: '0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b', // M token
},
},
amountIn: '1000000', // 1 M (6 decimals)
sender: '0xYourWalletAddress',
maxNumQuotes: 1,
}),
});
const quotes: Quote[] = await response.json();Example Response
[
{
"route": {
"source": {
"chain": "Ethereum",
"address": "0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b"
},
"destination": {
"chain": "Base",
"address": "0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b"
}
},
"recipient": "0xYourWalletAddress",
"amountIn": "1000000",
"amountOut": "999500",
"estFillTime": 180,
"payloads": [
{
"provider": "m-wormhole-portal",
"annotation": "Bridge M from Ethereum to Base",
"data": {
"type": "evm",
"chain": "Ethereum",
"chainId": 1,
"to": "0x1234567890abcdef...",
"data": "0xabcdef...",
"value": "0"
}
}
]
}
]Executing Quote Payloads
Once you have a quote, you can execute its payloads using your preferred chain interface.
Here is an example executing a payload on Base using Viem.
EVM Payload Execution
import type { components } from './m0-swap'; // From type generation
import { createPublicClient, http } from 'viem';
import { base } from 'viem/chains';
type EvmPayload = components['schemas']['EvmPayload'];
async function executeEvmPayload(payload: EvmPayload, account: ReturnType<typeof privateKeyToAccount>) {
const client = createPublicClient({
chain: base,
transport: http(),
});
// Send the transaction
const hash = await client.sendTransaction({
to: payload.to as `0x${string}`,
data: payload.data as `0x${string}`,
value: BigInt(payload.value),
});
// Wait for confirmation
const receipt = await client.waitForTransactionReceipt({
hash,
confirmations: 1,
});
return { hash, receipt };
}Filtering Providers
Use the optional providers field to control which liquidity providers are used when generating quotes. You can either
include only specific providers or exclude certain ones.
Available Providers
m-swap-facility · m-wormhole-portal · m-hyperlane-portal · m-portal · wormhole-cctp · limit-order
Include Only Specific Providers
const body = JSON.stringify({
route: {
/* ... */
},
amountIn: '1000000',
sender: '0xYourWalletAddress',
providers: {
include: ['m-wormhole-portal', 'm-swap-facility'],
},
});Exclude Specific Providers
const body = JSON.stringify({
route: {
/* ... */
},
amountIn: '1000000',
sender: '0xYourWalletAddress',
providers: {
exclude: ['wormhole-cctp'],
},
});Note: If both
includeandexcludeare provided,includetakes precedence — only the listed providers will be used, andexcludeis ignored.
Tracking Orders
For routes through the limit-order provider, you can track your
order on the M0 Explorer or programmatically via the
GET /order-status/{orderId} endpoint.
For all other providers, the transaction hash returned when submitting the payload on-chain can be used to track the transaction directly on the respective block explorer.
Notes
- The
amountInparameter should be provided in the token's smallest unit (e.g., for a 6-decimal token,1000000represents 1 token) - Payloads should be executed in order - wait for each transaction to confirm before sending the next
- Cross-chain quotes may include multiple payloads (e.g., approve + bridge)
- The
estFillTimeis an estimate in seconds for the entire route to complete

