Credits Balance
6/30/25Less than 1 minute
Credits Balance
Returns the current credit balance associated with your API key.
Before you begin
Obtain your API key from API Key Settings before making requests.
Overview
| Item | Value |
|---|---|
| Endpoint | POST /api/unwatermark/api/v1/get-credits-balance |
| Auth | ZF-API-KEY header |
| Credits | Free |
Request
Headers
| Name | Required | Value |
|---|---|---|
ZF-API-KEY | Yes | Your API key |
Example
HTML
<!DOCTYPE html>
<html lang="en">
<body>
<button onclick="send()">Get Credits Balance</button>
<pre id="out"></pre>
<script>
async function send() {
const res = await fetch(
'https://api.unwatermark.ai/api/unwatermark/api/v1/get-credits-balance',
{ method: 'POST', headers: { 'ZF-API-KEY': 'YOUR_API_KEY' } }
);
document.getElementById('out').textContent =
JSON.stringify(await res.json(), null, 2);
}
</script>
</body>
</html>Python
import requests
url = "https://api.unwatermark.ai/api/unwatermark/api/v1/get-credits-balance"
headers = {"ZF-API-KEY": "YOUR_API_KEY"}
response = requests.post(url, headers=headers)
print(response.json())Java
import okhttp3.*;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.unwatermark.ai/api/unwatermark/api/v1/get-credits-balance")
.post(RequestBody.create(null, new byte[0]))
.addHeader("ZF-API-KEY", "YOUR_API_KEY")
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}PHP
<?php
$url = "https://api.unwatermark.ai/api/unwatermark/api/v1/get-credits-balance";
$apiKey = "YOUR_API_KEY";
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["ZF-API-KEY: {$apiKey}"],
]);
$data = json_decode(curl_exec($curl), true);
curl_close($curl);
print_r($data);Response
Success (100000)
{
"code": 100000,
"message": {},
"result": {
"user_credits": "1234"
}
}Error (800002)
{
"code": 800002,
"message": {
"en": "User api key not exist.",
"zh": "çšæ·api keyäžććš"
},
"result": null
}Status Codes
| Code | Meaning |
|---|---|
100000 | Success |
800002 | API key not found |
