API Endpoint: /swap

Request Method: GET

Description: This API endpoint generates a base64-encoded transaction for performing a token swap on the Solana blockchain. The transaction can be executed using various decentralized exchange (DEX) providers like Raydium, Meteora, etc.

Request URL:

https://api.spiderswap.io/spider-api/v1/swap

Request Headers:

accept: application/json
X-API-KEY: YOUR_API_KEY

Example Request:

curl --request GET \
     --url 'https://api.spiderswap.io/spider-api/v1/swap?owner=8N4FvNMwdA3KndSsKKJuzDuqN4QwfDd6wsimkTJ2Wmho&fromMint=So11111111111111111111111111111111111111112&toMint=AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY&amount=1000000&slippage=100&dex=raydium' \
     --header 'X-API-KEY: YOUR_API_KEY' \
     --header 'accept: text/plain'

Response: A base64-encoded string representing the transaction that can be submitted to the Solana blockchain to perform the token swap. And a signers array which need to sign the transaction if any signer is returned.

Example Response:

{

  success: true,
  data: {
    base64Transaction: 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAKELvUIWRj2+QwSFsGEVzQxl4lM9koJ/iMkyhSRouXSHmXGS6ZKuy9BQlCZgJCc/q9AamonfXyOdKBm+O7fq0xtHqEioebLEkVhdTklo9+StSnhMYJoahNuRE8d4Lw6Uu5sK0R5qT8KUSk+oJRvvgVQm4b+yjGtmRmd2B8atn1ZqZGv/WzzU9ACvS8D5MZNuBXL2QOlNfEcyD3nNqF/VSp69dnzwveGsz5us0Hm4RKfA8KDoGzW7Dwzn/am+oS7/XZvwMGRm/lIRcy/+ytunLDm+e8jOW7xfcSayxDmzpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACMlyWPTiSJ8bs9ECkUjg2DC1oTmdr/EIQEjnvY2+n4WeYA5qaEPK+TOXflxwBQ7yVxofIXiyoix0mx7wp/3nivBt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKkGgKNBk6bVgnANHUjfCW2aQbdKaoWjQGWDm7hNGLRgOwFW4PaTZlrPRNsVaL8XW6pRicuX9dL/O2VdK7b9bRiwOoZeae4PVIDKvPZjV+TcLxjVjUXB6nSJ+zcj2Xk8cqYGp9UXGSxcUSGMyUw9SvF/WNruCJuh/UTj29mKAAAAAKzxNusB/BxOiD0jyLWESrWaN/Zq3VfF6aw7U+BZ01xk/zxls7ZzKbjLpoMRs1YCjRyRUy+9x63jjmyyxmZCtWAFBgAFAmwjAgAGAAkDQEIPAAAAAAAHAgABDAIAAAAQ6wkAAAAAAAgGAAIACQcKAAsNDA0DCQQFAgAHCg4PDCT4xp6R4XWHyBgAAABmBj0SAdrr6mUecakAAAAAwCcJAAAAAAAA',
    signers: []
  }
}