<!-- https://pricto.dev/docs/api/get-usage · Spanish version: https://pricto.dev/docs/api/get-usage.md -->

# Credits consumed, grouped by day, operation, channel or key

`GET https://pricto.dev/v1/usage`

Credits consumed, grouped by day, operation, channel or key

| Credits | MCP |
|---|---|
| 0 | — |

## Parameters

| Parameter | In | Type | Description |
|---|---|---|---|
| `from` | query | `string (date)` | Start date, inclusive. Defaults to 90 days before `to`. |
| `to` | query | `string (date)` | End date, inclusive. Defaults to today. |
| `group_by` | query | `string` |  Valores / values: `day`, `operation`, `channel`, `key`. Default: `day`. |

## Response

`200` Usage rows.

| Field | Type | Description |
|---|---|---|
| `data` **required** | `UsageRow[]` |  |
| `data[].key` **required** | `string` | Group value (a date, an operation, a channel or a key ID). |
| `data[].credits` **required** | `number` |  |
| `data[].requests` **required** | `integer` |  |
| `meta` **required** | `Meta` |  |

`meta` carries the cost, the source line to quote, the language, the currency and notices (see [Conventions](/docs/convenciones)).

## Errors

- [`unauthorized`](/docs/errores#unauthorized)

## Example

```bash
curl "https://pricto.dev/v1/usage?group_by=operation" \
  -H "Authorization: Bearer sk_test_sandbox"
```
```python
import requests

API_KEY = "sk_test_sandbox"

r = requests.get(
    "https://pricto.dev/v1/usage",
    params={"group_by": "operation"},
    headers={"Authorization": f"Bearer {API_KEY}"},
)
print(r.status_code, r.json())
```
```js
const API_KEY = "sk_test_sandbox";

const res = await fetch(`https://pricto.dev/v1/usage?${new URLSearchParams({"group_by":"operation"})}`, {
  headers: { Authorization: `Bearer ${API_KEY}` },
});
console.log(res.status, await res.json());
```

```json
{
  "data": [
    {
      "key": "search",
      "credits": 2,
      "requests": 2
    },
    {
      "key": "resolve",
      "credits": 1,
      "requests": 1
    },
    "… 3 más / more"
  ],
  "meta": {
    "request_id": "req_4fac7e2c5e2648f3842b",
    "credits_charged": 0,
    "credits_deduplicated": 0,
    "credits_remaining": 14988,
    "period_resets_at": "2026-11-01T00:00:00.000Z",
    "usage": {
      "credits_charged": 0,
      "credits_deduplicated": 0,
      "truncated": false,
      "truncated_reason": null,
      "dry_run": false,
      "units": {}
    },
    "lang": "es",
    "currency": "local",
    "data_as_of": "2026-10-23T11:00:00Z",
    "warnings": [
      "synthetic_data: datos sintéticos de ejemplo / synthetic sample data"
    ]
  }
}
```
