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

# Get Project Metrics

> Retrieve aggregate metrics for a specific project in your SlowNet account using an API key.

## Endpoint

```
GET https://theslow.net/api/slowstats/get-metrics?projectId=YOUR_PROJECT_ID
```

## Overview

This endpoint retrieves aggregate metrics (like counts or summaries) for the specified project.\
Use it to power dashboards, summaries, or quick overviews of project activity.

## Authentication

This endpoint requires an API key. You can retrieve an API key from your [dashboard](https://theslow.net/dashboard). Include it in the `X-API-KEY` header:

```
X-API-KEY: YOUR_API_KEY_HERE
```

For more details, see the [Authentication Guide](https://docs.theslow.net/authentication).

## Query Parameters

| Parameter   | Type   | Required | Description                                 |
| ----------- | ------ | -------- | ------------------------------------------- |
| `projectId` | string | Yes      | The ID of the project to fetch metrics for. |

## Responses

### ✅ 200 OK

Returns a JSON object with your metrics:

```json theme={null}
{
  "metrics": {
    "total_events": 123,
    "unique_visitors": 45,
    "last_7_days": [
      { "date": "2025-07-10", "events": 10 },
      { "date": "2025-07-11", "events": 15 }
    ]
  }
}
```

### ⚠️ 400 Bad Request

If `projectId` is missing:

```json theme={null}
{
  "error": "Project ID is required."
}
```

### 🔒 401 Unauthorized

If authentication fails (invalid or missing API key):

```json theme={null}
{
  "error": "Unauthorized: You must provide a valid API Key."
}
```

### 🚫 403 Forbidden

If the project does not belong to the authenticated user:

```json theme={null}
{
  "error": "Forbidden: You do not have access to this project."
}
```

### 💥 500 Internal Server Error

For unexpected server errors:

```json theme={null}
{
  "error": "An internal server error occurred."
}
```

## Examples

### CURL

```bash theme={null}
curl -X GET "https://theslow.net/api/slowstats/get-metrics?projectId=abc123"      -H "X-API-KEY: YOUR_API_KEY_HERE"
```

### Python (requests)

```python theme={null}
import requests

headers = {"X-API-KEY": "YOUR_API_KEY_HERE"}
params = {"projectId": "abc123"}
response = requests.get("https://theslow.net/api/slowstats/get-metrics", headers=headers, params=params)
print(response.json())
```

### JavaScript (fetch)

```javascript theme={null}
fetch("https://theslow.net/api/slowstats/get-metrics?projectId=abc123", {
  headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
})
  .then(res => res.json())
  .then(data => console.log(data.metrics));
```

## Notes

* This endpoint enforces **ownership checks**, meaning you can only retrieve metrics for projects tied to your API key.
* The metrics object may be expanded over time with more fields.

## Need Further Assistance?

If you have any questions or encounter issues, please don't hesitate to reach out to our [support team](https://theslow.net/dashboard#support).
