REST API
- EVM Accounts
- EVM Smart Accounts
- EVM Swaps
- EVM Token Balances
- Faucets
- PaymentsAlpha
- Policy Engine
- Solana Accounts
Create a swap quote
Create a swap quote, which includes the payload to sign as well as the transaction data needed to execute the swap. The developer is responsible for signing the payload and submitting the transaction to the network in order to execute the swap.
curl --request POST \
--url https://api.cdp.coinbase.com/platform/v2/evm/swaps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"network": "base",
"toToken": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607",
"fromToken": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"fromAmount": "1000000000000000000",
"taker": "0xAc0974bec39a17e36ba4a6b4d238ff944bacb478",
"signerAddress": "0x922f49447d8a07e3bd95bd0d56f35241523fbab8",
"gasPrice": "1000000000",
"slippageBps": 100
}'
{
"blockNumber": "17038723",
"toAmount": "1000000000000000000",
"toToken": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607",
"fees": {
"gasFee": {
"amount": "1000000000000000000",
"token": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
},
"protocolFee": {
"amount": "1000000000000000000",
"token": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
}
},
"issues": {
"allowance": {
"currentAllowance": "1000000000",
"spender": "0x000000000022D473030F116dDEE9F6B43aC78BA3"
},
"balance": {
"token": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"currentBalance": "1000000000000000000",
"requiredBalance": "1000000000000000000"
},
"simulationIncomplete": false
},
"liquidityAvailable": true,
"minToAmount": "900000000000000000",
"fromAmount": "1000000000000000000",
"fromToken": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"permit2": {
"hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"eip712": {
"domain": {
"name": "Permit2",
"chainId": 1,
"verifyingContract": "0x000000000022D473030F116dDEE9F6B43aC78BA3"
},
"types": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"PermitTransferFrom": [
{
"name": "permitted",
"type": "TokenPermissions"
},
{
"name": "spender",
"type": "address"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
}
],
"TokenPermissions": [
{
"name": "token",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
]
},
"primaryType": "PermitTransferFrom",
"message": {
"permitted": {
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1000000"
},
"spender": "0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf",
"nonce": "123456",
"deadline": "1717123200"
}
}
},
"transaction": {
"to": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
"data": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"gas": "100000",
"gasPrice": "1000000000",
"value": "1000000000000000000"
}
}
Authorizations
A JWT signed using your CDP API Key Secret, encoded in base64. Refer to the Generate Bearer Token section of our Authentication docs for information on how to generate your Bearer Token.
Headers
An optional UUID v4 request header for making requests safely retryable. When included, duplicate requests with the same key will return identical responses. Refer to our Idempotency docs for more information on using idempotency keys.
36
Body
Response
Successfully created swap quote.
A wrapper for the response of a swap quote operation.
A wrapper for the response of a swap quote operation.
A wrapper for the response of a swap quote operation.
Was this page helpful?
curl --request POST \
--url https://api.cdp.coinbase.com/platform/v2/evm/swaps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"network": "base",
"toToken": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607",
"fromToken": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"fromAmount": "1000000000000000000",
"taker": "0xAc0974bec39a17e36ba4a6b4d238ff944bacb478",
"signerAddress": "0x922f49447d8a07e3bd95bd0d56f35241523fbab8",
"gasPrice": "1000000000",
"slippageBps": 100
}'
{
"blockNumber": "17038723",
"toAmount": "1000000000000000000",
"toToken": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607",
"fees": {
"gasFee": {
"amount": "1000000000000000000",
"token": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
},
"protocolFee": {
"amount": "1000000000000000000",
"token": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
}
},
"issues": {
"allowance": {
"currentAllowance": "1000000000",
"spender": "0x000000000022D473030F116dDEE9F6B43aC78BA3"
},
"balance": {
"token": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"currentBalance": "1000000000000000000",
"requiredBalance": "1000000000000000000"
},
"simulationIncomplete": false
},
"liquidityAvailable": true,
"minToAmount": "900000000000000000",
"fromAmount": "1000000000000000000",
"fromToken": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"permit2": {
"hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"eip712": {
"domain": {
"name": "Permit2",
"chainId": 1,
"verifyingContract": "0x000000000022D473030F116dDEE9F6B43aC78BA3"
},
"types": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "chainId",
"type": "uint256"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"PermitTransferFrom": [
{
"name": "permitted",
"type": "TokenPermissions"
},
{
"name": "spender",
"type": "address"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
}
],
"TokenPermissions": [
{
"name": "token",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
]
},
"primaryType": "PermitTransferFrom",
"message": {
"permitted": {
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1000000"
},
"spender": "0xFfFfFfFFfFFfFFfFFfFFFFFffFFFffffFfFFFfFf",
"nonce": "123456",
"deadline": "1717123200"
}
}
},
"transaction": {
"to": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
"data": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"gas": "100000",
"gasPrice": "1000000000",
"value": "1000000000000000000"
}
}