> ## Documentation Index
> Fetch the complete documentation index at: https://docs.60db.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Usage Logs

> View per-operation deduction history for all services (TTS, STT, LLM, Memory)

## Request

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token (JWT or API key)
</ParamField>

### Query Parameters

<ParamField query="page" type="number" default="1">
  Page number for pagination
</ParamField>

<ParamField query="limit" type="number" default="20">
  Items per page (max 100)
</ParamField>

<ParamField query="service_type" type="string">
  Filter by service type. Options: `TTS`, `STT`, `LLM`, `MEMORY_INGEST`, `MEMORY_EXTRACT`, `MEMORY_RECALL`, `MEMORY_CONTEXT`
</ParamField>

## Response

<ResponseField name="data.logs" type="array">
  Array of transaction log entries
</ResponseField>

<ResponseField name="data.logs[].hash_id" type="string">
  Unique transaction ID (UUID)
</ResponseField>

<ResponseField name="data.logs[].service_type" type="string">
  Service that was charged (TTS, STT, LLM, MEMORY\_INGEST, etc.)
</ResponseField>

<ResponseField name="data.logs[].amount_deducted" type="number">
  USD amount deducted (negative values indicate refunds)
</ResponseField>

<ResponseField name="data.logs[].units_used" type="number">
  Units consumed (characters for TTS, minutes for STT, tokens for LLM, bytes/queries for Memory)
</ResponseField>

<ResponseField name="data.logs[].previous_balance" type="number">
  Workspace balance before this operation
</ResponseField>

<ResponseField name="data.logs[].new_balance" type="number">
  Workspace balance after this operation
</ResponseField>

<ResponseField name="data.logs[].user_name" type="string">
  Name of the user who performed the operation
</ResponseField>

<ResponseField name="data.logs[].created_at" type="string">
  ISO 8601 timestamp
</ResponseField>

<ResponseField name="data.summary" type="array">
  Aggregated totals grouped by service type
</ResponseField>

<Note>
  Only the **workspace owner** can view usage logs. This endpoint is protected by `billing:manage` permission. Every API operation (TTS, STT, LLM, Memory) that costs money is logged here — this is your complete billing audit trail.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.60db.ai/billing/usage-logs?limit=10&service_type=TTS" \
    -H "Authorization: Bearer your-api-key"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.60db.ai/billing/usage-logs?limit=10&service_type=LLM',
    { headers: { 'Authorization': 'Bearer sk_your_api_key' } }
  );
  const data = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "message": "Usage logs fetched successfully",
    "data": {
      "logs": [
        {
          "hash_id": "84ffd09e-f5a4-42ea-a8fc-f50038392652",
          "service_type": "TTS",
          "amount_deducted": "0.00024000",
          "units_used": "12",
          "previous_balance": "9.50024000",
          "new_balance": "9.50000000",
          "metadata": {},
          "created_at": "2026-04-13T12:30:00.000Z",
          "user_name": "Kapil Karda",
          "user_email": "kapil@example.com"
        },
        {
          "hash_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "service_type": "LLM",
          "amount_deducted": "0.00150000",
          "units_used": "1500",
          "previous_balance": "9.50174000",
          "new_balance": "9.50024000",
          "metadata": {},
          "created_at": "2026-04-13T12:25:00.000Z",
          "user_name": "Kapil Karda",
          "user_email": "kapil@example.com"
        }
      ],
      "pagination": {
        "current_page": 1,
        "per_page": 10,
        "total_records": 42,
        "total_pages": 5
      },
      "summary": [
        { "service_type": "TTS", "count": 15, "total_cost": 0.0036, "total_units": 180 },
        { "service_type": "LLM", "count": 20, "total_cost": 0.03, "total_units": 30000 },
        { "service_type": "MEMORY_INGEST", "count": 7, "total_cost": 0.0007, "total_units": 7000 }
      ]
    }
  }
  ```
</ResponseExample>
