Query User Balance
curl --request GET \
--url https://api.vidgo.ai/api/user/balance \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.vidgo.ai/api/user/balance"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.vidgo.ai/api/user/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.vidgo.ai/api/user/balance",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.vidgo.ai/api/user/balance"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.vidgo.ai/api/user/balance")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vidgo.ai/api/user/balance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"email": "[email protected]",
"credits_amount": 17276
}
}{
"code": 401,
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"code": 429,
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"code": 500,
"error": {
"message": "Internal server error",
"type": "server_error"
}
}Account Management
Query User Balance
Query the credit balance of your user account
GET
/
api
/
user
/
balance
Query User Balance
curl --request GET \
--url https://api.vidgo.ai/api/user/balance \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.vidgo.ai/api/user/balance"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.vidgo.ai/api/user/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.vidgo.ai/api/user/balance",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.vidgo.ai/api/user/balance"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.vidgo.ai/api/user/balance")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vidgo.ai/api/user/balance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"email": "[email protected]",
"credits_amount": 17276
}
}{
"code": 401,
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"code": 429,
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"code": 500,
"error": {
"message": "Internal server error",
"type": "server_error"
}
}Query User Balance
Query the current credit balance of your user account in real-time.Use Cases
Dashboard Display
Show real-time account balance in your application dashboard
Balance Alerts
Set up notifications when credits fall below a threshold
Recharge Reminders
Prompt users to top up credits before running out
Usage Tracking
Monitor credit consumption and track spending patterns
Important Notes
Real-time Balance: The balance returned reflects your current credit amount at the time of the request.
Rate Limiting: Avoid excessive polling. Cache the balance and refresh only when necessary (e.g., after completing a generation task).
Credit Deduction: Credits are deducted only when generation tasks complete successfully. Failed tasks do not consume credits.
Authorizations
All API endpoints require Bearer Token authentication
Get your API Key:
Visit the API Key Management Page to get your API Key
Add it to the request header:
Authorization: Bearer YOUR_API_KEY