Get Work Order Usage
curl --request GET \
--url https://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}', 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://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}",
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://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}"
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://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}")
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{
"success": true,
"data": {
"totalInputTokens": 123,
"totalOutputTokens": 123,
"totalCachedInputTokens": 123,
"totalCostUsd": 123,
"executionCount": 123,
"workOrderCount": 123,
"totalDurationMs": 123,
"byModel": {},
"periodStart": "<string>",
"periodEnd": "<string>"
}
}Usage
Get Work Order Usage
Get usage summary for a specific work order
GET
/
api
/
v1
/
usage
/
work-orders
/
{workOrderId}
Get Work Order Usage
curl --request GET \
--url https://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}', 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://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}",
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://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}"
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://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agentgate.mynewapi.com/api/v1/usage/work-orders/{workOrderId}")
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{
"success": true,
"data": {
"totalInputTokens": 123,
"totalOutputTokens": 123,
"totalCachedInputTokens": 123,
"totalCostUsd": 123,
"executionCount": 123,
"workOrderCount": 123,
"totalDurationMs": 123,
"byModel": {},
"periodStart": "<string>",
"periodEnd": "<string>"
}
}Get Work Order Usage
Returns aggregated usage summary for a specific work order.Request
The work order ID to get usage for
curl https://agentgate.mynewapi.com/api/v1/usage/work-orders/wo_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"
Response
Indicates if the request was successful
Work order usage summary
Show properties
Show properties
Total input tokens used
Total output tokens used
Total cached input tokens
Total estimated cost in USD
Number of iterations/executions
Always 1 for single work order
Total execution duration in milliseconds
Usage breakdown by model
First execution timestamp
Last execution timestamp
Example Response
{
"success": true,
"data": {
"totalInputTokens": 45200,
"totalOutputTokens": 8500,
"totalCachedInputTokens": 28000,
"totalCostUsd": 1.23,
"executionCount": 3,
"workOrderCount": 1,
"totalDurationMs": 125000,
"byModel": {
"claude-sonnet-4-20250514": {
"inputTokens": 45200,
"outputTokens": 8500,
"cachedInputTokens": 28000,
"costUsd": 1.23,
"executionCount": 3
}
},
"periodStart": "2024-01-15T10:30:00.000Z",
"periodEnd": "2024-01-15T10:35:25.000Z"
}
}
Use Cases
- Track costs per task
- Analyze iteration efficiency
- Compare work order complexity
- Per-task billing attribution
⌘I