DeFi API Execution Reference
Quotes
Get the Best Quote
Retrieve the best available swap quote for a given source token, destination token, and amount. This endpoint returns pricing details, limits, and metadata required to proceed with a swap.
Quotes are time-limited and must be executed before they expire.
POST /v1/quotes
Request body example:
{
"from": {
"from_network_id": 1,
"from_token": "0xc02aaa3********9083c756cc2"
},
"to": {
"to_network_id": 4,
"to_token": "So11111111111111111111111111111111111111112",
},
"amount": 100,
"slippage_bps": "50"
}
Request notes:
amountmust be specified in decimal-adjusted format.slippage_bpsis expressed in basis points and must be sent as a string.
Response example:
{
"id": "bea66e69-64c3-4b88-96ac-29f1ce7d454d",
"from": {
"from_network_id": 1,
"from_token": "0xdac17f9********13d831ec7",
"from_amount_lots": 100000000,
"from_amount_decimals": 6
},
"mid": {
"mid_token_id": null,
"mid_token": null,
"mid_token_min_amount": null,
"mid_token_max_amount": null,
"mid_token_decimals": null
},
"to": {
"to_network_id": 4,
"to_token": "0xdac17f9********13d831ec7",
"to_min_amount_lots": 857382336,
"to_max_amount_lots": 861690790,
"to_amount_decimals": 9
},
"slippage_bps": "50",
"expires_at": 1769777954084
}
Quote Expiry
The expires_at field is a Unix timestamp in milliseconds (ms since epoch). After this timestamp, the quote is no longer valid and must be refreshed. Quotes should always be executed before expiry to guarantee pricing.
Middle Token Routing
If the user attempts to swap a volatile token, the system may automatically route the swap through a highly liquid intermediate token, typically USDC, to improve execution reliability and manage price volatility. All fields prefixed with mid_ describe this routing behavior and the token used internally.
Affiliate fees
To set your reward amount, please contact your manager or reach out to us at [email protected].
Intents
An intent represents a user's request to perform a swap and can only be created based on a quote, to which it is attached. It defines what the user wants to do, while the protocol handles how it gets executed.
Intents are chain-agnostic and support multiple blockchains and approval mechanisms.
Intent lifecycle
A typical intent goes through the following steps:
- Creation - An intent is created via the API with swap parameters such as source chain, destination chain, tokens, and amounts.
- Approval - The user authorizes fund usage using a chain-specific approval mechanism (for example, Permit2 on EVM, PSBT on Bitcoin, Cosigned transaction on Solana).
- Execution - Once approved, the resolver processes the intent and executes the swap.
- Status tracking - The intent status can be queried at any time to track progress or final outcome.
Create Intent
Create a new swap intent that describes what the user wants to swap. An intent is created off-chain and later executed on-chain by a resolver.
POST /v1/intents
Request example:
{
"quote_id": "bea66e69-64c3-4b88-96ac-29f1ce7d454d",
"from": {
"from_network_id": 1,
"from_token": "0xc02aaa3********9083c756cc2",
"from_address": "0x000000000000000000000000000000000000000"
},
"to": {
"to_network_id": 4,
"to_token": "So11111111111111111111111111111111111111112",
"to_address": "0x000000000000000000000000000000000000000"
},
"refund_address": "0x000000000000000000000000000000000000000",
"amount": 100,
"slippage_bps": "50"
}
Response example (EVM and Tron):
{
"id": "8a2d3f92-2a2b-4e4c-9d8a-3c9f92e4a111",
"deadline_at": 1761545456,
"approval_type": "permit2",
"params_to_sign": {
"escrow_contract_address": "0x000000000000000000000000000000000000000",
"permit2_contract_address": "0x000000000000000000000000000000000000000",
"resolver_deposit_address": "0x000000000000000000000000000000000000000",
"nonce": 10000,
"additional_data": {
"domain": { /* EIP-712 domain data */ },
"types": { /* EIP-712 types */ },
"witness": { /* witness data */ },
"witness_type_string": "ExampleTrade witness)ExampleTrade(address exampleTokenAddress,uint256 exampleMinimumAmountOut)",
"witness_hash": "0x000000000000000000000000000000000000000000000000000000000000000"
}
}
}
Approval Mechanism
The approval flow depends on the blockchain and swap type. The value of approval_type may change, and the structure of params_to_sign depends on the selected approval mechanism. Clients must always check approval_type and handle params_to_sign accordingly.
Approval Mechanism Examples:
Permit2 (used for EVM-based blockchains):
{
"id": "528d72ae-61cd-4fbc-9940-48ce4104abbb",
"deadline_at": 1772124002,
"secret_hash": "0x19875e12d834bc24********44dd26f37d367a44926",
"approval_type": "permit2",
"params_to_sign": {
"escrow_contract_address": "0x8DcbE1aCf********18F8e8836",
"permit2_contract_address": "0x0000000********6B43aC78BA3",
"resolver_deposit_address": "0xF3B3a4edB********f69f557029",
"nonce": 499,
"additional_data": {
"domain": { /* EIP-712 domain data */ },
"types": { /* EIP-712 types */ },
"witness": { /* witness data */ },
"secretHash": "0xabcde...",
"witness_type_string": "DepositWitness witness)DepositWitness(address resolverDepositAddress,bytes32 secretHash,uint256 deadline)TokenPermissions(address token,uint256 amount)",
"witness_hash": "0xc77ff4a96e********b8c12636c39f7f"
}
}
}
HTLC (used for Bitcoin blockchain):
{
"id": "0a47fbd6-056a-4e4d-a1e3-9b9a1bf947e5",
"approval_type": "htlc",
"params_to_sign": {
"psbt": "cHNidP8BAJ0CAAAAAQEBAQEB...",
"inputs": [0, 1, 2]
}
}
Cosigned transaction (used for Solana blockchain):
{
"id": "0a47fbd6-056a-4e4d-a1e3-9b9a1bf947e5",
"deadline_at": 1772124152,
"secret_hash": "0x84edcf7********dd0fb60baccf",
"approval_type": "cosign",
"params_to_sign": {
"transaction": "02000..."
}
}
Approvals
After an intent is created, an approval must be added before it can be executed. This endpoint attaches a signed approval to an existing intent. The approval proves the user has authorized the swap and allows it to proceed.
You can find examples of how to generate the approval signed data on this page.
POST /v1/intents/{intent_id}/approvals
Request Body
The request body depends on the approval mechanism. It includes the approval type and the signed data generated by the user.
Permit2 (EVM):
{
"approval_type": "permit2",
"signed_data": "0x..."
}
signed_data is the Permit2 signature.
Possible errors: If the backend returns error code 25, the user has not approved Permit2 yet for the selected token. The user must approve Permit2 on-chain before continuing.
PSBT (Bitcoin):
{
"approval_type": "psbt",
"signed_data": "cHNid..."
}
signed_data is a signed PSBT.
Cosign (Solana):
{
"approval_type": "cosign",
"signed_data": {
"transaction": "02000...",
"user_address": "F8ZRdxv********ETTDFg"
}
}
signed_data.transaction is a signed versioned transaction.
Retrieving Intent Status
This endpoint allows you to check the current status of a swap intent. It provides the intent's lifecycle state, associated transactions, and additional metadata.
GET /v1/intents/{intent_id}
Response Example:
{
"intent_id": "fe5601fb-60f2-4cb0-8a67-c55bd3640411",
"status": "Deposited",
"from_amount_lots": "123456",
"from_network_id": 1,
"from_token": "0x000000000000000000000000000000000000000",
"from_token_id": 1,
"to_network_id": 2,
"to_token": "0x000000000000000000000000000000000000000",
"to_token_id": 4,
"to_min_amount_lots": "123456",
"to_max_amount_lots": "123456",
"swap_metadata": {
"id": "19b44362-bc4d-4b2e-824f-f712c6c80eff",
"proxy_address": "0x000000000000000000000000000000000000000",
"user_deposit_tx": "0x000000000000000000000000000000000000000",
"fulfill_tx": null,
"swap_tx": null,
"created_at": "2026-01-15T12:00:00Z",
"user_deposited_at": "2026-01-15T12:05:00Z",
"fulfilled_at": null,
"swapped_at": null,
"refunded_at": null
}
}
The status field represents the overall progress of the swap, combining both intent and swap state.
Possible swap statuses:
| Status | Description |
|---|---|
| Created | The intent has been created but no approval has been added yet. |
| Approved | User has added approval/signature for the swap. |
| Verified | Resolver has accepted the intent and is ready to execute. |
| Failed | The intent was declined by the resolver. |
| Deposited | Resolver has deposited user tokens on source network into the escrow. |
| Finished | User has received funds on destination network in target token. |
| Expired | The intent expired before execution. |
| RefundRequested | A refund has been requested for this intent. |
| Refunded | Tokens have been refunded to the user. |
Additional Notes:
- Use this endpoint to poll the status of an intent or check its progress.
swap_metadataprovides transaction hashes and timestamps to track each stage.