---
title: "Fetch a document by docid"
method: GET
path: "/{index}/doc/{docid}"
---

# Fetch a document by docid

`GET /{index}/doc/{docid}`

## Path parameters

- `index` string, required
- `docid` string, required

## Query parameters

- `parse` boolean

## Response `200`

Document found.

- DocumentResponse
  - `api` string, required
  - `index` string, required
  - `docid` string, required
  - `doc` union, required — May be null, a string, or a JSON object depending on index contents and setting of "parse" parameter.
    - string
    - object
    - unknown[]
      - unknown
    - number
    - boolean

## Other responses

- `400` — Invalid request parameters.
- `404` — Document not found, or route not found.
- `405` — Method not allowed. Only GET is supported.
- `500` — Internal server error.

## Changes

- **2026-07-17** `a95dfd318781` — 1 breaking, 4 info
  - removed the required property `document` from the response with the `200` status
  - added the new optional `query` request parameter `parse`
  - added the non-success response with the status `405`
  - added the non-success response with the status `500`
  - …1 more
- **2026-03-21** `a2b4397b7f05` — 1 info
  - endpoint added
- **2026-03-15** `70cb270260ea` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/castorini/apis/anserini-rest-api/changes/:index/doc/:docid/get.md)

---

[API](https://skmtc.dev/castorini/apis/anserini-rest-api.md) · [All operations](https://skmtc.dev/castorini/apis/anserini-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/castorini/anserini-rest-api/revisions/a95dfd318781/schema)
