> 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/reference/remote-access-and-apis/api-examples.md).

# API Examples

Welcome to the API examples section. Here, you’ll find practical demonstrations of how to interact with our API endpoints using cURL commands. Each example is designed to help you quickly understand h

### Structure of the Examples

* cURL-based examples: Every example shows the exact cURL command you can copy and run directly in your terminal.
* Endpoint-specific demonstrations: We walk through different API endpoints one by one, highlighting the required parameters and common use cases.
* Request & Response clarity: Each section contains both the request (what you send) and the response (what you get back) to illustrate expected behavior.

The examples cover two families of endpoints:

* **Data query APIs**: search and aggregate observability data (logs, traces, Kubernetes events, metrics). Logs, traces, and events are queried with [gcQL](/investigate/querying-your-groundcover-data/groundcover-query-language.md) through the [Query Data with gcQL](/reference/remote-access-and-apis/api-examples/query-data-gcql.md) endpoints; metrics are queried with [MetricsQL](/reference/remote-access-and-apis/api-examples/query-metrics.md).
* **Management APIs**: manage platform resources such as monitors, silences, workflows, ingestion keys, and pipelines.

### Base URL

The canonical base URL for the groundcover API is `https://api.groundcover.com`. Some examples show `https://app.groundcover.com`, which serves the same API.

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

### Prerequisites

Before running any of the examples, make sure you have:

1. [API Key](https://docs.groundcover.com/use-groundcover/remote-access-and-apis/api-keys)
2. Backend ID

The Backend ID can be obtained from your groundcover Admin panel.

**To locate it:**

* Navigate to Settings → Access
* Open the API Keys tab
* The Backend ID appears in the section header

**When to Use**

The Backend ID is required when your account is associated with multiple backends.

In such cases, include it in your API requests using the appropriate request header to ensure the request is routed to the correct backend.

```yaml
X-Backend-Id: <YOUR_BACKEND_ID>
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.groundcover.com/reference/remote-access-and-apis/api-examples.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
