---
title: "Get top documents matching a query string (JSON)"
method: GET
path: "/{k}/word_docs.json"
tags: ["Models", "Documents"]
---

# Get top documents matching a query string (JSON)

`GET /{k}/word_docs.json`

Returns a JSON array of up to `n` documents for model `k` based on a query `q` (server lowercases). Each document includes `id`, `label`, `metadata`, plus: - `prob` - `topics` (topic mixture map) Supports conditional requests via ETag / If-None-Match.

## Path parameters

- `k` integer, required

## Query parameters

- `q` string, required
- `n` integer

## Response `200`

Array of documents with topic mixtures

- DocWithTopics[]
  - `id` string, required — Document identifier (label key used by server).
  - `label` string, required — Human-readable label for the document.
  - `metadata` Metadata, required — Arbitrary metadata fields from the corpus.
  - `prob` number, float, required — Probability/similarity score emitted by the server.
  - `topics` object, required — Map of topic id (string) to probability for this document.

## Other responses

- `304` — Not Modified (If-None-Match matched)
- `400` — Invalid model `k` (no model for k)

---

[API](https://skmtc.dev/inpho/apis/topic-explorer-server-api.md) · [All operations](https://skmtc.dev/inpho/apis/topic-explorer-server-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/inpho/topic-explorer-server-api/revisions/04253424f5bb/schema)
