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

# Record Usage (Deprecated)

> Deprecated. Use POST /api/credits/consume instead.

<Warning>
  This endpoint is deprecated. Use [`POST /api/credits/consume`](/api-reference/credits/consume) instead — it deducts directly from the credit ledger, is idempotent via `idempotencyKey`, and returns the remaining balance in a single call.
</Warning>

Records a usage event for a tenant. Crovver accumulates these events and checks them against the plan's `limits` when `check-usage-limit` is called.

## Request Body

<ParamField body="requestingEntityId" type="string" required>
  The external tenant ID
</ParamField>

<ParamField body="metric" type="string" required>
  The metric to record (must match a key in `plan.limits`)
</ParamField>

<ParamField body="value" type="number">
  Amount to add. Defaults to `1`.
</ParamField>

<ParamField body="metadata" type="object">
  Optional context (e.g., which user triggered the event)
</ParamField>

## Authentication

Requires a **secret key** (`Authorization: Bearer sk_live_...`).

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.crovver.com/api/public/record-usage" \
    -H "Authorization: Bearer sk_live_..." \
    -H "Content-Type: application/json" \
    -d '{
      "requestingEntityId": "workspace_123",
      "metric": "api_calls",
      "value": 1,
      "metadata": { "endpoint": "/api/export", "userId": "user_456" }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "success": true,
    "data": {
      "message": "Usage recorded",
      "metric": "api_calls",
      "recordedValue": 1
    }
  }
  ```
</ResponseExample>
