> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reportify.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Doc Chunk

> Retrieve one authority chunk by its stable chunk ID, together with the document metadata and current document version.

## 精确获取文档分块

**URL**: `/v1/docs/{doc_id}/chunks/{chunk_id}`\
**方法**: `GET`\
**描述**: 使用稳定的文档 ID 和 chunk ID 精确读取一个权威原文分块。适合 Citation
跳转、原文核对，以及已知 chunk ID 后的按需读取；无需顺序翻页扫描整篇文档。

### 请求参数

| 参数名        | 类型     | 必填 | 描述                     |
| ---------- | ------ | -- | ---------------------- |
| `doc_id`   | string | 是  | Reportify 文档唯一 ID。     |
| `chunk_id` | string | 是  | 搜索或文档接口返回的稳定 chunk ID。 |

### 响应说明

响应沿用文档内容结构，并保证 `chunks` 数组只包含所请求的一个分块：

| 字段                   | 类型      | 描述                                |
| -------------------- | ------- | --------------------------------- |
| `doc_id`             | string  | 文档唯一 ID。                          |
| `document_version`   | string  | 当前文档内容与 locator 快照版本。             |
| `chunks`             | array   | 仅包含目标 chunk。                      |
| `chunks[0].id`       | string  | 与请求中的 `chunk_id` 相同。              |
| `chunks[0].content`  | string  | 可引用的原文。                           |
| `chunks[0].metadata` | object  | 页码、bbox、页面尺寸或 HTML 定位信息（数据存在时返回）。 |
| `total_chunks`       | integer | 当前文档的总分块数。                        |
| `chunk_offset`       | integer | 目标 chunk 在当前文档中的零基位置。             |

### 请求示例

```bash theme={null}
curl -X GET \
  'https://api.reportify.cn/v1/docs/1046895208953942016/chunks/605401659404358' \
  -H 'Authorization: Bearer 447460****09c9'
```

```python theme={null}
import requests

response = requests.get(
    "https://api.reportify.cn/v1/docs/1046895208953942016/chunks/605401659404358",
    headers={"Authorization": "Bearer 447460****09c9"},
)
response.raise_for_status()
chunk = response.json()["chunks"][0]
print(chunk["content"])
```

### 响应示例

```json theme={null}
{
  "doc_id": "1046895208953942016",
  "title": "AI in Finance Report",
  "url": "https://reportify.cn/financials/1046895208953942016",
  "document_version": "sha256:7c12d1...",
  "chunks": [
    {
      "id": "605401659404358",
      "type": "text",
      "content": "AI in finance is transforming the industry...",
      "summary": null,
      "media_url": null,
      "metadata": {
        "document_page": 8,
        "bbox": {
          "left": 72,
          "top": 180,
          "right": 524,
          "bottom": 246
        }
      },
      "score": 0
    }
  ],
  "total_chunks": 143,
  "chunk_offset": 87,
  "next_chunk_offset": null
}
```

### 错误响应

| 状态码   | 描述                          |
| ----- | --------------------------- |
| `404` | 文档中不存在指定 chunk，或 chunk 已失效。 |
| `422` | 路径参数格式不正确。                  |


## OpenAPI

````yaml GET /v1/docs/{doc_id}/chunks/{chunk_id}
openapi: 3.1.0
info:
  title: Reportify API
  version: 1.0.0
  description: API documentation for Reportify's document management and search services.
servers:
  - url: https://api.reportify.cn
    description: Production server
security:
  - BearerAuth: []
paths:
  /v1/docs/{doc_id}/chunks/{chunk_id}:
    get:
      tags:
        - openapi-docs
      summary: Get Doc Chunk
      description: >-
        Retrieve one authority chunk by its stable chunk ID, together with the
        document metadata and current document version.
      operationId: get_doc_chunk_reportify_api_v1_docs__doc_id__chunks__chunk_id__get
      parameters:
        - required: true
          schema:
            type: string
            title: Doc Id
          name: doc_id
          in: path
        - required: true
          schema:
            type: string
            title: Chunk Id
          name: chunk_id
          in: path
      responses:
        '200':
          description: >-
            Successful Response. The chunks array contains exactly the requested
            chunk.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAIDocContentsResponse'
        '404':
          description: Document chunk not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    OAIDocContentsResponse:
      properties:
        doc_id:
          type: string
          title: Doc Id
        title:
          type: string
          title: Title
        url:
          type: string
          title: Url
        institution:
          type: string
          title: Institution
        author:
          type: string
          title: Author
        published_at:
          type: integer
          title: Published At
        category:
          $ref: '#/components/schemas/OAIDocCategory'
        market:
          $ref: '#/components/schemas/OAIMarket'
        ticker:
          type: string
          title: Ticker
        symbol:
          type: string
          title: Symbol
        company_name:
          type: string
          title: Company Name
        logo:
          type: string
          title: Logo
        companies:
          items:
            $ref: '#/components/schemas/CompanyLabel'
          type: array
          title: Companies
        tags:
          additionalProperties:
            items: {}
            type: array
          type: object
          title: Tags
        metadatas:
          additionalProperties:
            items: {}
            type: array
          type: object
          title: Metadatas
        report_type:
          type: integer
          title: Report Type
        channel_id:
          type: string
          title: Channel Id
        channel_name:
          type: string
          title: Channel Name
        file_url:
          type: string
          title: File Url
        media_url:
          type: string
          title: Media Url
        chunks:
          items:
            $ref: '#/components/schemas/OAIChunk'
          type: array
          title: Chunks
      type: object
      required:
        - doc_id
        - title
        - url
      title: OAIDocContentsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OAIDocCategory:
      type: string
      enum:
        - financials
        - transcripts
        - reports
        - news
        - files
        - filings
        - socials
        - global_research
      title: OAIDocCategory
      description: An enumeration.
    OAIMarket:
      type: string
      enum:
        - cn
        - hk
        - us
      title: OAIMarket
      description: An enumeration.
    CompanyLabel:
      properties:
        name:
          type: string
          title: Name
        logo:
          type: string
          title: Logo
        stocks:
          items:
            $ref: '#/components/schemas/CompanyStock'
          type: array
          title: Stocks
      type: object
      required:
        - name
      title: CompanyLabel
    OAIChunk:
      properties:
        id:
          type: string
          title: Id
        type:
          $ref: '#/components/schemas/OAIChunkType'
        media_url:
          type: string
          title: Media Url
        content:
          type: string
          title: Content
        summary:
          type: string
          title: Summary
        metadata:
          type: object
          title: Metadata
      type: object
      title: OAIChunk
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    CompanyStock:
      properties:
        symbol:
          type: string
          title: Symbol
        market:
          type: string
          title: Market
        code:
          type: string
          title: Code
      type: object
      required:
        - symbol
        - market
        - code
      title: CompanyStock
    OAIChunkType:
      type: string
      enum:
        - text
        - table
        - image
        - formula
      title: OAIChunkType
      description: An enumeration.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your Bearer token

````