> ## 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.

# Docs by Tags

> Retrieve docs for the specified tags

## 根据标签获取文档

**URL**: `/v1/docs/tags`\
**方法**: `POST`\
**描述**: 根据指定标签（tag）获取相关文档。

### 请求参数

| 参数名         | 类型    | 描述                                                                                                                               |
| ----------- | ----- | -------------------------------------------------------------------------------------------------------------------------------- |
| categories  | array | 文档类别（默认不包含 `files`），可选值有 `financials`，`transcripts`，`reports`（国内研报），`global_research`（外资研报），`filings`，`news`, `socials`，`files`。 |
| language    | str   | 搜索语言，支持值为 `all`，`chinese`，`english`。*暂未支持*                                                                                       |
| tags        | array | 标签数组，例如 `["AI", "Chips"]`。                                                                                                       |
| page\_num   | int   | 当前页码，默认值为 `1`。                                                                                                                   |
| page\_size  | int   | 每页条目数，默认值为 `10`。                                                                                                                 |
| start\_date | str   | 开始日期，格式为 `YYYY-MM-DD`。                                                                                                           |
| end\_date   | str   | 结束日期，格式为 `YYYY-MM-DD`。                                                                                                           |

### 响应参数

| 参数名             | 类型    | 描述                                                                                                      |
| --------------- | ----- | ------------------------------------------------------------------------------------------------------- |
| page\_num       | int   | 当前页码。                                                                                                   |
| page\_size      | int   | 每页条目数。                                                                                                  |
| total\_page     | int   | 总页数。                                                                                                    |
| total\_count    | int   | 总条目数。                                                                                                   |
| docs            | array | 文档数组，每个文档包含以下字段：                                                                                        |
|   id            | str   | 文档唯一 ID。                                                                                                |
|   title         | str   | 文档标题。                                                                                                   |
|   url           | str   | 文档网页链接。                                                                                                 |
|   institution   | str   | 发布机构。                                                                                                   |
|   author        | str   | 作者。                                                                                                     |
|   published\_at | str   | 发布时间，格式为 `YYYY-MM-DDTHH:MM:SS.000Z`。                                                                    |
|   category      | str   | 文档类别（`financials`, `transcripts`, `reports`, `global_research`, `filings`, `news`, `socials`, `files`）。 |
|   market        | str   | 市场区域（`cn`, `hk`, `us`）。                                                                                 |
|   symbol        | str   | 股票代码。                                                                                                   |
|   company\_name | str   | 公司名称。                                                                                                   |
|   logo          | str   | 公司 Logo 链接。                                                                                             |
|   summary       | str   | 文档摘要。*暂未支持*                                                                                             |
|   tags          | dict  | 标签数组。                                                                                                   |
|     key         | str   | 标签类型（如 `industry`, `company`, `person`, `event`）。                                                       |
|     value       | array | 标签内容数组。                                                                                                 |
|   metadatas     | dict  | 元数据数组，包含以下字段：                                                                                           |
|     key         | str   | 元数据类型（如 `periods`, `entities`）。                                                                         |
|     value       | array | 元数据内容数组。                                                                                                |

### 请求示例

**cURL**

```bash theme={null}
curl -X POST "https://api.reportify.cn/v1/docs/tags" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "tags": ["AI", "Chips"], 
    "categories": ["financials", "transcripts"], 
    "start_date": "2024-01-01", 
    "end_date": "2024-12-31", 
    "page_num": 1, 
    "page_size": 10
}'
```

**Python 示例**

```python theme={null}
import requests

url = "https://api.reportify.cn/v1/docs/tags"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {  
    "tags": ["AI", "Chips"],
    "categories": ["financials", "transcripts"],
    "start_date": "2024-01-01",
    "end_date": "2024-12-31",
    "page_num": 1,
    "page_size": 10
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
```

### 响应示例

```json theme={null}
{
  "page_num": 1,
  "page_size": 10,
  "total_page": 5,
  "total_count": 50,
  "docs": [
    {
      "id": "1046895208953942016",
      "title": "Apple Q4 Earnings Report",
      "url": "https://reportify.cn/financials/1046895208953942016",
      "file_url": "https://files.reportify.cn/media/production/TSLA5a08ddfbb97bd6486fff7a3875e7fe28_20241024183012.pdf",
      "media_url": "https://files.reportify.cn/media/production/s_4728833_9e25b61b62960211e6040eb2b81b352c.mp3",
      "institution": "Morgan Stanley",
      "author": "Jane Doe",
      "published_at": "2023-12-31T00:00:00.000Z",
      "category": "reports",
      "type": "research_report_company",
      "market": "us",
      "symbol": "AAPL",
      "company_name": "Apple Inc.",
      "logo": "https://files.reportify.cn/logo/AAPL.svg",
      "summary": "This report covers Apple's earnings in Q4 2023...",
      "tags": {
        "key": "industry",
        "value": ["AI", "Chips"]
      },
      "metadatas": {
        "key": "periods",
        "value": ["Q4 2023"]
      }
    }
  ]
}
```


## OpenAPI

````yaml POST /v1/docs/tags
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/tags:
    post:
      tags:
        - openapi-docs
      summary: Query Docs By Tags
      description: Retrieve docs for the specified tags
      operationId: query_docs_by_tags_reportify_api_v1_docs_tags_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAIDocsTagsRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAISearchDocsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    OAIDocsTagsRequest:
      properties:
        page_num:
          type: integer
          title: Page Num
          default: 1
        page_size:
          type: integer
          title: Page Size
          default: 10
        categories:
          items:
            $ref: '#/components/schemas/OAIDocCategory'
          type: array
          default:
            - financials
            - transcripts
            - reports
            - news
            - filings
            - socials
        markets:
          items:
            $ref: '#/components/schemas/OAIMarket'
          type: array
          default: []
        start_date:
          type: string
          title: Start Date
        end_date:
          type: string
          title: End Date
        tags:
          additionalProperties:
            items: {}
            type: array
          type: object
          title: Tags
      type: object
      required:
        - tags
      title: OAIDocsTagsRequest
    OAISearchDocsResponse:
      properties:
        total_count:
          type: integer
          title: Total Count
          default: 0
        total_page:
          type: integer
          title: Total Page
          default: 0
        page_num:
          type: integer
          title: Page Num
          default: 1
        page_size:
          type: integer
          title: Page Size
          default: 10
        docs:
          items:
            anyOf:
              - $ref: '#/components/schemas/OAIDoc'
              - $ref: '#/components/schemas/OAIDocDetail'
          type: array
          title: Docs
          default: []
      type: object
      title: OAISearchDocsResponse
    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.
    OAIDoc:
      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
        summary:
          type: string
          title: Summary
          description: Two-line document summary
          nullable: true
      type: object
      required:
        - doc_id
        - title
        - url
      title: OAIDoc
    OAIDocDetail:
      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
      type: object
      required:
        - doc_id
        - title
        - url
      title: OAIDocDetail
    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
    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
    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
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your Bearer token

````