Get Own Usage (Sub-Key Self-Service)
curl --request GET \
--url https://api.io.solutions/v1/api-keys/sub-keys/me/usage \
--header 'Authorization: Bearer <token>' \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.io.solutions/v1/api-keys/sub-keys/me/usage"
headers = {
"x-api-key": "<x-api-key>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', Authorization: 'Bearer <token>'}
};
fetch('https://api.io.solutions/v1/api-keys/sub-keys/me/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://api.io.solutions/v1/api-keys/sub-keys/me/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 => [
"Authorization: Bearer <token>",
"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://api.io.solutions/v1/api-keys/sub-keys/me/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
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.io.solutions/v1/api-keys/sub-keys/me/usage")
.header("x-api-key", "<x-api-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.io.solutions/v1/api-keys/sub-keys/me/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>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "succeeded",
"data": {
"key_id": "71775d2e-fbcc-4ef4-aa30-8aaeb82062c0",
"credit_used": 1.234,
"credit_limit": 10,
"remaining_credit": 8.766,
"credit_refresh_cycle": "monthly"
}
}Sub-API Keys
Get Own Usage (Sub-Key Self-Service)
Allows a sub-key to check its own credit status without exposing the admin key to the sub-key holder.
GET
/
v1
/
api-keys
/
sub-keys
/
me
/
usage
Get Own Usage (Sub-Key Self-Service)
curl --request GET \
--url https://api.io.solutions/v1/api-keys/sub-keys/me/usage \
--header 'Authorization: Bearer <token>' \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.io.solutions/v1/api-keys/sub-keys/me/usage"
headers = {
"x-api-key": "<x-api-key>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', Authorization: 'Bearer <token>'}
};
fetch('https://api.io.solutions/v1/api-keys/sub-keys/me/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://api.io.solutions/v1/api-keys/sub-keys/me/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 => [
"Authorization: Bearer <token>",
"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://api.io.solutions/v1/api-keys/sub-keys/me/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
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.io.solutions/v1/api-keys/sub-keys/me/usage")
.header("x-api-key", "<x-api-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.io.solutions/v1/api-keys/sub-keys/me/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>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "succeeded",
"data": {
"key_id": "71775d2e-fbcc-4ef4-aa30-8aaeb82062c0",
"credit_used": 1.234,
"credit_limit": 10,
"remaining_credit": 8.766,
"credit_refresh_cycle": "monthly"
}
}This endpoint is authenticated with the sub-key itself, not the admin key. It is intended for scenarios where sub-key holders need to monitor their own remaining credits programmatically.
Authenticating with an admin key returns 403 Forbidden. Use
GET /v1/api-keys/sub-keys/{key_id}/usage with the admin key to inspect a specific sub-key’s status.Typical use case
A service that holds a sub-key can call this endpoint periodically to determine how much credit remains before being blocked:curl "https://api.intelligence.io.solutions/v1/api-keys/sub-keys/me/usage" \
-H "x-api-key: $SUB_API_KEY"
{
"status": "succeeded",
"data": {
"key_id": "71775d2e-fbcc-4ef4-aa30-8aaeb82062c0",
"credit_used": 7.82,
"credit_limit": 10.0,
"remaining_credit": 2.18,
"credit_refresh_cycle": "monthly"
}
}
Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Headers
The sub-API key itself (not the admin key). Sub-API key
Was this page helpful?