> For the complete documentation index, see [llms.txt](https://docs.orda.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.orda.network/developers/api/onchain-transactions/requesting-a-quote.md).

# Requesting a Quote

```plaintext
POST https://api.orda.network/v1/quote
```

This guide explains how to request a quote using the orda API. A quote request lets you execute a crypto-to-crypto transaction across any of our supported tokens and chains.

#### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

Before you start, make sure you have:

1. A project client id a project secret and your HMAC signature.
2. The details of the transaction you want to quote

#### Authentication <a href="#authentication" id="authentication"></a>

All API requests to orda require HMAC signatures using your project’s client ID and client secret. To authenticate your quote request:

* Generate an `x-signature` header using your client secret.
* Include your `x-client-id` in the request headers.

For detailed instructions on generating the signature, refer to our [Authentication Guide](https://docs.orda.network/version-11-alpha/guide/authentication).

**Required Headers**

| Header         | Description                                           |
| -------------- | ----------------------------------------------------- |
| `x-client-id`  | Your project's client ID                              |
| `x-signature`  | HMAC-SHA256 signature derived from your client secret |
| `Content-Type` | `application/json` for this request                   |

The signature is an HMAC-SHA256 hash of the request body, using your Client Secret as the key. Never share your Client Secret or include it directly in your client-side code.

#### What is a Quote Request? <a href="#what-is-a-quote-request" id="what-is-a-quote-request"></a>

A quote request enables you to obtain pricing information for a potential transaction before executing it. This is useful for:

1. Showing the user how much they'll pay before they commit
2. Understanding the current exchange rates and fees
3. Preparing the necessary transaction details

#### Requesting a quote <a href="#requesting-a-quote" id="requesting-a-quote"></a>

**Intent Specification:** The quote request uses an `intent` Object to specify the amount calculation method:

* `usd`: Calculate based on USD amount (10 = 10$)
* `fromAmount`: Calculate based on the source token amount
* `toAmount`: Calculate based on the destination token amount

`fromAmount` and `toAmount` Methods must be in the token's **smallest unit based on its decimal precision per token**:

* ETH: 18 decimals (1 ETH = 1e18 units)
* USDC: 6 decimals (1 USDC = 1e6 units)
* BTC: 8 decimals (1 BTC = 1e8 units)

**Examples:**

* Swap 2.5 ETH: `fromAmount: "2500000000000000000"` (2.5 × 10^18)
* Receive 1000 USDC: `toAmount: "1000000000"` (1000 × 10^6)

#### Implementation Notes <a href="#implementation-notes" id="implementation-notes"></a>

* Only one intent type should be specified per quote request
* The specified amount serves as the constraint, while other amounts are calculated
* Market conditions, slippage, and fees affect the calculated amounts
* Always validate that the calculated amounts meet your requirements before executing the swap

#### Best Practices <a href="#best-practices" id="best-practices"></a>

* Use `fromAmount` for liquidating existing positions
* Use `toAmount` for precise purchasing requirements
* Use `usd` for dollar-cost averaging or consistent value strategies<br>

**Important Notes:**

* No need to worry about filling in your own settlement details - we use the settlement information you provided within the [developer portal](https://app.orda.network/).
* The `fromChain` should be a valid chain ID. Refer to the Active Chains documentation for supported networks.
* The `fromToken` should be the token address on the source blockchain.
* The API uses rate limiting to prevent abuse.

**Additional Information:**

* **Quote Provider:** The response includes details from the selected quote provider (e.g., LiFi, Relay, Wormhole or internal routing).
* **Approval Transaction:** approvalTxParams is only present if token approval is required.
* **Chain IDs:** Refer to active chains documentation.
* **Gas Estimates:** Based on current network conditions and may change.
* **Quote Expiration:** Quotes have a limited validity period of approximately 30 seconds. It’s advisable to set up an automatic quote refresh system for users who haven’t completed their transactions within the 30 second timeframe.
* **Slippage:** The actual received amount may differ due to price fluctuations.
* **Cross-Chain Transfers:** For multi-chain transactions, additional monitoring steps may be required.
* **Response Variation:** Structure may vary slightly based on the selected provider and transfer type (direct or cross-chain).
* **Best Quote Selection:** The API automatically selects the most optimal quote from available providers.

**Common Issues**

* **Incorrect HMAC Signature:** Verify that your signature is calculated over the exact request body and generated with your client secret. Refer to the Authentication Guide for more info.
* **Stale Data:** Quotes are valid for only a short period, so ensure that you request new quotes if the user delays or changes transaction parameters.
* **Incomplete Request Data:** Make sure all required transaction details are provided to avoid errors in the quote calculation.
