Skip to main content
LLM prompt — copy and paste into your coding agent
Migrate my Socket API v2 integration to the Socket Swap V3 API.
Use https://docs.socket.tech/llms-full.txt for full context and follow https://docs.socket.tech/integrate/migration-guide-v2.
The Socket Swap V3 API (/v3/swap) replaces the legacy Socket API (/v2). The new API is simpler — a single quote call returns ready-to-send transaction data. No server-side route sessions, no multi-step build flow. The base URL also changes:
v2v3
Base URLhttps://api.socket.tech/v2https://backend.socket.tech/v3/swap

What changed at a glance

v2 (Legacy)v3 (New)
QuoteGET /v2/quoteGET /v3/swap/quote
Tx dataPOST /v2/route/start + GET /v2/route/build-next-txIncluded in quote response
StatusGET /v2/route/prepareGET /v3/swap/status
Approval checkGET /v2/approval/check-allowanceroute.approval object in quote response
Approval tx dataGET /v2/approval/build-txBuild client-side using route.approval
Auth headerAPI-KEYx-api-key + affiliate
Route IDactiveRouteIdquoteId

Execution flow

Before (v2):
  1. GET /v2/quote → pick a route
  2. POST /v2/route/start → register the route, get activeRouteId
  3. GET /v2/approval/check-allowance → check if approval needed
  4. GET /v2/approval/build-tx → build approval tx
  5. GET /v2/route/build-next-tx?activeRouteId=... → get tx calldata
  6. Submit the transaction on-chain
  7. GET /v2/route/prepare?activeRouteId=&userTxIndex=&txHash= → report tx hash
  8. Repeat steps 5–7 for multi-tx routes
After (v3):
  1. GET /v3/swap/quote → get routes with txData included
  2. If route.approval is present, approve approval.spenderAddress for approval.amount
  3. Submit route.txData.object on-chain
  4. Poll GET /v3/swap/status?quoteId=... until terminal status
All routes are single-transaction. No server-side session required.

Parameter mapping

Headers

v2v3
API-KEY: <key>x-api-key: <key>
affiliate: <affiliate-id> (required)

Query parameters

v2 paramv3 paramNotes
fromChainIdoriginChainId
toChainIddestinationChainId
fromTokenAddressinputToken
toTokenAddressoutputToken
fromAmountinputAmount
userAddressuserAddressUnchanged
recipientreceiverAddress
defaultBridgeSlippage / defaultSwapSlippageslippageSingle unified slippage param
includeDexes / includeBridgesincludeProviderComma-separated
excludeDexes / excludeBridgesexcludeProviderComma-separated
feePercentfeeBpsUnit change: percent → basis points. 0.5% becomes 50
feeTakerAddressfeeTakerAddressUnchanged
userOpsRequired. Use tx for standard routes
singleTxOnly, maxUserTxs, uniqueRoutesPerBridge, disableSwapping, bridgeWithGas, bridgeWithInsurance, isContractCall, and showAutoRoutes are not supported in v3.

Approval

In v2 you called two separate endpoints to check and build approval transactions. In v3, the quote response tells you everything you need:
"approval": {
  "spenderAddress": "0x...",
  "amount": "1000000",
  "tokenAddress": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
  "userAddress": "0x..."
}
If approval is present, approve spenderAddress for amount of tokenAddress before submitting. If approval is null, no approval is needed.

Status

Before:
GET /v2/route/prepare?activeRouteId=<id>&userTxIndex=<idx>&txHash=<hash>
After:
GET /v3/swap/status?quoteId=<quoteId>
Poll until you see a terminal status:
StatusMeaning
PENDINGNot yet started
IN_PROGRESSSource tx seen, destination pending
COMPLETEDDone
FAILEDFailed
EXPIREDQuote window expired
REFUNDEDFunds refunded

Quick example

v2 request:
curl "https://api.socket.tech/v2/quote?fromChainId=42161&toChainId=8453&fromTokenAddress=0xaf88d...&toTokenAddress=0x8335...&fromAmount=1000000&userAddress=0x123...&recipient=0x123...&feePercent=0.5&feeTakerAddress=0xabc..." \
  -H "API-KEY: <key>"
v3 equivalent:
curl "https://backend.socket.tech/v3/swap/quote?originChainId=42161&destinationChainId=8453&inputToken=0xaf88d...&outputToken=0x8335...&inputAmount=1000000&userAddress=0x123...&receiverAddress=0x123...&userOps=tx&feeBps=50&feeTakerAddress=0xabc..." \
  -H "x-api-key: <key>" \
  -H "affiliate: <affiliate-id>"

API Reference

Full Socket Swap V3 API reference

Get API Access

Request production API credentials