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

# API Parameters

> List of API parameters and descriptions. Deep dive into certain parameters.

Below is a succinct breakdown of the parameters used in the `create-tx` API endpoint. Detailed descriptions and usage examples are
provided in dedicated subpages.

## Notable API Categories

There are several categories of parameters that are particularly important to understand when working with the `create-tx`
endpoint:

### Authentication

| **Parameter** | **Example Value** | **Description**                     |
| ------------- | ----------------- | ----------------------------------- |
| `accesstoken` | `xx789x`          | Access token generated by deBridge. |

### Directional Parameters

These parameters define the origin and destination of the transaction, including the assets being sold on the source chain and the
assets being purchased on the destination chain.

| **Parameter**      | **Example Value**                            | **Description**                                      |
| ------------------ | -------------------------------------------- | ---------------------------------------------------- |
| `srcChainId`       | `56`                                         | Internal chainId of the supported source chain.      |
| `srcChainTokenIn`  | `0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d` | Input asset address (what the user sells).           |
| `dstChainId`       | `43114`                                      | Internal chainId of the supported destination chain. |
| `dstChainTokenOut` | `0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7` | Output asset address (what the user buys).           |

### Offer Parameters

These parameters specify the amounts of tokens to be sold and received. The API can also be configured to automatically determine
the output amount to ensure a reasonably profitable market order.

| **Parameter**             | **Example Value**                 | **Description**                                                                                |
| ------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------- |
| `srcChainTokenInAmount`   | `100000000000000000000` or `auto` | Amount of input token (with decimals). Can be `auto` if `dstChainTokenOutAmount` is specified. |
| `dstChainTokenOutAmount`  | `auto` or `100000000000000000000` | Amount of output token. Recommended to use `auto` for optimal solver matching.                 |
| `prependOperatingExpense` | `true`                            | Adds estimated operating expense to input token. Recommended for better UX.                    |

### Authorities and Recipient Address

Optional parameters defining entities authorized to patch/cancel the order, and the recipient of funds on fulfillment. Typically
user addresses are used.

> These parameters are optional. However, omitting them means the API won't return a signable transaction payload until wallet
> connection.

<Warning>
  **Ensure** `dstChainOrderAuthorityAddress` is user-accessible — otherwise funds may become inaccessible.
</Warning>

| **Parameter**                   | **Example Value**                | **Description**                                                                                                                                                                                                                                                                   |
| ------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `srcChainOrderAuthorityAddress` | `0xd8dA...ABCD` or `862oLANN...` | Set the source chain authority address to the user's address. Used as fallback for [`srcAllowedCancelBeneficiary`](/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/api-parameters#cancellation-beneficiary) if the latter is not set explicitly. |
| `dstChainOrderAuthorityAddress` | `0xd8dA...ABCD` or `862oLANN...` | Can cancel order on destination chain. **Must be controlled by the user.**                                                                                                                                                                                                        |
| `dstChainTokenOutRecipient`     | `0xd8dA...ABCD` or `862oLANN...` | Recipient of funds on destination chain after fulfillment. Typically the user's address.                                                                                                                                                                                          |

### Affiliate Fee Parameters

These settings define the affiliate fee recipient and amount.

| **Parameter**           | **Example Value**                | **Description**                                                                                             |
| ----------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `affiliateFeePercent`   | `0.1`                            | Percentage of input amount to assign as affiliate fee.                                                      |
| `affiliateFeeRecipient` | `0xd8dA...ABCD` or `862oLANN...` | Address (EVM) or pubkey (Solana) that will receive affiliate fees once order reaches `ClaimUnlocked` state. |

### Referral Code

Optional tracking and reward parameter.

| **Parameter**  | **Example Value** | **Description**                                                                                                                                            |
| -------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `referralCode` | `31805`           | Integrator's referral code. [Can be generated in-app](/dln-details/affiliates/integrators#how-to-make-sure-your-integration-activity-is-accounted-for%3F). |

### Cancellation Beneficiary

Optional parameters, but required for [auto-cancellations](/dln-details/affiliates/auto-cancellations) to work.

