Atmos Protocol
  • Atmos Protocol
    • About Us
    • Official Links
    • Vision , Mission and Roadmap
  • Product Suite
    • Atmos Hyper-AMM
      • Introduction
      • Swap Features
        • Weighted Pools
        • Stable Pools
      • Liquidity Providers
      • Fees
      • Glossary
    • Atmos Launch
      • How does it work?
      • How to launch a token
      • How to participate
      • FAQ
    • Advanced Trading Strategies
      • Dollar Cost Averaging (DCA)
      • Limit Orders
    • Gamification and Rewards
      • 🎯Testnet Phase
      • 🚀Mainnet Season 1
      • âš¡Referral Program
  • Atmos Dao
    • Overview
    • Tokenomics
      • Governance
      • Distribution
      • Supply Schedule
  • Developer Resources
    • Tools and Integrations
      • Widgets
      • API & SDK
      • Supra Token List
    • Smart Contracts
  • Partnerships
    • Partner With Us
    • Brand Kit
  • Support
    • Risks And Best Practices
    • FAQ
  • Legal
    • Disclaimer
    • Privacy Policy
    • Media Press Kit
    • Terms Of Use
    • Audits
Powered by GitBook
On this page
  1. Developer Resources
  2. Tools and Integrations

API & SDK

PreviousWidgetsNextSupra Token List

Last updated 4 months ago

Swap tokens

post

Perform a token swap using the specified input and output tokens.

Body
amountInnumberRequiredExample: 1
inputTokenstringRequiredExample: 0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::test_usdc::TestUSDC
outputTokenstringRequiredExample: 0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::test_usdt::TestUSDT
Responses
200
Successful swap response.
application/json
post
POST /api/swap HTTP/1.1
Host: swap-backend-prod-340342993997.asia-south2.run.app
Content-Type: application/json
Accept: */*
Content-Length: 221

{
  "amountIn": 1,
  "inputToken": "0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::test_usdc::TestUSDC",
  "outputToken": "0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::test_usdt::TestUSDT"
}
200

Successful swap response.

{
  "status": "success",
  "data": {
    "inputToken": {
      "token": "0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::test_usdc::TestUSDC",
      "decimals": 6,
      "price": 1
    },
    "outputToken": {
      "token": "0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::test_usdt::TestUSDT",
      "decimals": 6,
      "price": 1
    },
    "inputAmount": 1,
    "inputAmountUSD": 1,
    "outputAmount": 0.97,
    "outputAmountUSD": 0.97,
    "route": [
      {
        "fromToken": "0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::test_usdc::TestUSDC",
        "toToken": "0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::test_eth::TestETH",
        "poolType": "0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::weighted_pool::WeightedPool<...>"
      }
    ],
    "txnData": {
      "function": "0x8ede5b689d5ac487c3ee48ceabe28ae061be74071c86ffe523b7f42acda2fcb7::entry::swap_exact_in_multihop",
      "typeArguments": [
        "text"
      ],
      "arguments": [
        "text"
      ]
    }
  }
}