# Symbiosis API

## What is the Symbiosis API?

The Symbiosis API allows you to integrate the core functionalities of the Symbiosis Protocol into your application, platform, or protocol. It provides decentralized cross-chain swaps and liquidity management, enabling users to interact with multiple blockchain networks without intermediaries.

<details>

<summary>Symbiosis Protocol Features Available via the API</summary>

The Symbiosis API provides access to the following cross-chain and on-chain operations:

1. **Swaps:**
   1. **Cross-chain swaps** – Swap **any token pair** across supported blockchain networks.\
      In shor&#x74;*:* [Symbiosis: Cross-Chain Swaps](/main-concepts/symbiosis-cross-chain-swaps.md)
   2. **On-chain swaps** – Swap **any token pair** on a supported network.
2. **Interchain communication** – Transfer tokens to third-party protocols.\
   In shor&#x74;*:* [Symbiosis as Interchain Communication Protocol](/main-concepts/symbiosis-as-interchain-communication-protocol.md)
3. **Bridging** – Mint or burn tokens to transfer assets across chains.\
   In shor&#x74;*:* [Symbiosis Mint-Burn Process](/crosschain-liquidity-engine/synthesizing-process.md)
4. **Cross-chain operation status tracking** – Retrieve real-time transaction status updates.

**Note**\
**Any token pair** refers to tokens that can be exchanged on supported DEXs within blockchain networks supported by the Symbiosis Protocol.

</details>

## Checklist Before Going to Production (Mainnet)

{% hint style="danger" %}
**Warning:** If any of these checks fail, you put the assets of your users at risk. Therefore, you must not go to Mainnet with real assets and real users. This could result in the loss of your users' assets.

