---
title: Insights API reference
description: API reference for querying data with Insights.
url: https://docs.honeybadger.io/api/insights/
---

## Query Insights data

This endpoint executes a BadgerQL query against your project’s Insights data and returns the results.

```bash
curl -u AUTH_TOKEN: -X POST -H 'Content-type: application/json' -d '{"query":"fields @ts, @preview | limit 3"}' https://app.honeybadger.io/v2/projects/ID/insights/queries
```

The following fields can be provided in the request body:

| Field name | Type   | Description                                                                                                                                                                                                                                            |
| ---------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `query`    | string | A [BadgerQL query string](https://docs.honeybadger.io/guides/insights/badgerql/) to execute against your Insights data                                                                                                                                 |
| `ts`       | string | Optional timestamp range (defaults to `PT3H`). Accepts shortcuts (`today`, `week`) or ISO 8601 formats: durations (`P8D`), datetimes (`2021-12-14T22:14:08`), time intervals (`2021-12-10T00:00/2021-12-12T00:00`), or duration intervals (`P1W/P0D`). |
| `timezone` | string | Optional timezone for timestamp interpretation. Must be a valid IANA timezone identifier (e.g., `America/New_York`, `UTC`, `Europe/London`).                                                                                                           |

Returns the query results with the following format:

```json
{
  "results": [
    {
      "@ts": "2025-11-18 11:40:05.802",
      "@preview": "{\"ctx.class\":\"UptimeWorker\",\"ctx.elapsed\":0.297,\"ctx.jid\":\"aed85cd96b60c142b8c9b835\",\"lvl\":\"INFO\",\"msg\":\"done\",\"pid\":1,\"tid\":\"1knd\"}"
    },
    {
      "@ts": "2025-11-18 11:40:05.812",
      "@preview": "{\"ctx.class\":\"UptimeWorker\",\"ctx.elapsed\":0.198,\"ctx.jid\":\"dfb0be7609bb3d4747efb5fd\",\"lvl\":\"INFO\",\"msg\":\"done\",\"pid\":1,\"tid\":\"1kp5\"}"
    },
    {
      "@ts": "2025-11-18 11:40:05.813",
      "@preview": "{\"ctx.class\":\"FaultMetricWorker\",\"ctx.elapsed\":0.22,\"ctx.jid\":\"f1f3b3a9b9d874ba82e97590\",\"lvl\":\"INFO\",\"msg\":\"done\",\"pid\":1,\"tid\":\"1ksp\"}"
    }
  ],
  "meta": {
    "query": "fields @ts, @preview | limit 3",
    "fields": [
      "@ts",
      "@preview"
    ],
    "schema": [
      {
        "name": "@ts",
        "type": "datetime"
      },
      {
        "name": "@preview",
        "type": "json"
      }
    ],
    "row_count": 3,
    "total_count": 3,
    "start_at": "2025-11-18 11:11:26",
    "end_at": "2025-11-18 14:11:26"
  }
}
```

The response includes:

| Field name         | Type   | Description                                       |
| ------------------ | ------ | ------------------------------------------------- |
| `results`          | array  | Array of objects containing the query results     |
| `meta.query`       | string | The query that was executed                       |
| `meta.fields`      | array  | List of fields included in the results            |
| `meta.schema`      | array  | Schema information for each field (name and type) |
| `meta.row_count`   | number | Number of rows returned in this response          |
| `meta.total_count` | number | Total number of rows matching the query           |
| `meta.start_at`    | string | Start of the time range for the query             |
| `meta.end_at`      | string | End of the time range for the query               |

Please see the [BadgerQL guide](https://docs.honeybadger.io/guides/insights/badgerql/) for the query syntax to use for the `query` field.

---

## Try Honeybadger for FREE

Intelligent logging, error tracking, and Just Enough APM™ in one dev-friendly platform. Find and fix problems before users notice.

[Start free trial](https://app.honeybadger.io/users/sign_up)

[See plans and pricing](https://www.honeybadger.io/plans/)
