---
title: API queries
description: Run DataPrime or Lucene queries from code over JSON-over-HTTP or gRPC, with endpoint selection, API key setup, and required permissions.
url: https://coralogix.com/docs/dataprime/API/api-queries/
product: dataengine
feature: DataPrime Queries
feature_id: dataengine-dataprime-queries
feature_identifier: dataengine/dataengine-dataprime-queries
last_updated: '2026-10-29'
---

# API queries

Run **DataPrime** or **Lucene** queries directly from your code, no need to open the Coralogix UI.

Choose the API architecture that best fits your workflow:

* **JSON over HTTP**
* **gRPC**

For large or recurring analytics jobs (like monthly or quarterly reports), use **background queries** that run asynchronously. These are available via both [JSON-over-HTTP](https://coralogix.com/docs/dataprime/API/direct-archive-query-http.md) and [gRPC](https://coralogix.com/docs/dataprime/API/direct-archive-query-grpc.md).

## Quick comparison

| Feature                | JSON over HTTP                                   | gRPC              |
| ---------------------- | ------------------------------------------------ | ----------------- |
| **Transport Security** | HTTPS                                            | HTTPS             |
| **Request Format**     | JSON (POST body)                                 | Protobuf message  |
| **Response Format**    | NDJSON for streaming<br />JSON for non-streaming | Protobuf stream   |
| **Status Codes**       | Standard HTTP                                    | gRPC status codes |

## Setup & authentication

All requests must be sent over HTTPS, regardless of whether you're using HTTP or gRPC.

To get started:

1. Choose the
   <!-- -->
   https\://api./api/v1/dataprime/query
   <!-- -->
   endpoint that corresponds to your Coralogix [domain](https://coralogix.com/docs/user-guides/account-management/account-settings/coralogix-domain.md) using the domain selector at the top of the page.
2. Create a personal or team [API key](https://coralogix.com/docs/user-guides/account-management/api-keys/api-keys.md).
3. Include your API key in the Authorization header of your request:

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

Note

Select the DataQuerying permission preset to keep your key automatically aligned with future permission updates.

## Required permissions

| Action                           | Purpose                             |
| -------------------------------- | ----------------------------------- |
| `LEGACY-ARCHIVE-QUERIES:EXECUTE` | Query archived data                 |
| `LOGS.DATA-API#HIGH:READDATA`    | Query frequent‑search logs          |
| `LOGS.DATA-API#LOW:READDATA`     | Query monitoring & compliance logs  |
| `METRICS.DATA-API#HIGH:READDATA` | Query metrics                       |
| `SPANS.DATA-API#HIGH:READDATA`   | Query frequent‑search spans         |
| `SPANS.DATA-API#LOW:READDATA`    | Query monitoring & compliance spans |

## Next steps

Choose your guide and jump straight into examples:

* [JSON over HTTP reference](https://coralogix.com/docs/dataprime/API/direct-archive-query-http.md) – request/response schema, examples, and error handling.

* [gRPC reference](https://coralogix.com/docs/dataprime/API/direct-archive-query-grpc.md) – proto definitions and streaming examples.

## Additional resources

|                     |                                                                                       |
| ------------------- | ------------------------------------------------------------------------------------- |
| Coralogix Endpoints | [Coralogix Endpoints](https://coralogix.com/docs/integrations/coralogix-endpoints.md) |
