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

# Metrics

> Get and submit metrics for services

# Metrics API

Get peak metrics for a service or submit new metrics data.

***

## GET /api/metrics

Retrieve peak metrics (24-hour and all-time) for a specific service.

### Query Parameters

<ParamField query="slug" type="string" required>
  The service slug to get metrics for
</ParamField>

### Response

<ResponseField name="top24" type="number">
  Peak online count in the last 24 hours
</ResponseField>

<ResponseField name="topAll" type="number">
  All-time peak online count
</ResponseField>

### Example Request

```bash theme={null}
curl -X GET "https://www.orcrev.fit/api/metrics?slug=example-service"
```

### Example Response

```json theme={null}
{
  "top24": 5420,
  "topAll": 12850
}
```

***

## POST /api/metrics

Submit metrics data for a service. Used by service integrations to report online counts.

### Request Body

<ParamField body="slug" type="string" required>
  Service identifier (1-64 alphanumeric characters, hyphens, underscores)
</ParamField>

<ParamField body="online" type="number">
  Current online player count (0 to 1,000,000)
</ParamField>

<ParamField body="success" type="boolean">
  Whether the service check was successful
</ParamField>

### Example Request

```bash theme={null}
curl -X POST "https://www.orcrev.fit/api/metrics" \
  -H "Content-Type: application/json" \
  -d '{"slug": "example-service", "online": 1250}'
```

### Response

```json theme={null}
{
  "ok": true
}
```

### Error Responses

| Code | Error                  | Description                           |
| ---- | ---------------------- | ------------------------------------- |
| 400  | Invalid body           | Request body validation failed        |
| 415  | Unsupported Media Type | Content-Type must be application/json |
| 500  | Internal error         | Server error                          |

<ResponseExample>
  ```json Response theme={null}
  {
    "top24": 5420,
    "topAll": 12850
  }
  ```
</ResponseExample>
