---
title: /availableBalance
slug: mihai-tests/availablebalance
createdAt: 2024-01-09T12:30:00.560Z
---

{
  "id": "8XE86hb-E5HOQuZlMq_32",
  "type": "api-oas-v2",
  "data": {
    "request": {
      "oAuthParameters": [],
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [
        {
          "kind": "required",
          "name": "account_id",
          "type": "integer",
          "example": 1,
          "description": "the account id used in this operation",
          "default": 1,
          "value": "6"
        },
        {
          "kind": "required",
          "name": "coin_types",
          "type": "array",
          "example": "[\"BTC\"]",
          "description": "the coin symbol used in this operation",
          "default": [
            "BTC"
          ],
          "schema": [],
          "itemType": "string",
          "customType": "string[]",
          "value": [
            "BTCeeee"
          ]
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "Request data for retrieving account coins and wallets.",
          "customType": "availableBalanceRequest",
          "schema": [
            {
              "name": "FunctionData",
              "kind": "optional",
              "type": "object",
              "description": "Contains the function-specific data.",
              "example": "",
              "schema": [
                {
                  "name": "AccountId",
                  "kind": "optional",
                  "type": "integer",
                  "description": "The ID of the user's account.",
                  "example": 1,
                  "default": 1
                },
                {
                  "name": "CoinsAndWallets",
                  "kind": "optional",
                  "type": "array",
                  "description": "List of coins and wallets to retrieve.",
                  "example": "",
                  "itemType": "object",
                  "customType": "object[]",
                  "schema": [
                    {
                      "name": "CoinType",
                      "kind": "optional",
                      "type": "string",
                      "description": "The type of cryptocurrency (e.g., BTC).",
                      "example": "BTC",
                      "default": "BTC"
                    }
                  ]
                }
              ]
            },
            {
              "name": "Meta",
              "kind": "optional",
              "type": "object",
              "modelRef": "#/components/schemas/MetaTokenavailableBalance",
              "customType": "MetaTokenavailableBalance",
              "schema": [
                {
                  "name": "FunctionName",
                  "kind": "optional",
                  "type": "string",
                  "description": "The Function to be called",
                  "example": "availableBalance",
                  "default": "availableBalance"
                },
                {
                  "name": "RandomData",
                  "kind": "optional",
                  "type": "string",
                  "description": "Random Data",
                  "example": "288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229",
                  "default": "288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229"
                },
                {
                  "name": "Destination",
                  "kind": "optional",
                  "type": "string",
                  "description": "Id of the server",
                  "example": "",
                  "default": "b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea"
                },
                {
                  "name": "Time",
                  "kind": "optional",
                  "type": "string",
                  "description": "UTC Time of execution",
                  "example": "2021-02-07T18:37:46.948Z",
                  "default": "2021-02-07T18:37:46.948Z"
                },
                {
                  "name": "Source",
                  "kind": "optional",
                  "type": "string",
                  "description": "User public key",
                  "example": "",
                  "default": "048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99"
                },
                {
                  "name": "AccessToken",
                  "kind": "optional",
                  "type": "string",
                  "description": "Token used for authentication purposes",
                  "example": "51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087",
                  "default": "51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087"
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/availableBalanceRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": []
    },
    "method": "POST",
    "url": "http://1.1.1.1/availableBalance",
    "servers": [
      {
        "url": "http://1.1.1.1/availableBalance"
      }
    ],
    "examples": {
      "selectedLanguageId": "1w50PXIVzXyOY5ZoFpTpK",
      "languages": [
        {
          "id": "1w50PXIVzXyOY5ZoFpTpK",
          "language": "curl",
          "code": "curl --location 'http://1.1.1.1/availableBalance?account_id=6&coin_types=BTCeeee' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\n  \"FunctionData\": {\n    \"AccountId\": 0,\n    \"CoinsAndWallets\": [\n      {\n        \"CoinType\": \"BTC\"\n      }\n    ]\n  },\n  \"Meta\": {\n    \"FunctionName\": \"availableBalance\",\n    \"RandomData\": \"288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229\",\n    \"Destination\": \"b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea\",\n    \"Time\": \"2021-02-07T18:37:46.948Z\",\n    \"Source\": \"048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99\",\n    \"AccessToken\": \"51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087\"\n  }\n}'"
        },
        {
          "id": "u7w9CE82f4MSfwlHEakwy",
          "language": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Accept\", \"application/json\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"FunctionData\": {\n      \"AccountId\": 0,\n      \"CoinsAndWallets\": [\n         {\n            \"CoinType\": \"BTC\"\n         }\n      ]\n   },\n   \"Meta\": {\n      \"FunctionName\": \"availableBalance\",\n      \"RandomData\": \"288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229\",\n      \"Destination\": \"b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea\",\n      \"Time\": \"2021-02-07T18:37:46.948Z\",\n      \"Source\": \"048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99\",\n      \"AccessToken\": \"51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087\"\n   }\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"http://1.1.1.1/availableBalance?account_id=6&coin_types=BTCeeee\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "lwPVPaaHWYASeVxu06qKK",
          "language": "ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"http://1.1.1.1/availableBalance?account_id=6&coin_types=BTCeeee\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"FunctionData\": {\n      \"AccountId\": 0,\n      \"CoinsAndWallets\": [\n         {\n            \"CoinType\": \"BTC\"\n         }\n      ]\n   },\n   \"Meta\": {\n      \"FunctionName\": \"availableBalance\",\n      \"RandomData\": \"288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229\",\n      \"Destination\": \"b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea\",\n      \"Time\": \"2021-02-07T18:37:46.948Z\",\n      \"Source\": \"048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99\",\n      \"AccessToken\": \"51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087\"\n   }\n})\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "N3RFZSUE4psONL0-rbBJa",
          "language": "python",
          "code": "import requests\nimport json\n\nurl = \"http://1.1.1.1/availableBalance?account_id=6&coin_types=BTCeeee\"\n\npayload = json.dumps({\n   \"FunctionData\": {\n      \"AccountId\": 0,\n      \"CoinsAndWallets\": [\n         {\n            \"CoinType\": \"BTC\"\n         }\n      ]\n   },\n   \"Meta\": {\n      \"FunctionName\": \"availableBalance\",\n      \"RandomData\": \"288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229\",\n      \"Destination\": \"b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea\",\n      \"Time\": \"2021-02-07T18:37:46.948Z\",\n      \"Source\": \"048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99\",\n      \"AccessToken\": \"51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087\"\n   }\n})\nheaders = {\n   'Accept': 'application/json',\n   'Content-Type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ]
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// success\n{\n  \"FunctionData\": {\n    \"Balances\": [\n      {\n        \"Balances\": [\n          {\n            \"Balance\": \"1000\",\n            \"DepositBalance\": \"0\",\n            \"Wallet\": \"HOT\"\n          }\n        ],\n        \"CoinType\": \"BTC\"\n      }\n    ]\n  },\n  \"Meta\": {\n    \"AccessToken\": \"a3e816b5bc04302d99da94705ec2309a4a63fe10d6aed3c5f6fc9e7ff27c6be6\",\n    \"Destination\": \"042c671aeb148d9b2bb4918399c4c925f3764248c5ab2d5194ab0f32664132834692699a75e7fafb5af35f183b7d8a68bdc3b3e6ebfaff8ab555b9a3caf8090622\",\n    \"Source\": \"df4b76a23067a9d782d09a7372ed526ec713cf6d771fac4dbdb9610f7af36d570a157eed76986b8e85afde12888d10d10bef461399e490f3d7e4db44cde1b6e355\",\n    \"Time\": \"2021-02-14 09:58:52.320\"\n  }\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "success",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "FunctionData",
                "kind": "optional",
                "type": "object",
                "example": "",
                "schema": [
                  {
                    "name": "Balances",
                    "kind": "optional",
                    "type": "array",
                    "description": "Array with the balance for each requested currency for the account",
                    "example": "",
                    "itemType": "object",
                    "customType": "object[]",
                    "schema": [
                      {
                        "name": "Balances",
                        "kind": "optional",
                        "type": "array",
                        "description": "Array with the balance for each requested currency for the account",
                        "example": "",
                        "itemType": "object",
                        "customType": "object[]",
                        "schema": [
                          {
                            "name": "Balance",
                            "kind": "optional",
                            "type": "string",
                            "description": "The Balance in this account's wallet",
                            "example": "1000",
                            "default": "1000"
                          },
                          {
                            "name": "DepositBalance",
                            "kind": "optional",
                            "type": "string",
                            "description": "The Deposit balance in this account's wallet",
                            "example": "0",
                            "default": "0"
                          },
                          {
                            "name": "Wallet",
                            "kind": "optional",
                            "type": "string",
                            "description": "MPC or Cold Wallet",
                            "example": "HOT",
                            "default": "HOT"
                          }
                        ]
                      },
                      {
                        "name": "CoinType",
                        "kind": "optional",
                        "type": "string",
                        "description": "The symbol of the coin used in this transaction",
                        "example": "BTC",
                        "default": "BTC"
                      }
                    ]
                  }
                ]
              },
              {
                "name": "Meta",
                "kind": "optional",
                "type": "object",
                "modelRef": "#/components/schemas/MetaResponse",
                "customType": "MetaResponse",
                "schema": [
                  {
                    "name": "AccessToken",
                    "kind": "optional",
                    "type": "string",
                    "description": "The new access token generated after this operation",
                    "example": "a3e816b5bc04302d99da94705ec2309a4a63fe10d6aed3c5f6fc9e7ff27c6be6",
                    "default": "a3e816b5bc04302d99da94705ec2309a4a63fe10d6aed3c5f6fc9e7ff27c6be6"
                  },
                  {
                    "name": "Destination",
                    "kind": "optional",
                    "type": "string",
                    "description": "Id of the server",
                    "example": "042c671aeb148d9b2bb4918399c4c925f3764248c5ab2d5194ab0f32664132834692699a75e7fafb5af35f183b7d8a68bdc3b3e6ebfaff8ab555b9a3caf8090622",
                    "default": "042c671aeb148d9b2bb4918399c4c925f3764248c5ab2d5194ab0f32664132834692699a75e7fafb5af35f183b7d8a68bdc3b3e6ebfaff8ab555b9a3caf8090622"
                  },
                  {
                    "name": "Source",
                    "kind": "optional",
                    "type": "string",
                    "description": "User public key",
                    "example": "df4b76a23067a9d782d09a7372ed526ec713cf6d771fac4dbdb9610f7af36d570a157eed76986b8e85afde12888d10d10bef461399e490f3d7e4db44cde1b6e355",
                    "default": "df4b76a23067a9d782d09a7372ed526ec713cf6d771fac4dbdb9610f7af36d570a157eed76986b8e85afde12888d10d10bef461399e490f3d7e4db44cde1b6e355"
                  },
                  {
                    "name": "Time",
                    "kind": "optional",
                    "type": "string",
                    "description": "UTC Time of execution",
                    "example": "2021-02-14 09:58:52.320",
                    "default": "2021-02-14 09:58:52.320"
                  }
                ]
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "description": "<ul>\n<li>\n<p>This function is used to request the available balance information for a specific account and one or more coin types.</p>\n</li>\n<li>\n<p>return - available balance in wallets for given account and coin symbol in smallest unit such as wei, satoshi, lovelace, drops, etc...</p>\n<p>example:</p>\n<p>availableBalance(1,[\"BTC\"])</p>\n</li>\n</ul>"
  },
  "children": [
    {
      "id": "JaZOtzjNQSD_-TkbgqVuV",
      "type": "bulleted-list",
      "children": [
        {
          "id": "Xq28shgdMsEXi-Ug_QjpE",
          "type": "list-item",
          "children": [
            {
              "id": "4aPS2eRffslwE4nQ_1of5",
              "type": "list-item-child",
              "children": [
                {
                  "text": "This function is used to request the available balance information for a specific account and one or more coin types."
                }
              ]
            }
          ]
        },
        {
          "id": "ajfnevXyWhfQN0cNkRIDP",
          "type": "list-item",
          "children": [
            {
              "id": "2MIaYjgA6IxX1bYo598in",
              "type": "list-item-child",
              "children": [
                {
                  "text": "return - available balance in wallets for given account and coin symbol in smallest unit such as wei, satoshi, lovelace, drops, etc..."
                }
              ]
            },
            {
              "id": "iaCgJDQxfP-X1exs0_vip",
              "type": "list-item-child",
              "children": [
                {
                  "text": "example:"
                }
              ]
            },
            {
              "id": "cev7ZLGBwB39RDZwWTmKb",
              "type": "list-item-child",
              "children": [
                {
                  "text": "availableBalance(1,[\"BTC\"])"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}