Skip to main content
POST
/
crypto
/
swaps
/
execute
curl -X POST https://secureapi.gridlog.io/api/v1/crypto/swaps/execute \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "chain": "polygon",
    "sellToken": "0x0000000000000000000000000000000000001010",
    "buyToken": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
    "amount": "10.0",
    "privateKey": "0xPRIVATE_KEY...",
    "slippageBps": 50
  }'
{
  "txHash": "0xabcdef...",
  "success": true
}
chain
string
required
Blockchain network (e.g., polygon, ethereum, solana)
sellToken
string
required
Token to sell — contract address or mint address
buyToken
string
required
Token to buy — contract address or mint address
amount
string
required
Amount of sellToken to swap (human-readable string)
privateKey
string
required
Private key of the sender wallet for signing the transaction
toAddress
string
Recipient address for the bought tokens (required for Solana)
slippageBps
number
Maximum acceptable slippage in basis points (default: 50 = 0.5%)
curl -X POST https://secureapi.gridlog.io/api/v1/crypto/swaps/execute \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "chain": "polygon",
    "sellToken": "0x0000000000000000000000000000000000001010",
    "buyToken": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
    "amount": "10.0",
    "privateKey": "0xPRIVATE_KEY...",
    "slippageBps": 50
  }'
{
  "txHash": "0xabcdef...",
  "success": true
}
txHash
string
On-chain transaction hash for the swap
success
boolean
Whether the swap transaction was successfully broadcast
Swaps are executed immediately at market price. Use slippageBps to protect against unfavorable price movement.