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

# Usage & Billing

> Usage metrics, plan limits, and billing management endpoints

# Usage & Billing

## Get Usage Summary

Retrieve current usage metrics with plan limits and warnings.

<CodeGroup>
  ```bash curl theme={null}
  curl -H "Authorization: Bearer thig_YOUR_KEY" \
    https://app.thig.ai/api/usage
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://app.thig.ai/api/usage', {
    headers: { 'Authorization': 'Bearer thig_YOUR_KEY' }
  });
  const { usage, warnings, plan } = await res.json();
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "plan": {
    "name": "Professional",
    "tier": "professional"
  },
  "usage": {
    "members": { "current": 5, "limit": 25, "percentageUsed": 20 },
    "projects": { "current": 12, "limit": 100, "percentageUsed": 12 },
    "ai_tokens": { "current": 125000, "limit": 500000, "percentageUsed": 25 },
    "templates": { "current": 8, "limit": 50, "percentageUsed": 16 },
    "api_keys": { "current": 2, "limit": 10, "percentageUsed": 20 },
    "webhooks": { "current": 1, "limit": 10, "percentageUsed": 10 },
    "document_uploads": { "current": 15, "limit": 100, "percentageUsed": 15 },
    "transcription_minutes": { "current": 10, "limit": 60, "percentageUsed": 17 }
  },
  "warnings": [
    {
      "metric": "ai_tokens",
      "message": "You've used 85% of your AI tokens limit",
      "level": "warning",
      "percentage": 85
    }
  ]
}
```

A `limit` of `-1` means unlimited.

## Billing Endpoints

### Get Pricing Plans

```bash theme={null}
curl https://app.thig.ai/api/pricing
```

Returns all available pricing tiers with features and product IDs.

### Create Checkout Session

```bash theme={null}
curl -X POST https://app.thig.ai/api/billing/checkout \
  -H "Authorization: Bearer thig_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"planId": "professional", "interval": "monthly"}'
```

Returns `{ checkout_url }` — redirect the user to complete payment.

### Get Billing Portal

```bash theme={null}
curl -X POST https://app.thig.ai/api/billing/portal \
  -H "Authorization: Bearer thig_YOUR_KEY"
```

Returns `{ link }` — redirect to the Dodo Payments billing portal for invoice management and cancellation.
