Get swap quote
Changed onGet a quote for swapping tokens, including price details and executable transaction data.
Request
- Base URLhttps://api.opensea.io
- AuthAPI key in header x-api-key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Query parameters
Chain of the token to swap from
Contract address of the token to swap from
Chain of the token to swap to
Contract address of the token to swap to
Amount to swap in the smallest unit of the token (e.g. wei for ETH)
Wallet address executing the swap
Slippage tolerance (0.0 to 0.5, default: 0.01)
Recipient address (defaults to sender address)
Response
OK
Example response
{
"quote": {
"costs": [
{
"type": "GAS",
"usd": "0.5"
}
],
"estimated_duration_ms": 30000,
"marketplace_fee_bps": 50,
"price_impact": {
"percent": "-0.08",
"usd": "-1.5"
},
"recommended_slippage": 2,
"refresh_after_ms": 2000,
"route_errors": [
{
"type": "INSUFFICIENT_FUNDS"
}
],
"slippage_tolerance": 0.01,
"swap_provider": "RELAY",
"total_cost_usd": 1869,
"total_price_usd": 1850.5
},
"transactions": [
{
"chain": "ethereum",
"svm": {
"instructions": [
{
"accounts": [
{
"pubkey": "So11111111111111111111111111111111111111112"
}
],
"data": "01020304",
"program_id": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"
}
],
"transaction_config": {
"compute_unit_limit": 200000,
"priority_fee_lamports": "5000"
}
}
}
]
}Changes
- breaking
the response property
/became nullable for the status - breaking
the response property
/became nullable for the status - breaking
the response property
//became nullable for the status - breaking
the response property
//became nullable for the status - breaking
the response property
//became nullable for the status - breaking
the
/response's property type changed fromobjectto no type for status - breaking
removed the required property
//from the response with the status - breaking
removed the required property
//from the response with the status - warning
added the new
EXECUTIONenum value to the///response property for the response status - info
added the media type
*/*for the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
/to the response with the status - info
added the optional property
//to the response with the status - info
added the optional property
//to the response with the status - info
added
subschema #2to the/response propertyanyOflist for the response status
- breaking