Skip to main content

API Details

How to authenticate with the SafeSwap API, the chain names it accepts, and its endpoints.

API Keys​

All calls require an API Key. Contact us to get one. Include this API Key in the X-API-KEY header of all requests to our service.

Chain Options​

For API calls that require a chain name, the available chain names are: ETHEREUM, VECHAIN, BSC, MATIC, BASE, OPTIMISM.

API Endpoints​

  • GET /swaps: Returns swap details. Must contain a query string of ?swapId=345... or ?firstAddress=0x123...&firstChain=VECHAIN&secondAddress=0x234...&secondChain=ETHEREUM

  • POST /swaps: Create a Swap. Payload is

    SwapDetails {
    sourceChain: ChainName;
    sourceContractId: string; // prefixed with 0x
    sourceSender: string; // prefixed with 0x
    targetChain: ChainName;
    targetTokenAddress: string; // prefixed with 0x
    targetReceiver: string; // prefixed with 0x
    sourceFeeTx: string; // prefixed with 0x
    targetFeeTx: string; // prefixed with 0x
    }
  • GET /gas-estimates: Shows the required fees for a Swap. Requires query string of ?sourceChain=VECHAIN&targetChain=ETHEREUM

  • GET /tokens: Shows the available tokens for swapping.