curl --request GET \
--url https://service.abundly.ai/workspaceapi/agents/{agentId}/key-metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://service.abundly.ai/workspaceapi/agents/{agentId}/key-metrics"
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/agents/{agentId}/key-metrics', 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/agents/{agentId}/key-metrics",
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/agents/{agentId}/key-metrics"
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/agents/{agentId}/key-metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://service.abundly.ai/workspaceapi/agents/{agentId}/key-metrics")
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{
"agentId": "<string>",
"agentName": "<string>",
"period": {
"startDate": "<string>",
"endDate": "<string>"
},
"metrics": [
{
"name": "<string>",
"count": 123,
"totalCount": 123,
"valueCount": 123,
"previousCount": 123,
"recent": [
{
"id": "<string>",
"occurredAt": "<string>",
"value": 123,
"ref": "<string>",
"note": "<string>"
}
],
"description": "<string>",
"measurement": {
"unit": "<string>",
"aggregation": "average"
},
"lastRecordedAt": "<string>",
"aggregate": 123,
"previousAggregate": 123
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Get an agent's key metrics
The agent’s key metrics — the outcomes its owner chose to count — with the count for the period, the average or total for measured metrics, the same figures for the period of equal length before, and optionally the most recent records. Definitions live on the agent (keyMetrics on GET /agents/:agentId). The period is the last days days (default 30) or a fixed startDate–endDate.
curl --request GET \
--url https://service.abundly.ai/workspaceapi/agents/{agentId}/key-metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://service.abundly.ai/workspaceapi/agents/{agentId}/key-metrics"
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/agents/{agentId}/key-metrics', 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/agents/{agentId}/key-metrics",
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/agents/{agentId}/key-metrics"
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/agents/{agentId}/key-metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://service.abundly.ai/workspaceapi/agents/{agentId}/key-metrics")
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{
"agentId": "<string>",
"agentName": "<string>",
"period": {
"startDate": "<string>",
"endDate": "<string>"
},
"metrics": [
{
"name": "<string>",
"count": 123,
"totalCount": 123,
"valueCount": 123,
"previousCount": 123,
"recent": [
{
"id": "<string>",
"occurredAt": "<string>",
"value": 123,
"ref": "<string>",
"note": "<string>"
}
],
"description": "<string>",
"measurement": {
"unit": "<string>",
"aggregation": "average"
},
"lastRecordedAt": "<string>",
"aggregate": 123,
"previousAggregate": 123
}
]
}{
"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.
Path Parameters
The agent id.
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.
Recent records to include per metric (ref, note, value, when). Default 0.
0 <= x <= 500
