---
title: "POST /logs/global/facets"
method: POST
path: "/logs/global/facets"
tags: ["Logs"]
---

# POST /logs/global/facets

`POST /logs/global/facets`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/logs/global/facets`
- Auth: HTTP bearer

## Request body

- GlobalLogFacetsRequest: Facet request: the same filter body plus the fields to aggregate.
  - `attrs` string[]: Attribute predicates (ADR-047 §5): `<key><op><value>` with `op` one of `=`, `!=`, `^=` (prefix), `>`, `<`, or `<key>?` for "exists". Requires the line index; when combined with `text`, the text filter is applied in memory over the lines the index already matched (the index holds no message bytes, so it cannot answer `text` on its own).
  - `container_ids` string[]: Docker container IDs.
  - `cursor` string, nullable: Opaque cursor from the previous page's `next_cursor`.
  - `deploy_id` integer, nullable
  - `end_time` string, required
  - `envs` string[]
  - `external_services` string[]: Database/service IDs or names, not container service labels.
  - `levels` LogLevel[]
  - `node_ids` integer[]
  - `page_size` integer, nullable: Defaults to 200, server-capped at 1000.
  - `projects` string[]: Match project ID, slug or name. Empty selects all authorized projects.
  - `scopes` string[]: Explicit resource identities, e.g. `application:12` or `service:34`.
  - `services` string[]: Container service labels (the `service` column), e.g. `web`, `worker`.
  - `source` 'collected' | 'application' | 'service': Which family of log sources a query covers.
  - `start_time` string, required
  - `text` string, nullable: Case-insensitive substring match over the message.
  - `fields` FacetField[]: Fields to return distinct values for. Empty returns the default set.

## Response `200`

- GlobalLogFacetsResponse: Distinct values and counts per requested field, inside the current window.
  - `external_service_names` object, required: Display names for the returned `external_service_id` values; see `project_names`.
  - `facets` object, required: Keyed by field name (`env`, `service`, `level`, `node_id`, …). Values are ordered by count, descending.
  - `partial` boolean, required: `true` when a field's value list was capped or timed out, so it is a prefix rather than the complete set. Reported rather than glossed: the point of a facet is that a user can trust it to surface values they have never seen on screen.
  - `project_names` object, required: Display names for the returned `project_id` values, keyed by value. Resolved here, under the log access that produced the facets, so a caller who may read these logs can tell the projects apart without also needing permission to read projects — the same names search lines carry as `owner`. A returned value missing from this map names a project this instance no longer has.

## Other responses

- `400`
- `403`
- `408`

## Changes

- **2026-11-09** `12896146b193`: 3 breaking
  - removed the required property `extensions` from the response with the `400` status
  - removed the required property `extensions` from the response with the `403` status
  - removed the required property `extensions` from the response with the `408` status
- **2026-10-05** `4b228ebed583`: 1 info
  - endpoint added
- **2026-10-05** `63a80791dc58`: 1 breaking
  - api path removed without deprecation
- **2026-09-25** `1c2a1009e0fe`: 2 info
  - added the required property `external_service_names` to the response with the `200` status
  - added the required property `project_names` to the response with the `200` status
- **2026-09-23** `f4efc4d5c7b7`: 3 info
  - added the optional property `status` to the response with the `400` status
  - added the optional property `status` to the response with the `403` status
  - added the optional property `status` to the response with the `408` status

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/logs/global/facets/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)
