Skip to content

[NUM] Fetch NUM balance

To fetch NUM balance on ALL NETWORKS for a specific wallet, you can use the following API with your Capture Token:

API Endpoint: https://us-central1-numbers-protocol-api.cloudfunctions.net/fetch-num-all-networks

Cost: 0.01 NUM

POST /

Description:
This endpoint allows you to create a new wallet with the given address.

Headers:
Content-Type: application/json
Authorization: token YOUR_CAPTURE_TOKEN

Authentication:
The API requires a valid token for Authorization. 
You can pass it in the headers of the request using the following format: 
"Authorization: token YOUR_CAPTURE_TOKEN"

Request Body:
{
    "wallet": "0x1234567890abcdef1234567890abcdef12345678"
}

Examples:
curl -X POST https://us-central1-numbers-protocol-api.cloudfunctions.net/fetch-num-all-networks \
     -H "Content-Type: application/json" \
     -H "Authorization: token YOUR_CAPTURE_TOKEN" \
     -d '{"wallet": "0x1234567890abcdef1234567890abcdef12345678"}'

In the API call, the Request body needs to have a key-value pair as "wallet" and a valid wallet address as value. The API will return the NUM balance for the specified wallet. Please note, this API requires authorization with your Capture Token. Follow the instructions to register and acquire it.

More examples can be found below:

Python

import json
import requests

url = 'https://us-central1-numbers-protocol-api.cloudfunctions.net/fetch-num-all-networks'
headers = {
    'Authorization': 'token YOUR_CAPTURE_TOKEN',
    'Content-Type': 'application/json'
}
data = {"wallet": "0x1234567890abcdef1234567890abcdef12345678"}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.content)

JavaScript

const url = 'https://us-central1-numbers-protocol-api.cloudfunctions.net/fetch-num-all-networks';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': 'token 1bd90eba5b902e6fd05701f49a8d8a4bf814cfcf'
};
const body = JSON.stringify({ wallet: '0x1234567890abcdef1234567890abcdef12345678' });

fetch(url, { method: 'POST', headers, body })
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  })
  .catch((error) => {
    console.error(error);
  });