cURL
curl --request POST \
--url https://api.openformat.tech/v1/credit/balance \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"chain": "arbitrum-sepolia",
"token_id": "0xd1f09c70f6f2838a3ab6209c1465af68594667ec",
"user_id": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
}
'import requests
url = "https://api.openformat.tech/v1/credit/balance"
payload = {
"chain": "arbitrum-sepolia",
"token_id": "0xd1f09c70f6f2838a3ab6209c1465af68594667ec",
"user_id": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chain: 'arbitrum-sepolia',
token_id: '0xd1f09c70f6f2838a3ab6209c1465af68594667ec',
user_id: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
})
};
fetch('https://api.openformat.tech/v1/credit/balance', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openformat.tech/v1/credit/balance",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chain' => 'arbitrum-sepolia',
'token_id' => '0xd1f09c70f6f2838a3ab6209c1465af68594667ec',
'user_id' => '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.openformat.tech/v1/credit/balance"
payload := strings.NewReader("{\n \"chain\": \"arbitrum-sepolia\",\n \"token_id\": \"0xd1f09c70f6f2838a3ab6209c1465af68594667ec\",\n \"user_id\": \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.openformat.tech/v1/credit/balance")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chain\": \"arbitrum-sepolia\",\n \"token_id\": \"0xd1f09c70f6f2838a3ab6209c1465af68594667ec\",\n \"user_id\": \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openformat.tech/v1/credit/balance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain\": \"arbitrum-sepolia\",\n \"token_id\": \"0xd1f09c70f6f2838a3ab6209c1465af68594667ec\",\n \"user_id\": \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"balance": "12345123000000000000000",
"balance_formatted": "12345.123",
"decimals": 18
}
{
"success": false,
"error": {
"code": "validation_error",
"message": "Some parameters are invalid",
"issues": [
{
"code": "invalid_string",
"message": "Invalid Ethereum address",
"parameter": "user_id",
"path": "user_id"
}
]
}
}
{
"success": false,
"error": {
"code": "token_not_found",
"message": "Credit token not found"
}
}
Credit
Credit Balance
Show the Credit token balance of an account.
The returned response consists of 3 numbers:
-
balanceThe absolute amount of tokens the user has. -
decimalsThe number of decimals defined in the Credit token. -
balance_formattedThe user balance formatted to the token decimals. Example: for an balance of1000000000000000000with18decimalsbalance_formattedwould be1. All token amount parameters in this API use this formatted mechanism.
POST
/
credit
/
balance
cURL
curl --request POST \
--url https://api.openformat.tech/v1/credit/balance \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"chain": "arbitrum-sepolia",
"token_id": "0xd1f09c70f6f2838a3ab6209c1465af68594667ec",
"user_id": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
}
'import requests
url = "https://api.openformat.tech/v1/credit/balance"
payload = {
"chain": "arbitrum-sepolia",
"token_id": "0xd1f09c70f6f2838a3ab6209c1465af68594667ec",
"user_id": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chain: 'arbitrum-sepolia',
token_id: '0xd1f09c70f6f2838a3ab6209c1465af68594667ec',
user_id: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
})
};
fetch('https://api.openformat.tech/v1/credit/balance', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openformat.tech/v1/credit/balance",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chain' => 'arbitrum-sepolia',
'token_id' => '0xd1f09c70f6f2838a3ab6209c1465af68594667ec',
'user_id' => '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.openformat.tech/v1/credit/balance"
payload := strings.NewReader("{\n \"chain\": \"arbitrum-sepolia\",\n \"token_id\": \"0xd1f09c70f6f2838a3ab6209c1465af68594667ec\",\n \"user_id\": \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.openformat.tech/v1/credit/balance")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chain\": \"arbitrum-sepolia\",\n \"token_id\": \"0xd1f09c70f6f2838a3ab6209c1465af68594667ec\",\n \"user_id\": \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openformat.tech/v1/credit/balance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain\": \"arbitrum-sepolia\",\n \"token_id\": \"0xd1f09c70f6f2838a3ab6209c1465af68594667ec\",\n \"user_id\": \"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"balance": "12345123000000000000000",
"balance_formatted": "12345.123",
"decimals": 18
}
{
"success": false,
"error": {
"code": "validation_error",
"message": "Some parameters are invalid",
"issues": [
{
"code": "invalid_string",
"message": "Invalid Ethereum address",
"parameter": "user_id",
"path": "user_id"
}
]
}
}
{
"success": false,
"error": {
"code": "token_not_found",
"message": "Credit token not found"
}
}
{
"success": true,
"balance": "12345123000000000000000",
"balance_formatted": "12345.123",
"decimals": 18
}
{
"success": false,
"error": {
"code": "validation_error",
"message": "Some parameters are invalid",
"issues": [
{
"code": "invalid_string",
"message": "Invalid Ethereum address",
"parameter": "user_id",
"path": "user_id"
}
]
}
}
{
"success": false,
"error": {
"code": "token_not_found",
"message": "Credit token not found"
}
}
Authorizations
Body
application/json
Blockchain network to use
Required string length:
1 - 255Example:
"arbitrum-sepolia"
Ethereum address of the credit token
Example:
"0xd1f09c70f6f2838a3ab6209c1465af68594667ec"
Ethereum address of the user account
Example:
"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
Response
Credit Balance
⌘I