Analytics
Latest failure for an agent
Returns diagnostics for the most recent failed run of the specified agent. Useful when asking “Why did my agent fail?” without specifying a run ID.
GET
/
api
/
v1
/
analytics
/
agents
/
{agentId}
/
latest-failure
Get the most recent failed run for an agent
curl --request GET \
--url https://api.example.com/api/v1/analytics/agents/{agentId}/latest-failure \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/api/v1/analytics/agents/{agentId}/latest-failure"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/api/v1/analytics/agents/{agentId}/latest-failure', 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.example.com/api/v1/analytics/agents/{agentId}/latest-failure",
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://api.example.com/api/v1/analytics/agents/{agentId}/latest-failure"
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://api.example.com/api/v1/analytics/agents/{agentId}/latest-failure")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/analytics/agents/{agentId}/latest-failure")
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{
"runId": 123,
"agentId": 123,
"agentName": "<string>",
"status": 0,
"errorMessage": "<string>",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"runtimeSeconds": 123,
"stats": {
"dataCount": 123,
"inputCount": 123,
"errorCount": 123,
"pageCount": 123,
"exportCount": 123,
"traffic": 123
},
"possibleCauses": [
"<string>"
],
"suggestedActions": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Authorizations
API Key authorization header. Example: "Authorization: ApiKey {your-api-key}"
OAuth 2.0 Bearer token. Example: "Authorization: Bearer {access-token}"
Path Parameters
The ID of the agent
Response
Returns the run diagnostics
Response model for run diagnostics (why a run failed)
0 = Invalid; 1 = Running; 2 = Exporting; 3 = Starting; 4 = Queuing; 5 = Stopping; 6 = Failure; 7 = Failed; 8 = Stopped; 9 = Completed; 10 = Success; 11 = Skipped; 12 = Waiting
Available options:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 Run statistics
Show child attributes
Show child attributes
Possible failure reasons based on status and error message
Suggested actions to resolve the issue