# GET /get-usage: account type, credits and exports remaining

> GET /get-usage returns your LocalPipe account type, remaining credits and remaining Google Maps exports, or your balance on usage billing.
>
> Part of the LocalPipe API reference: https://www.localpipe.io/docs/get-usage (full reference in one file: https://www.localpipe.io/localpipe-api-docs.md, categories CSV: https://www.localpipe.io/localpipe-business-categories.csv)

## GET /get-usage (account type, credits and Google Maps exports)

Returns your account type, remaining credits and remaining Google Maps exports for the current billing cycle. Use it to check what you have left before submitting large jobs.

```bash
curl "https://uunrlffonnvmbsstkpze.supabase.co/functions/v1/get-usage" \
  -H "x-api-key: YOUR_API_KEY"
```

### Query Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| start_date | ISO date | current cycle start | Start of the usage window |
| end_date | ISO date | now | End of the usage window |

### Response (credit plan accounts)

```json
{
  "account_type": "credit_plan",
  "billing_mode": "credits",
  "plan": "growth",
  "period_start": "2026-10-01T00:00:00.000Z",
  "period_end": "2026-10-23T20:10:00.000Z",
  "credits_remaining": 7420,
  "credits_monthly_allowance": 10000,
  "business_exports_limit": 20000,
  "business_exports_used": 3150,
  "business_exports_remaining": 16850,
  "credits_used": 2580,
  "records_processed": 1900
}
```

| Field | Description |
|-------|-------------|
| account_type | `credit_plan` or `usage_billing`. Check this first. |
| credits_remaining | Credits left to spend on enrichment finds |
| credits_monthly_allowance | Credits granted per billing cycle |
| business_exports_remaining | Google Maps exports left for Google Maps business search results |
| business_exports_limit | Total Google Maps exports this cycle (including rollover) |

### Usage billing accounts

If `account_type` is `usage_billing`, you are billed in dollars from your prepaid balance, not in credits. **Ignore any credit or Google Maps export counts** for these accounts; they do not limit your usage. Use `usage_balance_cents` (your remaining balance) and `total_usage_spent_cents` instead.

```json
{
  "account_type": "usage_billing",
  "billing_mode": "usage",
  "plan": "usage",
  "usage_balance_cents": 4250,
  "total_usage_spent_cents": 18730
}
```

This endpoint is read-only and costs no credits.
