Wallet Operation
Check Balance Token

Check Balance Token

API Documentation: Check Balance Token

Overview

This API endpoint allows you to check your token balance from a particular token address in a blockchain network

  • HTTP Method: POST
  • Endpoint: /api/v1/wallet/balance-token

Request Body Parameters

  • secret (optional): Secret from the end-user device, created when creating/importing the wallet.
  • network (required if chainId empty): The network used for transactions.
  • chainId (required if network empty): The chain ID of the network used for transactions.
  • tokenAddress (required): Address of the token.

Example Request Body

{
    "secret": YOUR_SECRET,
    "network": "ethereum",
    "chainId": "1",
    "tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}

Request

Request Headers

  • Authorization (required): JWT token which was generated when user login and do not have an MPC wallet.
  • x-client-secret (required): Client secret which was generated when register in Xellar MPC API Service Dashboard.

Example Request Syntax

curl -X POST -H "Content-Type: application/json" -H "x-client-secret: $YOUR_CLIENT_SECRET" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -d '{
    "secret": "'$YOUR_SECRET'",
    "network": "ethereum",
    "chainId": "1",
    "tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}' https://mpc.xellar.co/api/v1/wallet/balance-token

Response

The response will include a JSON object with the following properties:

  • status (number): The HTTP status code of the response (e.g., 200 for success).
  • message (string): A message providing additional information about the operation.
  • data (object): An object containing the wallet address, balance & token symbol information.

Example Response

{
    "status": 200,
    "message": "Check Token Balance is successfully",
    "data": {
        "balance": "90.0",
        "symbol": "WETH",
        "address": "0xBfE64B4b628E0998A03e2522B051Cf1B4661c964"
    }
}