# Usage

What a key spent on web calls.

Reports what the calling key spent on web calls, by day, by endpoint, or both. Days are UTC, the range is at most 400 days, and calls appear within a minute. The report never contains the query.

### What is charged

Free. It counts towards the rate limit.

## Request

```
GET https://api.websearch.fast/v1/web/usage
```

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string |  |  |
| `to` | string |  |  |
| `group_by` | string |  | One of `day`, `endpoint`, `day_endpoint`. Default `day`. |

### Example request

curl:

```bash
curl "https://api.websearch.fast/v1/web/usage?from=2026-11-01&to=2026-11-28&group_by=endpoint" \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY"
```

Python:

```python
import os
import httpx

response = httpx.get(
    "https://api.websearch.fast/v1/web/usage",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    params={
        "from": "2026-11-01",
        "to": "2026-11-28",
        "group_by": "endpoint",
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

TypeScript:

```typescript
const response = await fetch("https://api.websearch.fast/v1/web/usage?from=2026-11-01&to=2026-11-28&group_by=endpoint", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
```

### Response fields

Usage of the calling key.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | Always `web.usage`. |
| `request_id` | string | yes | Same as the X-Request-Id header. |
| `created` | integer | yes | Unix seconds (UTC). |
| `from` | string | yes | Date YYYY-MM-DD (UTC). |
| `to` | string | yes | Date YYYY-MM-DD (UTC). |
| `group_by` | string |  | The grouping of data, as requested. One of `day`, `endpoint`, `day_endpoint`. |
| `totals` | object | yes |  |
| `totals.calls` | integer | yes |  |
| `totals.charged_calls` | integer | yes |  |
| `data` | array of object | yes |  |
| `data.day` | string |  | Date YYYY-MM-DD (UTC). |
| `data.endpoint` | string |  |  |
| `data.calls` | integer | yes |  |
| `data.charged_calls` | integer | yes |  |
| `pricing` | object |  | What a paid call costs now. Present only while the site has a valid price; the same for every key, also for administrator preview keys, whose calls stay free. A call costs the sum of weight times units in credits, at price_per_1000_credits_usd per 1,000 credits. |
| `pricing.price_per_1000_credits_usd` | number | yes | Above 0. |
| `pricing.weights` | object | yes | Credit weight of each billing unit the endpoints deliver (section 6.2), such as search_web, content_page, fetch_page, fetch_pdf_pages, geocode and reverse_geocode. |

### Errors

| Status | Codes |
| --- | --- |
| `400` | `invalid_request`, `invalid_url`, `invalid_schema` or `invalid_image`. Not charged. |
| `401` | `invalid_token`. Not charged. |
| `403` | `pre_consume_token_quota_failed` (the key's own spending limit), `access_denied`, `web_not_allowed` or `model_not_in_plan` (customer keys while plans cannot include the web tools). Not charged. |
| `404` | `not_found` or `invalid_endpoint`. Not charged. |
| `413` | `read_request_body_failed`: the request body is over the limit. Not charged. |
| `429` | `rate_limited`, `concurrency_limited`, `api_key_temporarily_frozen`, or the failure guard. Not charged. |
| `500` | `internal_error`. Not charged. |
| `501` | `api_not_implemented`: the endpoint, type or option has not shipped. Not charged. |
| `503` | `source_unavailable`, `web_api_disabled`, `token_cache_busy` or `billing_busy` (the charge could not be prepared in time; retry after Retry-After). Not charged. |
| `504` | timeout. Not charged. |
