Skip to main content
In this section, you’ll learn how to execute a token swap using the transaction data generated from a previously obtained quote.
Prerequisites: Complete the Get a Quote guide first to obtain a valid quote.

Overview

After obtaining a quote, you can execute the swap by generating the necessary transaction data (bytecode) and submitting it to the blockchain. The Pods API handles the complexity of preparing the transaction data for different providers and swap types.
One-call flow: If you pass both originAddress and destinationAddress to GET /v2/swap/quote, the response already includes id, chainId, and transactionData alongside quote — you can skip POST /v2/swap/bytecode entirely and go straight to signing the returned transactions.
Trustless Operation: You sign and submit all transactions yourself. Pods never has custody of your funds.

Executing a Swap

Endpoint

Request Body

Example Request

Response Format

The API returns transaction data ready to be signed and executed:

Response Fields

ID created for execution tracking. Use this ID with GET /actions/{id} when you need execution status after transactions are submitted.
The chain ID where these transactions should be executed
EVM routes return an array of transaction legs when output=bytecode (default). Batch all legs on the same chainId into one atomic transaction — see Executing Bytecode. Solana routes return provider-specific transaction data with a rawTransaction payload. When output=fireblocks, returns a Fireblocks contract call payload instead of a transaction array. Typical EVM legs:
  • Approval: Grants permission to the swap contract
  • Swap: Executes the actual token swap
  • Tracking: Records the swap in Pods’s system
ERC-4337 user operation object. Only present when output=userOperation is requested.
The contract address to send the transaction to
Encoded transaction data (bytecode) for the contract call
Amount of native token to send (in wei). Usually “0” unless swapping native tokens.
quoteId and id identify different resources. quoteId tracks the saved swap quote and is the {id} for GET /v2/swap/status/{id}. The id returned by this endpoint is used for execution tracking.

Transaction Execution

Sign and submit the transaction data on your end — Pods never has custody of your funds.
Execute atomically. Do not send each item in transactionData as a separate transaction. Batch all same-chain legs into one tx (EIP-7702, smart-account userOp, or Fireblocks batch). See Executing Bytecode.
Use EIP-7702 executeBatch to encode all transactionData legs into a single type-4 transaction. Map transactionData the same way as bytecode in the strategy examples.

Smart account — output=userOperation

Request output=userOperation on POST /v2/swap/bytecode (or inline on the quote when both addresses are set). Submit the returned userOperation through your bundler — one userOp, not a loop of separate sends.

Fireblocks — output=fireblocks

Pass accountId and submit transactionData to the Fireblocks Transactions API. See Fireblocks Integration.

Swap Types

The endpoint automatically handles different swap types:
Same-chain swaps (e.g., USDT to USDC on Ethereum):
  • Usually 2-3 transactions: approve + swap (+ tracking)
  • Executes immediately on the same blockchain
  • Lower fees, faster execution

Error Handling

The API returns appropriate error messages for:
  • Missing required parameters
  • Invalid or expired quote
  • Quote not found or already used
  • Provider-specific errors during transaction preparation
Example Error Response:
Always check that the quote hasn’t expired before executing. Quotes are typically valid for 5 minutes.

Complete Workflow

1

Get Quote

Use GET /v2/swap/quote to get swap quote and pricing
2

Generate Bytecode

Use POST /v2/swap/bytecode with the quote to generate transaction data. Save the returned id.
3

Execute Transactions

Sign and send the transactions using your wallet
4

Track Status

For cross-chain swaps, use GET /v2/swap/status/{quoteId} to monitor quote progress.Pass the quoteId returned in step 1 as the {quoteId} path parameter. Use the id returned in step 2 with GET /actions/{id} when you need execution status.

Next Steps

Get Another Quote

Start a new swap

Check Status

Track cross-chain swap progress

Code Examples

View complete implementation examples