curl --request GET \
--url https://service.abundly.ai/workspaceapi/agent-usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://service.abundly.ai/workspaceapi/agent-usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://service.abundly.ai/workspaceapi/agent-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://service.abundly.ai/workspaceapi/agent-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>"
],
]);
$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://service.abundly.ai/workspaceapi/agent-usage"
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://service.abundly.ai/workspaceapi/agent-usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://service.abundly.ai/workspaceapi/agent-usage")
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{
"period": {
"startDate": "<string>",
"endDate": "<string>",
"previousStartDate": "<string>",
"previousEndDate": "<string>"
},
"rows": [
{
"agentId": "<string>",
"name": "<string>",
"adminUserIds": [
"<string>"
],
"enabled": true,
"keyMetrics": [
{
"name": "<string>",
"count": 123,
"previousCount": 123,
"valueCount": 123,
"daily": [
{
"date": "<string>",
"count": 123,
"valueSum": 123
}
],
"measurement": {
"unit": "<string>",
"aggregation": "<string>"
},
"aggregate": 123,
"previousAggregate": 123
}
],
"activity": {
"count": 123,
"previousCount": 123,
"daily": [
{
"date": "<string>",
"count": 123
}
]
},
"credits": {
"used": 123,
"previousUsed": 123
},
"imageUrl": "<string>",
"teamId": "<string>",
"phase": "<string>",
"criticality": "<string>",
"description": "<string>",
"valueStatement": "<string>",
"tags": [
"<string>"
],
"isPrivate": true,
"createdAt": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Per-agent usage for a period
One row per agent, restricted and personal ones included (marked with isPrivate), with what it delivered (key metric counts, and the average or total for measured metrics), how much it was used (triggers & chats, with a daily series) and what it cost (credits), each alongside the same figure for the period of equal length immediately before. The period is the last days days (default 30) or a fixed startDate–endDate. This is the data behind the Usage › Agent usage table in the portal as a workspace admin sees it, and what its JSON export contains.
curl --request GET \
--url https://service.abundly.ai/workspaceapi/agent-usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://service.abundly.ai/workspaceapi/agent-usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://service.abundly.ai/workspaceapi/agent-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://service.abundly.ai/workspaceapi/agent-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>"
],
]);
$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://service.abundly.ai/workspaceapi/agent-usage"
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://service.abundly.ai/workspaceapi/agent-usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://service.abundly.ai/workspaceapi/agent-usage")
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{
"period": {
"startDate": "<string>",
"endDate": "<string>",
"previousStartDate": "<string>",
"previousEndDate": "<string>"
},
"rows": [
{
"agentId": "<string>",
"name": "<string>",
"adminUserIds": [
"<string>"
],
"enabled": true,
"keyMetrics": [
{
"name": "<string>",
"count": 123,
"previousCount": 123,
"valueCount": 123,
"daily": [
{
"date": "<string>",
"count": 123,
"valueSum": 123
}
],
"measurement": {
"unit": "<string>",
"aggregation": "<string>"
},
"aggregate": 123,
"previousAggregate": 123
}
],
"activity": {
"count": 123,
"previousCount": 123,
"daily": [
{
"date": "<string>",
"count": 123
}
]
},
"credits": {
"used": 123,
"previousUsed": 123
},
"imageUrl": "<string>",
"teamId": "<string>",
"phase": "<string>",
"criticality": "<string>",
"description": "<string>",
"valueStatement": "<string>",
"tags": [
"<string>"
],
"isPrivate": true,
"createdAt": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Workspace API key (wk_). GET endpoints require the Workspace read API scope, POST, PUT, PATCH and DELETE endpoints the Workspace write API scope, and sending or revoking invitations (POST and DELETE /workspaceapi/invites) the Invite members scope. A key stops working when it expires or is disabled.
Query Parameters
Lookback in days ending at endDate. Default 30. Ignored when startDate is given.
1 <= x <= 365ISO timestamp for a fixed period instead of a lookback.
ISO timestamp. Default now.
Response
Success. Empty result sets are also 200.

