Skip to main content
GET
/
v1
/
api-keys
/
sub-keys
/
{key_id}
/
usage
Get Sub-Key Usage
curl --request GET \
  --url https://api.io.solutions/v1/api-keys/sub-keys/{key_id}/usage \
  --header 'Authorization: Bearer <token>' \
  --header 'x-api-key: <x-api-key>'
import requests

url = "https://api.io.solutions/v1/api-keys/sub-keys/{key_id}/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/{key_id}/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/{key_id}/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/{key_id}/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/{key_id}/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/{key_id}/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"
  }
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}
Use this endpoint to monitor whether a specific sub-key is approaching or has exceeded its credit limit. The remaining_credit field is null when no credit_limit has been configured for the key — in that case, the key is only bounded by the admin’s overall account balance.
Credit usage reflects settled payments processed by the billing pipeline. There may be a short lag (typically under a minute) between a completed inference call and the usage appearing here.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Headers

x-api-key
string
required

Admin API key that owns the sub-key. Admin API key (io.net Intelligence)

Path Parameters

key_id
string<uuid>
required

UUID of the sub-key to inspect.

Response

Successful Response

status
string
Example:

"succeeded"

data
KeyUsageData · object