---
title: "Query data from an entity with optional filters, pagination, and sorting"
method: POST
path: "/external-services/{service_id}/query/containers/{path}/entities/{entity}/data"
tags: ["External Services - Query"]
---

# Query data from an entity with optional filters, pagination, and sorting

`POST /external-services/{service_id}/query/containers/{path}/entities/{entity}/data`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/external-services/{service_id}/query/containers/{path}/entities/{entity}/data`
- Auth: HTTP bearer

## Path parameters

- `service_id` integer, required
- `path` string, required
- `entity` string, required

## Request body

- QueryDataRequest
  - `filters` unknown
  - `limit` integer: Maximum number of rows to return
  - `offset` integer: Number of rows to skip
  - `sort_by` string, nullable: Sort by field name
  - `sort_order` string, nullable: Sort order (asc/desc)

## Response `200`

Query results

- QueryDataResponse
  - `execution_time_ms` integer, required: Query execution time in milliseconds
  - `fields` FieldResponse[], required: Field definitions
    - `field_type` string, required: Field type (Int32, String, Timestamp, etc.)
    - `name` string, required: Field name
    - `nullable` boolean, required: Whether the field is nullable
  - `returned_count` integer, required: Number of rows returned in this response
  - `rows` unknown[], required: Data rows (array of JSON objects)
    - unknown
  - `total_count` integer, required: Total number of rows matching the query (before limit/offset)
  - `truncated` boolean, required: Whether rows were dropped from this response to stay inside the byte budget. `returned_count` is always the number of rows actually present, so a truncated page is still internally consistent — but a caller comparing it against the requested limit would otherwise conclude the table simply ended. Reported explicitly so a partial page is never mistaken for a complete one, by a human, a script, or a model reading a tool result.

## Other responses

- `400`: Invalid query
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Service, container, or entity not found
- `500`: Internal server error

## Changes

- **2026-09-07** `8be6c67df066`: 1 info
  - added the required property `truncated` to the response with the `200` status
- **2026-09-07** `f7404eb7ac98`: 1 breaking
  - removed the required property `truncated` from the response with the `200` status
- **2026-08-07** `40a1b1868976`: 1 info
  - added the required property `truncated` to the response with the `200` status
- **2026-08-07** `e54bb747f9bf`: 1 breaking
  - removed the required property `truncated` from the response with the `200` status
- **2026-08-06** `dbccb47d373a`: 1 info
  - added the required property `truncated` to the response with the `200` status

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/external-services/:service_id/query/containers/:path/entities/:entity/data/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