1. **Approval of ERC20 Tokens:** Always approve users' ERC20 tokens for only one contract — the <mark style="color:purple;">`metaRouterGateway`</mark> — on each blockchain. Verify the contract addresses for all supported blockchains in [this configuration](https://github.com/symbiosis-finance/js-sdk/blob/main/src/crosschain/config/mainnet.ts).
2. **Contract Existence and Address Validation**: Ensure that the contracts used in your integration are deployed on the respective blockchains, and that their addresses on each blockchain match those listed in [this configuration](https://github.com/symbiosis-finance/js-sdk/blob/main/src/crosschain/config/mainnet.ts).&#x20;
3. **Handling of Calldata:** Do not modify, reuse, or cache calldata retrieved from Symbiosis SDKs or API methods.
4. **Testing:** After deployment to Mainnet, conduct at least one cross-chain operation to ensure proper functionality.

**Reminder:** Perform this checklist during the initial deployment and after every software update.
{% endhint %}

## Swap Workflow Using the Symbiosis API

{% hint style="info" %}
`partnerId` is a custom identifier string used to associate swaps or other operations with a specific partner integration within the Symbiosis Protocol.

The value is defined by the integrator — they can choose any string. It is recommended to use a fixed and consistent value across all operations performed under one integration, so that all related transactions can be tracked and attributed correctly.
{% endhint %}

#### V1 or V2 Endpoint Set

* **V2 endpoint set:** Extended cross-chain swap endpoints with support for any-to-any routing and Bitcoin swap routes. Recommended for integrations.
* **V1 endpoint set:** Original cross-chain swap endpoints. Planned for gradual deprecation.

#### A General Workflow for Performing a Swap Using the Symbiosis API

1. Get a list of supported blockchain networks using `/v1/chains`&#x20;
2. Check swap limits (allowed swap amounts) using `/v1/swap-limits`&#x20;
3. Get the calldata (payload)
   1. **For BTC -> Any**, use `/v2/quote` to receive a quote and `/v2/swap` to obtain a BTC deposit address and a fresh quote.
   2. **For Any -> Any (except BTC -> Any)**, use `/v2/quote`&#x20;
4. If the source token is not a native gas token (for example, an ERC-20 token on an EVM chain), approve the smart contract to spend the user's tokens.\
   **Important:** Always approve users' ERC20 tokens for only one contract — the <mark style="color:purple;">`metaRouterGateway`</mark> — on each blockchain. Verify the contract addresses for all supported blockchains in [this configuration](https://github.com/symbiosis-finance/js-sdk/blob/main/src/crosschain/config/mainnet.ts).
5. Sign and send transaction to trigger a cross-chain swap\
   Since network conditions constantly change, calldata must be regenerated periodically (e.g., every 30 seconds) to ensure it remains valid before execution.
   1. **For BTC -> Any**, send the quoted amount to the BTC address generated in Step 3.a. This will triggers the cross-chain swap.
   2. **For Any -> Any (except BTC -> Any)**, sign the calldata obtained in Step 3.b using the wallet, then submit the transaction to the source blockchain.
6. Monitor the progress of the swap using `/v2/tx/{chainID}/{txHash}` \
   This endpoint provides real-time status updates for cross-chain operations.

**Swap workflow:**

* **Any to Any:** [Symbiosis: Cross-Chain Swaps](/main-concepts/symbiosis-cross-chain-swaps.md)
* **BTC to Any:** [Symbiosis: To/From BTC](/main-concepts/symbiosis-cross-chain-swaps/symbiosis-to-from-btc.md)

#### Handling Transactions & Approvals

Smart contract approvals, as well as transaction signing and submission, are performed through the user's wallet (for example, MetaMask, WalletConnect, or Coinbase Wallet) via wallet APIs. These actions are not handled directly by the Symbiosis API and must be initiated by the application through wallet interactions.

#### Checking API Health & Swap Time

An application can perform health checks periodically or before each swap using `/health-check`. The frequency depends on the app's load and expected behavior.

To get an approximate swap duration, use the swap time estimation endpoint `/v1/swap-durations`. The estimated swap time is based on historical data and a real swap time may vary due to changing network conditions.

#### Examples

* **Symbiosis WebApp**\
  The [Symbiosis WebApp](https://app.symbiosis.finance/swap) uses the Symbiosis API for interacting with the Symbiosis Protocol and serves as a reference for supported protocol functionalities.
* **Swagger**\
  The [Swagger documentation](https://api.symbiosis.finance/crosschain/docs/) of the Symbiosis API provides examples for every endpoint. Simply scroll to the endpoint of interest, input the required data, or use preset values, and execute the example.

## Swagger API Documentation

The Symbiosis API documentation, powered by Swagger, provides an interactive way to explore and test all endpoints:

* [Mainnet Documentation: ](https://api.symbiosis.finance/crosschain/docs/)Access the Swagger interface for the Mainnet environment.

{% hint style="info" %}
**Note on Testnet:** While a Testnet environment exists for testing purposes, functionality verified on Testnet does not guarantee the same behavior on Mainnet. We strongly recommend testing directly on Mainnet using low-cost networks and small token amounts.
{% endhint %}

## Supported Blockchains and Tokens

#### Supported Blockchains

Chain-specific parameters (chain IDs, etc.) can be found in the following configuration:

* [Mainnet Configuration](https://github.com/symbiosis-finance/js-sdk/blob/main/src/crosschain/config/mainnet.ts)

You can also retrieve the list of currently supported blockchains using the [`/v1/chains`](https://api.symbiosis.finance/crosschain/docs/#/Chains/get_v1_chains) endpoint.

#### Supported Tokens

Using the Symbiosis API, you can operate any token that exists and can be exchanged in DEXs  within the blockchains supported by the Symbiosis Protocol.

There are no predefined restrictions on supported tokens, and you may define your own list of tokens if needed.

To retrieve the list of token used in Symbiosis, call the [`/v2/tokens`](https://api.symbiosis.finance/crosschain/docs/#/v2/get_v2_tokens) endpoint.

## Fees

The **Symbiosis Protocol** facilitates on-chain swaps and cross-chain operations across a wide range of supported blockchain networks. During these operations, the protocol collects several types of fees.

Partners may optionally apply **additional fees** on top of the standard Symbiosis fees if needed.

#### Cross-chain Operations

For cross-chain operations, Symbiosis provides dedicated fee collector contracts designed for partners to charge and collect custom fees in addition to the standard protocol fees:

* **General Fee Collector:** deployed on the **Symbiosis chain** (the protocol host chain) — used for all cross-chain operations **except** those to and from the Bitcoin network.
* **BTC Fee Collectors:** deployed on the **BNB Chain, Ethereum, Rootstock, and Citrea** — used for operations **to and from the Bitcoin network**.

For details on how to collect additional fees using these contracts, please refer to [Partner Fee Collectors](/developer-tools/symbiosis-api/partner-fee-collectors.md)

#### On-Chain Swaps

For on-chain swaps, Symbiosis uses a separate **fee collector contract** deployed on each supported blockchain. The protocol does **not** provide a built-in mechanism for partners to collect additional fees for these operations.

If you need to charge additional fees for on-chain swaps, you must deploy and manage your own **fee collector contract** independently.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.symbiosis.finance/developer-tools/symbiosis-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
