# Insights API

Source: https://userguide.qualytics.io/insights/api/

You can read the data behind the Overview tab, filter each Insights tab's listing by the same datastores and tags the filter bar uses, and create, list, update, and delete filter presets programmatically.

All endpoints use the base URL of your Qualytics deployment (e.g., `https://your-instance.qualytics.io/api`) and require a Personal API Token, sent as a Bearer token in the `Authorization` header.

> **Tip**
>
> For complete API documentation, including request/response schemas, visit the [API docs](https://userguide.qualytics.io/api/docs).

> **Note: Permissions**
>
> Every endpoint on this page requires the **Member** role or above. Results only cover datastores your teams reach, at any team permission; Admins see every datastore. A filter preset is returned only when your teams reach every datastore it includes. Members can update or delete only the presets they created, while Managers and Admins can change any preset they can see. See [Insights Permissions](https://userguide.qualytics.io/insights/deep-dive/permissions/) for the full matrix.

---

## Filter Parameters

The filter bar is not a separate API. Each Insights tab reads from its own endpoint, and the **Datastores** and **Tags** selections travel as the `datastore` and `tag` query parameters on that endpoint.

| Parameter | Type | Description |
| --- | --- | --- |
| `datastore` | `list of integers` | Datastore IDs to include. Repeat the parameter for several values (`datastore=1&datastore=2`). Several values combine with **OR**. |
| `tag` | `list of strings` | Tag names to include. Repeat the parameter for several values. Several values combine with **OR**. |

When both are sent, they combine with **AND**: only data from one of the datastores that also carries one of the tags is returned. Datastores outside your teams' reach are dropped from the filter rather than rejected.

| Tab | Endpoint | Filter parameters |
| --- | --- | --- |
| **Overview** | `GET /insights` | `datastore`, `tag` |
| **Activity** | `GET /operations`, `GET /operations/schedule`, `GET /operation-insights` | `datastore` only. Operations have no tag filter. |
| **Profiles** | `GET /containers`, `GET /field-profiles` | `datastore`, `tag` |
| **Observability** | `GET /observability` | `datastore`, `tag` |
| **Checks** | `GET /quality-checks` | `datastore`, `tag` |
| **Anomalies** | `GET /anomalies` | `datastore`, `tag` |

Each endpoint also takes its own paging, sorting, and search parameters. See the [API docs](https://userguide.qualytics.io/api/docs) for the full list.

---

## Read the Overview Data

Returns every metric on the Overview tab for a report date and timeframe: the Quality Score and its dimensions, data volume, check and anomaly counts, distributions, and the daily series behind each chart.

**Endpoint:** `GET /insights`

**Permission:** Member role or above

| Query Parameter | Type | Description |
| --- | --- | --- |
| `report_date` | `string` (`YYYY-MM-DD`) | The day the report describes. Defaults to today (UTC). |
| `timeframe` | `string` | `week`, `month`, `quarter`, or `year`. Defaults to `week`. |
| `offset` | `integer` | Your time zone's offset in minutes, so days begin and end at your local midnight. |
| `datastore` | `list of integers` | Datastore IDs to include. See [Filter Parameters](https://userguide.qualytics.io/insights/api/#filter-parameters). |
| `tag` | `list of strings` | Tag names to include. See [Filter Parameters](https://userguide.qualytics.io/insights/api/#filter-parameters). |
| `force_refresh` | `boolean` | `true` recalculates the data instead of returning a saved snapshot, like the refresh control on the page. Defaults to `false`. |

A saved snapshot is reused for up to 30 minutes. The response carries `generated_at`, the time the data was calculated, plus the `start_date`, `end_date`, `timeframe`, and the `datastores` it covers.

> **Example: Example request**
>
> ```bash
> curl -X GET "https://your-instance.qualytics.io/api/insights?report_date=2026-10-31&timeframe=month&datastore=12&datastore=15&tag=production" \
>   -H "Authorization: Bearer YOUR_TOKEN"
> ```

### Read the Overview Data for a Preset

Returns the same data as `GET /insights`, filtered by a preset's saved datastores and tags.

**Endpoint:** `GET /filter-presets/{id}/insights`

**Permission:** Member role or above. Your teams must reach every datastore in the preset.

| Query Parameter | Type | Description |
| --- | --- | --- |
| `timeframe` | `string` | `week`, `month`, `quarter`, or `year`. Overrides the timeframe saved on the preset. Without either, `week` is used. |
| `offset` | `integer` | Your time zone's offset in minutes. |

The report date is always today, and the data is always recalculated rather than read from a saved snapshot.

> **Example: Example request**
>
> ```bash
> curl -X GET "https://your-instance.qualytics.io/api/filter-presets/7/insights?timeframe=quarter" \
>   -H "Authorization: Bearer YOUR_TOKEN"
> ```

---

## List Filter Presets

Returns the filter presets you can see. Presets that include any datastore outside your teams' reach are left out.

**Endpoint:** `GET /filter-presets`

**Permission:** Member role or above

| Query Parameter | Type | Description |
| --- | --- | --- |
| `name` | `string` | Match a piece of the preset name, ignoring case. |
| `sort_name`, `sort_created` | `asc` / `desc` | Sort by name or by creation date. Without either, presets are sorted by name. |
| `page`, `size` | `integer` | Page number and page size. |

For a flat list sorted by name, without paging, use `GET /filter-presets/listing`. It returns the same presets.

Each preset in the response carries `can_edit`, which is `true` when you can update or delete it.

> **Example: Example request and response**
>
> **Request**:
>
> ```bash
> curl -X GET "https://your-instance.qualytics.io/api/filter-presets/listing" \
>   -H "Authorization: Bearer YOUR_TOKEN"
> ```
>
> **Response** (abbreviated):
>
> ```json
> [
>   {
>     "id": 7,
>     "name": "Critical Production",
>     "description": "Datastores and tags for production-critical assets",
>     "timeframe": null,
>     "datastores": [
>       { "id": 12, "name": "Sales Warehouse" },
>       { "id": 15, "name": "Finance Lakehouse" }
>     ],
>     "tags": ["production", "critical"],
>     "created_by": { "id": 4, "name": "Jane Doe" },
>     "last_editor": { "id": 9, "name": "John Roe" },
>     "can_edit": true
>   }
> ]
> ```

---

## Get a Filter Preset

Returns one filter preset, with its datastores, tags, creator, last editor, and `can_edit`.

**Endpoint:** `GET /filter-presets/{id}`

**Permission:** Member role or above. Your teams must reach every datastore in the preset; otherwise the preset is reported as not found.

> **Example: Example request**
>
> ```bash
> curl -X GET "https://your-instance.qualytics.io/api/filter-presets/7" \
>   -H "Authorization: Bearer YOUR_TOKEN"
> ```

---

## Create a Filter Preset

Saves a named combination of datastores and tags. You become the preset's creator.

**Endpoint:** `POST /filter-presets`

**Permission:** Member role or above. Your teams must reach every datastore you include.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | Yes | Preset name, from 1 to 255 characters. Must be unique across the workspace. Names are case-sensitive. |
| `description` | `string` | No | Optional description. |
| `datastore_ids` | `list of integers` | No | Datastore IDs to include. |
| `tag_names` | `list of strings` | No | Tag names to include. Each tag must exist. |
| `timeframe` | `string` | No | `week`, `month`, `quarter`, or `year`. Used only by [Read the Overview Data for a Preset](https://userguide.qualytics.io/insights/api/#read-the-overview-data-for-a-preset). Presets saved from the Insights page do not set it. |

> **Example: Example request**
>
> ```bash
> curl -X POST "https://your-instance.qualytics.io/api/filter-presets" \
>   -H "Authorization: Bearer YOUR_TOKEN" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "name": "Critical Production",
>     "description": "Datastores and tags for production-critical assets",
>     "datastore_ids": [12, 15],
>     "tag_names": ["production", "critical"]
>   }'
> ```

---

## Update a Filter Preset

Changes only the fields you send. Every other field keeps its value.

**Endpoint:** `PUT /filter-presets/{id}`

**Permission:** Member role or above. Members can update only the presets they created. Managers and Admins can update any preset they can see.

The body takes the same fields as [Create a Filter Preset](https://userguide.qualytics.io/insights/api/#create-a-filter-preset), all optional. Send an empty list for `datastore_ids` or `tag_names` to clear it. The preset's last editor and update time change on every successful call, even when nothing else changes.

> **Example: Example request**
>
> ```bash
> curl -X PUT "https://your-instance.qualytics.io/api/filter-presets/7" \
>   -H "Authorization: Bearer YOUR_TOKEN" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "name": "Critical Production (EU)",
>     "datastore_ids": [15]
>   }'
> ```

---

## Delete a Filter Preset

Deletes a filter preset. This cannot be undone.

**Endpoint:** `DELETE /filter-presets/{id}`

**Permission:** Member role or above. Members can delete only the presets they created. Managers and Admins can delete any preset they can see.

Anyone who has the preset applied, or opens a link to it, gets an error message the next time the Insights page loads the preset, and the page returns to its unfiltered view.

> **Example: Example request**
>
> ```bash
> curl -X DELETE "https://your-instance.qualytics.io/api/filter-presets/7" \
>   -H "Authorization: Bearer YOUR_TOKEN"
> ```

---

## Error Responses

| Status Code | Description |
| --- | --- |
| `401 Unauthorized` | Missing or invalid API token. |
| `403 Forbidden` | You do not have the required role, a datastore in `datastore_ids` is outside your teams' reach, or you are a Member changing a preset another user created. |
| `404 Not Found` | The preset does not exist or includes a datastore outside your teams' reach, or a datastore ID or tag name in the request does not exist. |
| `409 Conflict` | A preset with that name already exists. |
| `422 Unprocessable Entity` | Invalid request, such as an empty or too-long name, an unknown `timeframe`, or a malformed `report_date`. |

> **Example: Error response examples**
>
> **409 Conflict** (name taken):
>
> ```json
> { "detail": "Filter preset with name 'Critical Production' already exists" }
> ```
>
> **403 Forbidden** (another user's preset):
>
> ```json
> { "detail": "Only the preset owner or a Manager/Admin can modify this filter preset" }
> ```

---

## Related

- [Getting Started with Insights](https://userguide.qualytics.io/insights/deep-dive/getting-started/)
- [Filters](https://userguide.qualytics.io/insights/deep-dive/filters/)
- [Filter Presets](https://userguide.qualytics.io/insights/deep-dive/filter-presets/)
- [How Insights Work](https://userguide.qualytics.io/insights/deep-dive/how-it-works/)
- [Insights Permissions](https://userguide.qualytics.io/insights/deep-dive/permissions/)
- [Insights FAQ](https://userguide.qualytics.io/insights/faq/)

*Last updated: November 18, 2026.*
