API Reference

Get / Swap

Returns a base64-encoded string representing the transaction that can be submitted to the Solana blockchain to perform the token swap.

OpenAPI definition

{
  "openapi": "3.1.0",
  "info": {
    "title": "swap",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.carbium.io/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/swap": {
      "get": {
        "summary": "Get / Swap",
        "description": "Returns a base64-encoded string representing the transaction that can be submitted to the Solana blockchain to perform the token swap.",
        "operationId": "swap",
        "parameters": [
          {
            "name": "owner",
            "in": "query",
            "description": "Wallet address of the user.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fromMint",
            "in": "query",
            "description": "Address of the token that is used buy the other token",
            "required": true,
            "schema": {
              "type": "string",
              "default": "So11111111111111111111111111111111111111112"
            }
          },
          {
            "name": "toMint",
            "in": "query",
            "description": "Receiving Address of token",
            "required": true,
            "schema": {
              "type": "string",
              "default": "AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Swap amount (in lamports)",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 100000000
            }
          },
          {
            "name": "slippage",
            "in": "query",
            "description": "Slippage Value (in BPS)",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 100
            }
          },
          {
            "name": "provider",
            "in": "query",
            "description": "Provider",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "meteora",
                "orca",
                "raydium",
                "meteora-dlmm",
                "pump-fun",
                "moonshot",
                "stabble",
                "printdex",
                "raydium-cpmm",
                "goosefx"
              ],
              "default": "raydium"
            }
          },
          {
            "name": "pool",
            "in": "query",
            "description": "Custom pool address for swapping.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "feeLamports",
            "in": "query",
            "description": "Fee amount for custom fee instruction (in lamports)",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "feeReceiver",
            "in": "query",
            "description": "Account which receives the custom fee (required if feeLamports is provided)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "priorityMicroLamports",
            "in": "query",
            "description": "Transaction compute unit price used for prioritization fees",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "mevSafe",
            "in": "query",
            "description": "If true, the swap transaction will include an instruction for jito tip",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "gasless",
            "in": "query",
            "description": "If true, the swap transaction will be gasless (only valid if output token is SOL))",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": "{\n  success: true,\n  data: 'AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABD0HvgDTnMj7oCb7XRWjr8EcqwXoiQHmn/ZVj61zjfisGtMf2Efd0X1fBj+G9OM4t0DxYdiHukzsQoBixkMgGgAIACBDrHlujzDywOvtL/aA7nvfdqMa9N/GtqQh0drycpfGTfamE39H++vZd2nBM3mx0lJGFbp2zz7AuLkLXKUETnjuzGS6ZKuy9BQlCZgJCc/q9AamonfXyOdKBm+O7fq0xtHov7jPq31TYjNawXQqY9/kn37kPyaqH38oxeV0y9qCw8kXxBlEoW1obhUfQ52BC3j+fZe6i2A829rXSxqagK+nFiBGb5YUGf5F9G9ATB0zJh1LP+QM/rS4rNBjnjBuL1TLLc9Z7V0rHQRDiYePSm+Y6Fs40YRb6dVhQL0/bF+hP46vwexAnYKCEOQRVEUO0d1oh9AaSJMetxLID3/q2+A3MAwZGb+UhFzL/7K26csOb57yM5bvF9xJrLEObOkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpBpuIV/6rgYT7aH9jRhjANdrEOdwa6ztVmKDwAAAAAAEGp9UXGSxcUSGMyUw9SvF/WNruCJuh/UTj29mKAAAAAAaAo0GTptWCcA0dSN8JbZpBt0pqhaNAZYObuE0YtGA7DgNoX46QpFPkWBIcZvWnau3HcGqhHIL4qpUqjyt4ealeuOomIkw9NsPobNo9lNT9km+OLGWDzci5Ykc6xb8hSmxupNjeYPwIixlRUhC6hnasX5VYV1KMzrqlfj1Z77oVBggABQKagQEACAAJA0BCDwAAAAAACQIAAgwCAAAAIKEHAAAAAAAJAgABNAAAAACQpCAAAAAAAKUAAAAAAAAABt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKkKBAELAAwBAQ0MDgoAAwEEBQYHBwcPNvjGnpHhdYfIKgAAAPjGnpHhdYfIoIYBAAAAAAChEgAAAAAAAFA7AQABAAAAAAAAAAAAAAABAQA='\n}"
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": "{ error: { message: 'No pool found' } }"
                  }
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": "{ error: { message: 'API Key not found' } }"
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}