/ Docs

Spend Summary

Totals for the range and for the previous, equally long range.

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

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/summary.

Response Body

application/json

curl -X POST "https://example.com/v1/orgs/string/spend/summary" \  -H "Content-Type: application/json" \  -d '{    "from": "2019-08-24T14:15:22Z",    "to": "2019-08-24T14:15:22Z"  }'
{
  "current": {
    "from": "2019-08-24T14:15:22Z",
    "to": "2019-08-24T14:15:22Z",
    "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"
    }
  },
  "previous": {
    "from": "2019-08-24T14:15:22Z",
    "to": "2019-08-24T14:15:22Z",
    "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
  }
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "error_code": "string",
  "errors": [
    {
      "pointer": "string",
      "detail": "string",
      "type": "string"
    }
  ],
  "trace_id": "string"
}