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

# Reporting

> Track API usage and performance.

> [!NOTE]
>
> See also the [API reference](https://doc.agentfirst.dev/endpoints/reference/usage.md) for more detail.

## Service usage

**Agent First's** reporting service buckets and updates consumption, success, and latency metrics
at intervals of **1 hour**. The service has a RESTful interface that accepts `GET` requests at
**https\://‍api.agentfirst.dev/usage**.

### Authentication

You can access the service by including your secret API token in an `Authorization` header:

```http theme={null}
Authorization: Bearer [API token here]
```

Here's an example request that uses the [common Curl command](https://curl.se/):

```shell theme={null}
curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
'https://api.agentfirst.dev/usage'\
'?from=2025-12-24'\
'&to=2025-12-25'
```

> [!WARNING]
>
> This endpoint is rate limited; if you receive a `429` response, pause for the
> backoff time required by the `Retry-After` header before making another request.

### Report parameters

You should specify an ISO date or time range to generate a report:

```shell theme={null}
curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
'https://api.agentfirst.dev/usage'\
'?from=2025-12-24T18:00:00-06:00'\
'&to=2025-12-25T9:00:00-06:00'
```

The API will return a JSON array:

```json theme={null}
[{
  "email": "user@example.com",
  "from": "2025-12-25T00:00:00+00:00",
  "to": "2025-12-25T15:00:00+00:00",
  "service": "browser",
  "result": "success",
  "calls": 17208,
  "credits": 17208,
  "meanSecs": 6.78
}, {
  "email": "user@example.com",
  "from": "2025-12-25T01:00:00+00:00",
  "to": "2025-12-25T15:00:00+00:00",
  "service": "browser",
  "result": "failure",
  "calls": 18,
  "credits": 0,
  "meanSecs": 60.22
}]
```

Your report can optionally be filtered by one or more services:

```shell theme={null}
curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
'https://api.agentfirst.dev/usage'\
'?from=2025-12-24'\
'&to=2025-12-25'\
'&service=search'
```

> [accordion] View multiple-service example
>
> ```shell theme={null}
> curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
> 'https://api.agentfirst.dev/usage'\
> '?from=2025-12-24'\
> '&to=2025-12-25'\
> '&service=search'\
> '&service=ai'
> ```

You can also disaggregate the metrics:

```shell theme={null}
curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
'https://api.agentfirst.dev/usage'\
'?from=2025-12-24'\
'&to=2025-12-25'\
'&by=hour'
```

These are the request keys and values:

| Key | Required | Value |
| :- | :- | :- |
| `from` | ✅ | The [ISO datetime](https://www.w3.org/TR/NOTE-datetime) to select data starting from, inclusively |
| `to` | ✅ | The [ISO datetime](https://www.w3.org/TR/NOTE-datetime) to select data up to, inclusively |
| `email` | ⬜ | **\[Whitelabelers only]** The (case-insensitive) email address of the user to select data for; multiple email addresses can be provided by repeating the key; data for all email addresses is included by default |
| `service` | ⬜ | The service to select data for, `search`, `ai`, or `browser`; multiple services can be provided by repeating the key; data for all services is included by default |
| `by` | ⬜ | The time unit to group the data by, `hour`, `day` (planned), or `total`; `total` is the default unit |

These are the response keys and values:

| Key | Value |
| :- | :- |
| `email` | The email address of the user whose data is selected |
| `from` | The ISO datetime of the first datapoint |
| `to` | The ISO datetime of the last datapoint |
| `service` | The service included in the data, `search`, `ai`, or `browser` |
| `result` | The type of result included in the data, `success` or `failure` |
| `calls` | The number of API calls of the service and result type |
| `credits` | The number of credits consumed by the API calls |
| `meanSecs` | The average number of elapsed seconds of the API calls |

## Additional examples

### Email filtering

```shell theme={null}
curl -H "Authorization: Bearer $AGENT_FIRST_TOKEN" \
'https://api.agentfirst.dev/usage'\
'?from=2025-12-24'\
'&to=2025-12-25'\
'&email=alice@example.com'\
'&email=bob@example.com'\
'&email=carol@example.com'
```


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