Skip to article content

Acrossprotocol: First Swap API Quote

The crosschain protocol Across returns transaction data through its Swap API. Your first quote lets you inspect the requested route and approval requirements before sending an onchain transaction.

Quote Request
GET /swap/approval accepts transfer parameters and returns executable calldata for the requested route.
Production Access
Production requests require an API key, supplied through Bearer authentication.
Request Identity
The documented request includes the depositor's wallet address and an integratorId .
Returned Transactions
swapTx contains the main transaction data. The response can also include approvalTxns for token-spending approvals.

Request Parameters

The request identifies the origin chain, destination chain, token addresses, and depositor. Use each token's address on its specified network; matching symbols don't establish matching contract addresses.

Illustration: Acrossprotocol - Request Parameters

View image file

Include tradeType , amount , and integratorId alongside those route details. With minOutput, amount is the minimum destination-token quantity; the API calculates the required input, including fees and slippage. Across's documented quickstart uses minOutput for a USDC request from Arbitrum to Base.

Token decimals determine how you encode the quantity. The USDC tokens in that documented route use six decimals, so their request amounts use integer base units.

Returned Transaction Data

In the swapTx object, the to field identifies the main transaction's target, and the data field contains its calldata. The execution example also passes the value field and uses the gas field when supplied.

The value field carries native-token value sent with the transaction; gas supplies its gas limit. Neither field alone establishes the total execution cost. Any returned approvals involve separate transactions whose requirements need their own review.

Acrossprotocol - Returned Transaction Data
Illustration: Returned Transaction Data.

View image file

The approval list indicates whether new token-approval transactions are needed before the main swap. Across's quickstart skips that stage when approvalTxns is absent or empty. When the response includes approval transactions, its execution order puts those approvals before the main swap transaction.

Can You Review a Quote Before Approving Tokens?

A quote supplies transaction instructions before you execute them. You can inspect any required approvals without submitting them.

This hypothetical request selects USDC from Arbitrum to Base, using the documented minOutput trade type. Its hypothetical minimum output is 1 237 USDC. With six decimals, 1237 * 1000000 = 1237000000 , giving an encoded amount of 1 237 000 000 base units.

The parameter set below uses those hypothetical choices with the documented chain IDs and token addresses. Define depositorAddress as your depositor's wallet address and integratorId as your issued Integrator ID.

const params = new URLSearchParams({
  tradeType: "minOutput",
  originChainId: "42161",
  destinationChainId: "8453",
  inputToken: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
  outputToken: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  amount: "1237000000",
  depositor: depositorAddress,
  integratorId: integratorId,
});

This code builds parameters; the quote request uses them with GET /swap/approval . Production authentication belongs in the Authorization header with your Bearer API key.

Consider two hypothetical quote responses that contain swapTx. A response without swapTx is a failed quote. With an empty or absent approvalTxns list, you can inspect the main transaction without an approval stage. With a populated list, review the approval targets and calldata alongside swapTx . Those additional transactions also matter when assessing execution costs; the main swap's gas limit doesn't describe them.

Both cases let this quote-only session end with reviewed transaction instructions and no submitted onchain transaction. Quotes expire; request a fresh quote when resuming, and confirm any required approvals before sending the main swap. Receiving the quote doesn't establish submission, confirmation, or a destination-chain fill.

Acrossprotocol - Request Your First Swap API Quote - diagram

Acrossprotocol - Request Your First Swap API Quote

  • Request Parameters
  • Returned Transaction Data
  • Can You Review a Quote Before Approving Tokens?

View image file

· updated