Skip to content
SwapWalletDocs
فارسیGet an API key

Balances

A balance is how much of a token you can use right now. It leaves out amounts on hold, such as a withdrawal still being processed, and what sits inside your Boxes.

All of it can be swapped or spent. Withdrawing crypto is the one case where part of it may have to wait: see the 72-hour rule under Crypto withdrawals.

The Balance object

Your available balance of one token.

Attributes

  • tokenstringRequired

    Token symbol. IRT is the Toman.

  • amountMoneyRequired

    Available balance. 0 when you hold none.

    Show child attributesHide child attributes
    • numberdecimal stringRequired

      The amount as a decimal string. Trailing zeros are dropped, so 0.5, not 0.50.

    • unitstringRequired

      The token symbol, such as USDT, TON or BTC. IRT is the Toman; USD marks a value in US dollars.

The Balance object
{
  "token": "USDT",
  "amount": {
    "number": "1149.5",
    "unit": "USDT"
  }
}

List balances

GET/v2/user/balance

Returns your balance of every supported token, plus the Toman (IRT). Tokens you don’t hold are included with 0, and the order is fixed, not sorted by value.

Parameters

No parameters.

Returns

Returns an array of Balance objects in result.

GET/v2/user/balance
curl https://swapwallet.app/api/v2/user/balance \
  -H "Authorization: Bearer $SWAPWALLET_API_KEY"
Response
{
  "status": "OK",
  "result": [
    {
      "token": "ETH",
      "amount": {
        "number": "0",
        "unit": "ETH"
      }
    },
    {
      "token": "BNB",
      "amount": {
        "number": "0",
        "unit": "BNB"
      }
    },
    {
      "token": "TON",
      "amount": {
        "number": "106.677",
        "unit": "TON"
      }
    },
    {
      "token": "TRX",
      "amount": {
        "number": "340",
        "unit": "TRX"
      }
    },
    {
      "token": "BTC",
      "amount": {
        "number": "0.00215",
        "unit": "BTC"
      }
    },
    {
      "token": "USDT",
      "amount": {
        "number": "1149.5",
        "unit": "USDT"
      }
    },
    {
      "token": "IRT",
      "amount": {
        "number": "48250000",
        "unit": "IRT"
      }
    }
  ]
}

Retrieve a balance

GET/v2/user/balance/{token}

Returns your balance of one token. Cheaper than listing every balance when you only need one.

Path parameters

  • tokenstringRequired

    Token symbol, such as USDT, or IRT for the Toman.

Returns

Returns a Balance object in result.

Errors

  • 400INVALID_REQUEST_PARAMETER

    token isn’t a token SwapWallet knows.

GET/v2/user/balance/{token}
curl https://swapwallet.app/api/v2/user/balance/USDT \
  -H "Authorization: Bearer $SWAPWALLET_API_KEY"
Response
{
  "status": "OK",
  "result": {
    "token": "USDT",
    "amount": {
      "number": "1149.5",
      "unit": "USDT"
    }
  }
}