/ Docs

Spend Breakdown

The top groups by spend, each with its change against the previous period.

POST
/v1/orgs/{org_id}/spend/breakdown

Authorization

BearerAuth
AuthorizationBearer <token>

Botyard API key — see /docs/authentication.

In: header

Path Parameters

org_id*Org Id

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body of POST /spend/breakdown.

Response Body

application/json

curl -X POST "https://example.com/v1/orgs/string/spend/breakdown" \  -H "Content-Type: application/json" \  -d '{    "from": "2019-08-24T14:15:22Z",    "to": "2019-08-24T14:15:22Z",    "group_by": "bot"  }'
{
  "group_by": "bot",
  "rows": [
    {
      "key": {
        "kind": "bot",
        "bot_id": "string",
        "name": "string",
        "filter": {
          "kind": "condition",
          "field": "bot_id",
          "operator": "eq",
          "value": null
        }
      },
      "metrics": {
        "spend_usd": "string",
        "calls": 0,
        "unpriced_calls": 0,
        "native_turns": 0,
        "native_cost_per_turn_usd": "string",
        "cache_hit_rate": 0,
        "input_tokens": 0,
        "cached_input_tokens": 0,
        "cache_write_tokens": 0,
        "output_tokens": 0,
        "turns": 0,
        "cost_per_turn_usd": "string"
      },
      "change": {
        "previous_spend_usd": "string",
        "spend_change_usd": "string",
        "spend_change_ratio": 0
      }
    }
  ],
  "total_groups": 0,
  "next_cursor": "string",
  "truncated": true
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "error_code": "string",
  "errors": [
    {
      "pointer": "string",
      "detail": "string",
      "type": "string"
    }
  ],
  "trace_id": "string"
}