---
title: "Execute report query"
method: POST
path: "/api/v1/analytics/report/{id}/query"
tags: ["Report"]
---

# Execute report query

`POST /api/v1/analytics/report/{id}/query`

Execute a stored report query synchronously and get result table. The number of records that you receive as results is limited to a reasonable amount (currently 5000 records). This endpoint is mainly for viewing the data. Use the export endpoints in order to fetch all results.

## Path parameters

- `id` string, required — Resource identifier.

## Query parameters

- `preview` object
  - `preview` boolean — If true, only a limited amount of records will be returned, but the request does not cost any credits. If true, all results are returned up to a max number of 500 rows.

## Request body

- object
  - `parameters` object[], nullable
    - `name` string, required — Parameter name
    - `type` string, required — Parameter type
    - `defaultValue` string, required — Default value for parameter you want to store
    - `valueMap` object[] — Array of dropdown options with label and value properties. Values will be rendered in the query, labels are displayed in the dropdown.
      - `label` string, required — Display label shown in the dropdown
      - `value` string, required — Value used in the query
  - `settings` object, nullable
    - `delimiter` string — The delimiter character used for CSV or TXT exports
    - `escapeSpecialCharacters` boolean — Whether to escape special characters in TXT exports (e.g. quotes, newlines)
    - `disableQuotes` boolean — Whether to disable enclosing all values with double quotes in TXT exports. This is useful for handling special characters or values that contain the delimiter character. It's problematic if values contain double quotes themselves.
    - `exportFormat` 'csv' | 'xlsx' | 'json' | 'txt' | 'parquet' | 'pdf' — Export format for reports
    - `numberFormattingMode` 'locale' | 'raw' — Number formatting mode that should be applied when visualizing numbers (does not affect exports)

## Response `200`

Query response

- object
  - `data` object, nullable, required — Generic result response for a query in a table-like structure.
    - `header` string[], required
    - `rows` array[], required
      - string[]
  - `meta` object, nullable, required — Query meta information.
    - `columnTypes` string[], nullable — Derived column types for each column in the result table.
    - `executionTime` number, nullable — Execution time of the query in seconds.
    - `query` string — SQL query that was executed.
    - `totalResults` number, nullable — Total number of rows og the result (the returned result is always limited).

## Other responses

- `400` — Error response with message
- `401` — Unable to authenticate the client
- `402` — Resource can not be accessed because you exceeded the credit limit.
- `403` — Unable to authorize the client
- `404` — Resource was not found or not enough access privileges
- `415` — Resource representation send in the request is not supported.
- `429` — Too many API calls made.

---

[API](https://skmtc.net/xentral/apis/xentral-api.md) · [All operations](https://skmtc.net/xentral/apis/xentral-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/xentral/xentral-api/versions/8a27ba392442/schema)