| **Parameter**                 | **Example Value**                | **Description**                                                                                                                                                                         |
| ----------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `srcAllowedCancelBeneficiary` | `0xd8dA...ABCD` or `862oLANN...` | Address receiving the source chain input funds in an event of cancellation. More information available in the [auto-cancellations article](/dln-details/affiliates/auto-cancellations). |

### Transaction Estimation

For EVM chains, the API can be configured to validate the resulting transaction and provide an estimate of its gas consumption.
This is particularly useful for ensuring that all of the conditions for executing the transaction are met before submission, such
as sufficient token balances and approvals.

| **Parameter**    | **Example Value** | **Description**                                                                                                                                                        |
| ---------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `enableEstimate` | `true` or `false` | Forces the API to validate the resulting transaction and estimate its gas consumption. When enabled, the estimate is returned at `tx.gasLimit` in the response object. |

<Info>
  To estimate a transaction, `senderAddress` must be set to the address that will execute it. This address must hold:

  * Enough of the input token to cover `srcChainTokenInAmount`
  * Enough native currency to cover the protocol [fixed fee](/dln-details/overview/fee-structure#fixed-fee)
</Info>

<Warning>
  If `srcChainTokenIn` is an ERC-20 token, an approval must be provided for the specified `srcChainTokenInAmount` to the spender
  specified in the
  [`tx.to` from the response](/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/response#tx)
  **before** the endpoint is called.

  Failing to provide a valid approval will result in an error response.
</Warning>

### Solana-Specific Parameters

| **Parameter**                   | **Example Value** | **Description**                                                                                                                                                                                                                                              |
| ------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `skipSolanaRecipientValidation` | `true` or `false` | When set to `true`, skips the validation of the Solana `dstChainTokenOutRecipient` address. The validation is in place to prevent accidental loss of funds. Might be necessary when the recipient address is a program-derived address (PDA) or a multi-sig. |

## Example Request

The following example shows a complete `create-tx` API request:

> [https://dln.debridge.finance/v1.0/dln/order/create-tx?srcChainId=56 \&srcChainTokenIn=0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d \&srcChainTokenInAmount=100000000000000000000\&dstChainId=43114 \&dstChainTokenOut=0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7 \&dstChainTokenOutAmount=auto \&dstChainTokenOutRecipient=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 \&srcChainOrderAuthorityAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 \&dstChainOrderAuthorityAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 \&affiliateFeePercent=0.1 \&affiliateFeeRecipient=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045](https://dln.debridge.finance/v1.0/dln/order/create-tx?srcChainId=56\&srcChainTokenIn=0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d\&srcChainTokenInAmount=100000000000000000000\&dstChainId=43114\&dstChainTokenOut=0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7\&dstChainTokenOutAmount=auto\&dstChainTokenOutRecipient=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\&srcChainOrderAuthorityAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\&dstChainOrderAuthorityAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\&affiliateFeePercent=0.1\&affiliateFeeRecipient=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045)

This request demonstrates how all core parameters are combined to generate a valid and executable cross-chain order.

# Deep Dive

Reference to common and interesting use-cases. Deep dive into certain parameters.

### Estimation Only

The `create-tx` endpoint is designed for both estimation and transaction construction. It can be safely called without specifying
[authority or recipient addresses](/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/api-parameters#authorities-and-recipient-address)
when a wallet address is not yet available—for example, during early stages of interaction in a dApp. In such cases, the endpoint
can still be used to suggest input or output token amounts.

Once the wallet address becomes available, the same `create-tx` request can be repeated with the necessary parameters to retrieve
a [full transaction call](/dln-details/integration-guidelines/order-creation/creating-order/api-parameters/response#tx).

To maintain solver profitability and ensure the order remains valid upon submission, it is recommended to allow the API to compute
a reasonable output amount. This is achieved by setting the `dstChainTokenOutAmount` parameter to `auto` in both the estimation
and transaction calls.

<Warning>
  Additionally, orders should be submitted within 30 seconds of retrieving the transaction from the API. This expiration window
  helps ensure the order remains profitable for solvers at the time of on-chain placement.
</Warning>

### `prependOperatingExpenses`

The prependOperatingExpenses setting is a boolean. It is recommended to enable this option:

```
prependOperatingExpenses = true
```

#### Enabled (prependOperatingExpenses=true)

When enabled, operating expenses are calculated separately from the spread and added on top of the input token amount, making all
fees fully transparent. This approach helps clarify exactly what is being paid in fees.

For example, swapping 100 USDC on Arbitrum for 100 USDC on Polygon in our application displays a small fee (just over \$0.03),
shown above the red line in the figure below. This represents the solver's operating expenses.

<img src="https://mintcdn.com/debridge-f846479f/QCNI5e_yZ9g1jsea/images/dln-details/prependOperatingCosts.png?fit=max&auto=format&n=QCNI5e_yZ9g1jsea&q=85&s=7ee89d7958b82d1b4efa78096daf2f6c" alt="Prepend Operating Expenses" width="492" height="448" data-path="images/dln-details/prependOperatingCosts.png" />

* **ERC20 Approval**: The total amount (including operating expenses) must be approved using the `approve` function. This value is
  provided in `response.estimation.srcChainTokenIn.amount`.
  * **Buffer Recommendations**: Estimates may need to be refreshed if there is a delay between generating the response and
    submitting `response.tx`. Updated operating expenses might require a new approval.
* **Fulfillment Likelihood**: When `response.tx` is signed and submitted within 30 seconds, the probability of successful
  execution is over 99.9%.

#### Disabled (prependOperatingExpenses=false)

When disabled, `response.estimation.srcChainTokenIn.amount` equals the `srcChainTokenInAmount` specified in the original
`create-tx` request. In this case, the
[operating expenses](/dln-details/overview/fee-structure#runtime-costs-built-into-the-spread) are subtracted directly from the
spread between the input value and `response.estimation.dstChainTokenOut`.

In this case, an additional error should be covered. It occurs when the input amount is too small to pay for the order costs.

```json theme={null}
{
  "errorCode": 12,
  "errorId": "ERROR_LOW_GIVE_AMOUNT",
  "errorMessage": "Given amount of input asset is too small to cover operational costs of Takers, cannot estimate reasonable outcome of an order",
  "reqId": "79a2c431-e52c-48c0-a12e-2a9960644a59"
}
```

[Sample error request](https://dln.debridge.finance/v1.0/dln/order/create-tx?prependOperatingExpenses=false\&dstChainTokenOutAmount=auto\&srcChainId=137\&dstChainId=42161\&srcChainTokenIn=0x3c499c542cef5e3811e1192ce70d8cc03d5c3359\&dstChainTokenOut=0xaf88d065e77c8cc2239327c5edb3a432268e5831\&srcChainOrderAuthorityAddress=0x55a8f5cce1d53d9ff84ec0962882b447e5914db8\&dstChainOrderAuthorityAddress=0x55a8f5cce1d53d9ff84ec0962882b447e5914db8\&dstChainTokenOutRecipient=0x55a8f5cce1d53d9ff84ec0962882b447e5914db8\&srcChainTokenInAmount=100000\&referralCode=31085\&senderAddress=0x55a8f5cce1d53d9ff84ec0962882b447e5914db8).

Both modes produce the same execution outcome, but enabling `prependOperatingExpenses` typically provides a clearer breakdown of
the fee structure for end users.

### Minimum Input Amounts

When creating an order with Solana as the destination chain and when `dstChainTokenOut` is
[SOL](/dln-details/integration-guidelines/order-creation/creating-order/specifying-assets#sol-native-sol), the required minimum
output amount for SOL is **0.001 (1000000 lamports)**.

This is due to the minimum balance requirement for SOL accounts on the Solana network, which ensures that accounts remain
rent-exempt and can cover transaction fees.

Due to shifting market conditions, the minimum input amount for tokens on the source chain may vary.

It is recommended to determine the minimum input amount for a given token by creating a
[reverse-market order](/dln-details/integration-guidelines/order-creation/creating-order/quoting-strategies#reverse-market-order)
with the `dstChainTokenOutAmount` set to `1000000` and the `srcChainTokenInAmount` set to `auto`.

This approach allows following the market conditions, without hardcoding specific minimum input amounts for each token.
