> For the complete documentation index, see [llms.txt](https://docs.groundcover.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.groundcover.com/use-groundcover/remote-access-and-apis/raw-prometheus-and-clickhouse.md).

# Metrics and Logs API

## Authentication

Authentication is performed using an API key generated in the [API Keys section](/use-groundcover/remote-access-and-apis/api-keys.md) of the groundcover console.

All API requests must include the API key in the Authorization header using the following format:

```
Authorization: Bearer <YOUR_API_KEY>
```

{% hint style="info" %}
Self-hosted ([onPrem](/architecture/overview.md#onprem) / [airGapped](/architecture/overview.md#airgapped)) deployments use their own API URL. Replace the `groundcover.com` hosts below with your environment's endpoint, and use an API key generated in that environment's console - API keys are only valid for the environment that issued them.
{% endhint %}

## Rate Limits

groundcover APIs enforce rate limits on a per-client basis to ensure fair usage and system stability. Each client is allowed up to **150 requests per second and 1,000 requests per minute**. A “client” is identified by the Authorization header, which typically represents an API key. This means that rate limits are applied independently for each API key used

## Raw Prometheus API for Metrics

Use the following endpoint to query the groundcover Prometheus API:

```bash
https://app.groundcover.com/api/prometheus/api/v1/query
```

To see usage example on how to query metrics in groundcover see: [Query metrics examples](/use-groundcover/remote-access-and-apis/api-examples/query-metrics.md)

For a complete Prometheus REST API documentation, and available operations, see: [Prometheus HTTP API](https://prometheus.io/docs/prometheus/latest/querying/api/)

## Logs, Traces & Events API (gcQL)

Logs, traces, and Kubernetes events are queried with [gcQL](/use-groundcover/querying-your-groundcover-data/groundcover-query-language.md) through the search endpoints:

```bash
https://api.groundcover.com/api/logs/v2/search
https://api.groundcover.com/api/traces/v2/search
https://api.groundcover.com/api/k8s/v2/events/search
```

For usage examples see: [Query Data with gcQL](/use-groundcover/remote-access-and-apis/api-examples/query-data-gcql.md)

## Legacy API (Clickhouse)

The following configurations are deprecated but may still be in use in older setups.

{% hint style="warning" %}
The legacy datasources is using a different API key than described above. The API key can be obtained by running: `groundcover auth get-datasources-api-key`
{% endhint %}

You can query the legacy API to execute SQL statements directly on the Clickhouse database.

Try the following structure:

```bash
curl https://ds.groundcover.com/ \
    -H "X-ClickHouse-Key: <DS-API-KEY-VALUE>" \
    --data "SELECT count() FROM logs LIMIT 1 FORMAT JSON" 
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.groundcover.com/use-groundcover/remote-access-and-apis/raw-prometheus-and-clickhouse.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
