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

# Usage and retention

> Inspect actual API request totals without storing request bodies or scanning your media library.

The **API usage** chart shows 30 UTC days for your account's tokens in the selected workspace. It counts REST requests authenticated with a valid token, including requests subsequently denied by a permission check or rate limit. Invalid credentials, requests rejected before the token middleware, browser-session traffic and MCP calls are excluded.

## Counters

Requests, successful responses, client errors, server errors and accumulated request duration are aggregated by token and day. Sixteen counter partitions distribute concurrent writes for a single token. Studio does not store one analytics row per request, file contents, prompts, comment text, IP addresses or plaintext tokens.

The request counter is reserved before dispatch. If a process stops after admission, its request remains counted even if the outcome is unknown. Durations cover application dispatch until the response is prepared; they are not binary-stream transfer times. The chart is operational telemetry, not a billing ledger.

## Cache

The chart's data cache lasts ten seconds by default. Token revocation and authentication are checked independently of this display cache. No polling starts in unrelated library views.

```php theme={null}
// config/media-studio.php
'api' => [
    'enabled' => true,
    'path' => 'media-studio/rest/v1',
    'requests_per_minute' => 120,
    'max_token_days' => 90,
    'usage_cache_seconds' => 10, // 0 disables the display cache; maximum 60.
],
'cache' => [
    'store' => 'redis',
    'prefix' => 'fms',
    'catalog_ttl' => 300,
],
```

Cache keys include the workspace, current account, tenant and date range. The token table and usage counters use indexed queries. Chart responses contain 30 aggregate points, not the full request history.

## Retention

When API access is enabled, the Laravel scheduler runs the bounded cleanup command hourly:

```bash theme={null}
php artisan media-studio:api:prune
```

Each run removes at most 1,000 usage partitions older than 90 days and 500 token records expired more than 90 days ago. Run Laravel's scheduler continuously. For an accumulated backlog, invoke bounded batches repeatedly rather than one unbounded delete. Application-level retention does not remove historical database backups.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.