> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mayan.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Quote API

We highly recommend using [Mayan SDK](https://github.com/mayan-finance/swap-sdk) for integration as it simplifies the integration process.

Before performing a swap we need find the best route and get the swap rate for the token pair using quote API.

### API Reference

<Card color="#83E72E" icon="circle-s" horizontal href="https://price-api.mayan.finance/swagger" title="Swagger UI" />

### Example:

The request to get the quote for swapping 100 USDC on Avalanche to receive SOL on Solana would be like this:

#### Request:

```powershell theme={null}
curl -X 'GET' 'https://price-api.mayan.finance/v3/quote?amountIn=100&fromToken=0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e&fromChain=avalanche&toToken=0x0000000000000000000000000000000000000000&toChain=solana&slippageBps=300&gasDrop=0&swift=true&mctp=true&fastMctp=true&wormhole=true&solanaProgram=FC4eXxkyrMPTjiYUpp4EAnkmwMbQyZ6NDCh1kfLn6vsf&forwarderAddress=0x337685fdaB40D39bd02028545a4FfA7D287cC3E2&sdkVersion=13_1_0'
```

#### List of request parameters:

| Parameter          | Type    | Required | Description                                                                                                                            |
| ------------------ | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| amountIn           | Number  | Yes\*    | Input amount in human-readable format (e.g. `100` for 100 USDC). Either `amountIn` or `amountIn64` must be provided.                   |
| amountIn64         | String  | Yes\*    | Input amount in base units (smallest denomination, e.g. `100000000` for 100 USDC). Either `amountIn` or `amountIn64` must be provided. |
| fromToken          | String  | Yes      | Token address on the source chain (use `0x0000000000000000000000000000000000000000` for native tokens)                                 |
| fromChain          | String  | Yes      | Source chain name (e.g. `solana`, `ethereum`, `bsc`, `avalanche`, `arbitrum`, `base`, `optimism`, `polygon`, `sui`)                    |
| toToken            | String  | Yes      | Token address on the destination chain                                                                                                 |
| toChain            | String  | Yes      | Destination chain name                                                                                                                 |
| slippageBps        | Number  | Yes\*    | Maximum slippage in basis points (e.g. `300` = 3%, max `500`). Either `slippageBps` or `slippage` must be provided.                    |
| slippage           | Number  | Yes\*    | Maximum slippage as a decimal (e.g. `0.03` = 3%). Either `slippageBps` or `slippage` must be provided.                                 |
| swift              | Boolean | No       | Enable [Swift](/architecture/swift) routes                                                                                             |
| mctp               | Boolean | No       | Enable [MCTP](/architecture/mctp) routes                                                                                               |
| fastMctp           | Boolean | No       | Enable Fast MCTP routes                                                                                                                |
| wormhole           | Boolean | No       | Enable [Wormhole Swap](/architecture/wh-swap) routes                                                                                   |
| gasless            | Boolean | No       | Enable gasless swap mode                                                                                                               |
| solanaProgram      | String  | No       | Mayan Solana program address                                                                                                           |
| forwarderAddress   | String  | No       | Mayan Forwarder contract address                                                                                                       |
| sdkVersion         | String  | No       | SDK version in `major_minor_patch` format (e.g. `13_1_0`)                                                                              |
| referrer           | String  | No       | Referrer Solana address that receives the referrer fee                                                                                 |
| referrerBps        | Number  | No       | Default is 0. The basis points the integrator earns through the referral program                                                       |
| gasDrop            | Number  | No       | Default is 0. Amount of native gas to deliver to the user on the destination chain                                                     |
| fullList           | Boolean | No       | Default is `false`. Enables returning all available quote options instead of the default limited (fastest and best-return) results     |
| destinationAddress | String  | No       | Helps provide a more accurate quote, for example by checking whether the Solana ATA exists.                                            |
| apiKey             | String  | No       | Defines an API key that prevents the **rate-limit-exceeded** error on a per-IP basis.                                                  |

#### Response:

> The quote service returns an array of quotes. By default, it includes at most two items: the first is the fastest option, and the second is the best-return quote. If the fastest option also provides the best return, only one quote is returned.
>
> It is possible to set the `fullList` request parameter to `true` to retrieve all available quote options. In this case, more than two items may be returned, and no sorting is applied. Interfaces can apply their own sorting logic by considering the `etaSeconds` and `expectedAmountOut` fields in each item.

```json theme={null}
{
  "quotes": [
    {
      "meta": {
        "advertisedDescription": "Cheapest and Fastest",
        "advertisedTitle": "Best",
        "icon": "https://cdn.mayan.finance/fast_icon.png",
        "switchText": "Switch to the best route",
        "title": "Best"
      },
      "sendTransactionCost": 0,
      "gasless": false,
      "slippageBps": 300,
      "effectiveAmountIn": 100,
      "effectiveAmountIn64": "100000000",
      "expectedAmountOut": 1.201839546,
      "price": 0.01201963167985677,
      "minAmountOut": 1.16578436,
      "minReceived": 1.16578436,
      "solanaRelayerFee": null,
      "solanaRelayerFee64": null,
      "redeemRelayerFee": null,
      "redeemRelayerFee64": null,
      "refundRelayerFee": null,
      "refundRelayerFee64": "711",
      "cancelRelayerFee64": "9147",
      "submitRelayerFee64": "0",
      "clientRelayerFeeSuccess": null,
      "clientRelayerFeeRefund": 0.00902389942474755,
      "deadline64": "1774621897",
      "fromToken": {
        "name": "USD Coin",
        "symbol": "USDC",
        "mint": "FHfba3ov5P3RjaiLVgh8FTv4oirxQDoVXuoUUDvHuXax",
        "contract": "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
        "chainId": 43114,
        "wChainId": 6,
        "decimals": 6,
        "logoURI": "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png?1547042389",
        "coingeckoId": "usd-coin",
        "realOriginContractAddress": "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
        "realOriginChainId": 6,
        "supportsPermit": true
      },
      "fromChain": "avalanche",
      "toToken": {
        "name": "SOL",
        "symbol": "SOL",
        "mint": "So11111111111111111111111111111111111111112",
        "contract": "0x0000000000000000000000000000000000000000",
        "chainId": 0,
        "wChainId": 1,
        "decimals": 9,
        "logoURI": "https://statics.mayan.finance/SOL.png",
        "wrappedAddress": "So11111111111111111111111111111111111111112",
        "coingeckoId": "solana",
        "realOriginContractAddress": "So11111111111111111111111111111111111111112",
        "realOriginChainId": 1,
        "supportsPermit": false
      },
      "toChain": "solana",
      "gasDrop": 0,
      "eta": 1,
      "etaSeconds": 3,
      "clientEta": "3s",
      "bridgeFee": 0,
      "suggestedPriorityFee": 0,
      "type": "SWIFT",
      "priceStat": {
        "ratio": 0.9996,
        "status": "GOOD"
      },
      "referrerBps": 0,
      "protocolBps": 3,
      "onlyBridging": false,
      "minMiddleAmount": 100,
      "sourceSwapExpense": 0,
      "swiftVersion": "V2",
      "swiftMayanContract": "0x40fFE85A28DC9993541449464d7529a922142960",
      "swiftAuctionMode": 2
    }
  ],
  "minimumSdkVersion": [
    7,
    0,
    0
  ]
}
```

### Response fields:

The following table shows the common fields of response:

| Field                   | Type   | Description                                                                                                                              |
| ----------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| type                    | String | Determines the bridge method which can be "WH", "SWIFT", "MCTP" or "FAST\_MCTP"                                                          |
| effectiveAmountIn       | Number | The actual input amount that will be deducted from user's wallet                                                                         |
| expectedAmountOut       | Number | Expected output amount that user receives                                                                                                |
| minAmountOut            | Number | Minimum output amount of auction                                                                                                         |
| minReceived             | Number | The minimum amount that user receives after deducting relayer fees                                                                       |
| price                   | Number | The amount of output token that user receives per 1 unit of input token                                                                  |
| solanaRelayerFee        | Number | For "WH" type this fee is denominated in input token. For "MCTP" type the fee is denominated in USDC. For "SWIFT" type the fee is zero.  |
| redeemRelayerFee        | Number | For "WH" type this fee is denominated in output token. For "MCTP" type the fee is denominated in USDC. For "SWIFT" type the fee is zero. |
| RefundRelayerFee        | Number | For "WH" and "SWIFT" types this fee is denominated in input token. For "MCTP" type the fee is denominated in USDC.                       |
| clientRelayerFeeSuccess | Number | Total dollar value of relayer fees in the success scenario                                                                               |
| clientRelayerFeeRefund  | Number | Total dollar value of relayer fee in the refund scenario                                                                                 |
| eta                     | Number | estimated time of arrival in minutes                                                                                                     |
| client eta              | String | human readable string of eta                                                                                                             |
| fromToken               | Object | Input token details                                                                                                                      |
| fromChain               | String | Source network name                                                                                                                      |
| toToken                 | Object | Output token details                                                                                                                     |
| toChain                 | String | Destination network name                                                                                                                 |

### **Supported Tokens**

Mayan is an intent-based protocol and supports any token as input or output, provided there is sufficient liquidity on the source or destination chains. We also maintain an approved, whitelisted token list for convenience:

<Card color="#83E72E" icon="circle-s" horizontal href="https://price-api.mayan.finance/swagger/#/default/TokensController_getTokens" title="Swagger UI" />

#### Example:

```powershell theme={null}
curl -X 'GET' \
  'https://price-api.mayan.finance/v3/tokens?chain=solana' \
  -H 'accept: application/json'
```

To get the aggregated list of tokens from all chains remove `chain` from in the query .

### Supported Chains

#### `GET` `sia.mayan.finance/v10/init`

Returns configuration for every supported chain, including whether it can be used as a origin or destination\*\* \*\*chain.

#### Example:

```powershell theme={null}
curl -X 'GET' \
  'https://sia.mayan.finance/v10/init' \
  -H 'accept: application/json'
```

This endpoint provides a JSON response containing a comprehensive list of all chains supported by the platform. Each chain entry includes detailed metadata such as the chain's name, chain ID, and other relevant attributes.

Two key fields indicate the chain's functionality within the platform:

* `originActive`: Specifies whether the chain is supported as a source chain.
* `destinationActive`: Specifies whether the chain is supported as a destination chain.

Use this endpoint to determine compatibility and availability of specific chains for your operations.

### API Key:

The `apiKey` parameter is optional. If you are using the Mayan SDK on a frontend and your request volume is low or comes from multiple origins, you can omit the `apiKey` to use the public endpoint. We recommend starting without an API key and only requesting one if you hit rate limits. To obtain an API key, email [**support@mayan.finance**](mailto:support@mayan.finance).
