Skip to main content
GET
https://agentgate.mynewapi.com
/
api
/
v1
/
usage
List Usage Records
curl --request GET \
  --url https://agentgate.mynewapi.com/api/v1/usage \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "data": [
    {
      "id": "<string>",
      "workOrderId": "<string>",
      "runId": "<string>",
      "iteration": 123,
      "model": "<string>",
      "inputTokens": 123,
      "outputTokens": 123,
      "cachedInputTokens": 123,
      "costUsd": 123,
      "durationMs": 123,
      "timestamp": "<string>"
    }
  ]
}

List Usage Records

Returns token usage records with optional filtering by work order, run, model, and date range.

Request

workOrderId
string
Filter by work order ID
runId
string
Filter by run ID
model
string
Filter by model name (e.g., claude-sonnet-4-20250514)
startDate
string
Start date filter (ISO 8601)
endDate
string
End date filter (ISO 8601)
limit
integer
default:"100"
Maximum number of records to return (1-1000)
offset
integer
default:"0"
Number of records to skip for pagination
curl "https://agentgate.mynewapi.com/api/v1/usage?limit=50&model=claude-sonnet-4-20250514" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

success
boolean
required
Indicates if the request was successful
data
array
required
Array of usage records

Example Response

{
  "success": true,
  "data": [
    {
      "id": "usage_abc123",
      "workOrderId": "wo_xyz789",
      "runId": "run_def456",
      "iteration": 1,
      "model": "claude-sonnet-4-20250514",
      "inputTokens": 15420,
      "outputTokens": 3250,
      "cachedInputTokens": 8000,
      "costUsd": 0.0523,
      "durationMs": 45230,
      "timestamp": "2024-01-15T10:30:00.000Z"
    },
    {
      "id": "usage_def456",
      "workOrderId": "wo_xyz789",
      "runId": "run_def456",
      "iteration": 2,
      "model": "claude-sonnet-4-20250514",
      "inputTokens": 18200,
      "outputTokens": 2100,
      "cachedInputTokens": 12000,
      "costUsd": 0.0412,
      "durationMs": 32100,
      "timestamp": "2024-01-15T10:32:15.000Z"
    }
  ]
}

Use Cases

  • Track token usage per work order
  • Analyze model costs over time
  • Audit execution history
  • Generate billing reports