GET /swap/quote
GET /run/socket/swap/quoteCache cached 1s, never served stale past that windowCost free · weight 0 · standard rate classSource billing freeRoute discovery for a swap or bridge: ranked routes with output amount and minimum received, estimated time, slippage, gas fee, bridge/DEX provider metadata, fee breakdown, ERC-20 approval plan and an unsigned transaction plan. Plan data only — never signed or broadcast by this source.
Plan data only. The txData/approval fields describe what a wallet would send; this source never signs, approves, submits or broadcasts. Pin exactly one amount side: inputAmount for EXACT_INPUT, outputAmount for EXACT_OUTPUT (live 2026-09-12: outputAmount on an input-pinned call returns HTTP 400 'outputAmount is only supported for EXPECTED_OUTPUT and EXACT_OUTPUT quote types'; simulatedQuotesRequired/refuel are rejected for output quote types).
Parameters
| name | in | type | description | |
|---|---|---|---|---|
userOps | query | strtx | deposit | required | Operation kind. 'tx' = a transaction the caller would send; 'deposit' = pre-funding instruction variant used by the site's QR-deposit flow (not exercised by this source). default: txexample: tx |
originChainId | query | int | required | Source chain id (hub aliases accepted: base / 8453). example: 8453 |
destinationChainId | query | int | required | Destination chain id (hub aliases accepted). example: 42161 |
inputToken | query | str | required | Source token contract address. example: 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913 |
outputToken | query | str | required | Destination token contract address. example: 0xaf88d065e77c8cc2239327c5edb3a432268e5831 |
receiverAddress | query | str | required | Destination address. any public address works for quoting. example: 0x18Cc6F90512C6D95ACA0d57F98C727D61873c06a |
inputAmount | query | str | optional | Amount in source-token base units (EXACT_INPUT; USDC has 6 decimals, so 10000 = 0.01 USDC). Omit for EXACT_OUTPUT. example: 10000 |
outputAmount | query | str | optional | Amount in destination-token base units (EXACT_OUTPUT only, with quoteType=EXACT_OUTPUT). Omit for EXACT_INPUT. example: 10000 |
quoteType | query | strEXACT_INPUT | EXACT_OUTPUT | optional | Which side of the trade the amount pins. default: EXACT_INPUTexample: EXACT_INPUT |
userAddress | query | str | optional | Sender address used for the approval/gas plan. Defaults to a placeholder address when omitted. example: 0x18Cc6F90512C6D95ACA0d57F98C727D61873c06a |
slippage | query | float | optional | Slippage tolerance in percent (1 = 1%); bounds each route's minAmountOut. Defaults to the route's suggested slippage when omitted. example: 1 |
refuel | query | strtrue | false | optional | Request a small native-gas refuel add-on on the destination chain (input-pinned quotes only — the upstream rejects it for EXACT_OUTPUT). example: true |
simulatedQuotesRequired | query | strtrue | false | optional | Ask the router to simulate each quote; set true so returned plans are pre-validated. Input-pinned quotes only — the upstream rejects it for EXACT_OUTPUT. example: true |
Response
type: object
pagination: none
sample: {
"result": "object{originChainId, destinationChainId, quoteType, userAddress, receiverAddress, input{token, amount, priceInUsd, valueInUsd}, routes: array of route objects, quoteRejections: array{providerId, reason}}",
"statusCode": "int",
"success": "bool",
"message": "null"
}
Safe request
Reads the credential from API_HUB_KEY; it never appears in the URL.
curl -sH "X-Hub-Key: $API_HUB_KEY" "https://openapihub.dev/run/socket/swap/quote?userOps=tx&originChainId=8453&destinationChainId=42161&inputToken=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913&outputToken=0xaf88d065e77c8cc2239327c5edb3a432268e5831&receiverAddress=0x18Cc6F90512C6D95ACA0d57F98C727D61873c06a&inputAmount=10000&outputAmount=10000"eType=EXACT_INPUT&userAddress=0x18Cc6F90512C6D95ACA0d57F98C727D61873c06a&slippage=1&refuel=true&simulatedQuotesRequired=true"