Endpoints
Get Usage
Retrieve your account usage statistics
GET
/
api
/
v1
/
account
/
usage
Get Usage
curl --request GET \
--url https://sunor.cc/api/v1/account/usage \
--header 'x-api-key: <x-api-key>'import requests
url = "https://sunor.cc/api/v1/account/usage"
headers = {"x-api-key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://sunor.cc/api/v1/account/usage', 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://sunor.cc/api/v1/account/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <x-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"
"net/http"
"io"
)
func main() {
url := "https://sunor.cc/api/v1/account/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sunor.cc/api/v1/account/usage")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sunor.cc/api/v1/account/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"code": 123,
"data": {
"tasks_created": 123,
"credits_used": 123,
"credits_topped_up": 123
}
}Get Usage
Retrieve aggregate usage statistics for your account, including total tasks created and credits consumed.Request
GET /api/v1/account/usage
Headers
Your API key.
Response
HTTP status code (
200 on success).Example response
200
{
"code": 200,
"data": {
"tasks_created": 42,
"credits_used": 350,
"credits_topped_up": 1000
}
}
Code examples
curl https://sunor.cc/api/v1/account/usage \
-H "x-api-key: YOUR_API_KEY"
import requests
response = requests.get(
"https://sunor.cc/api/v1/account/usage",
headers={"x-api-key": "YOUR_API_KEY"},
)
usage = response.json()["data"]
print(f"Tasks created: {usage['tasks_created']}")
print(f"Credits used: {usage['credits_used']}")
print(f"Credits topped up: {usage['credits_topped_up']}")
const response = await fetch("https://sunor.cc/api/v1/account/usage", {
headers: { "x-api-key": "YOUR_API_KEY" },
});
const { data } = await response.json();
console.log(`Tasks created: ${data.tasks_created}`);
console.log(`Credits used: ${data.credits_used}`);
console.log(`Credits topped up: ${data.credits_topped_up}`);
Errors
| Status | Description |
|---|---|
401 | Missing or invalid API key |
500 | Internal server error |
⌘I
Get Usage
curl --request GET \
--url https://sunor.cc/api/v1/account/usage \
--header 'x-api-key: <x-api-key>'import requests
url = "https://sunor.cc/api/v1/account/usage"
headers = {"x-api-key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://sunor.cc/api/v1/account/usage', 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://sunor.cc/api/v1/account/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <x-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"
"net/http"
"io"
)
func main() {
url := "https://sunor.cc/api/v1/account/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sunor.cc/api/v1/account/usage")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sunor.cc/api/v1/account/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"code": 123,
"data": {
"tasks_created": 123,
"credits_used": 123,
"credits_topped_up": 123
}
}