> For a complete page index of the Captain API documentation, fetch https://docs.filesearch.dev/llms.txt?excludeSpec=true

# Query History API

* **Your query history, from the API**: [`GET /v2/queries`](/reference/queries/list) lists the queries your keys and agents have run, newest first, scoped to the calling key's environment, with `collection`, `status`, `from`/`to` and `sort` filters and cursor paging. [`GET /v2/queries/{query_id}`](/reference/queries/get) returns one query with its request body, response body and the retrieved chunks in one normalised shape across v2 and v3. Add `include=results,request,response` to the list to get feed and previews in one request; the body fields are always present and null unless requested. Bodies are archived 90 days after the query (`body_status: archived`); summaries are kept.
* **Query responses now carry `query_id`**: every `POST .../query` response (v2 and v3) returns the id of its history row, so you can fetch it back with `GET /v2/queries/{query_id}` straight away. The `request_id` a query response returns is accepted on that endpoint too.