> ## 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 Upload Async

> OAI docs upload async

## 同步上传文档

**URL**: `/v1/docs/upload/async`\
**方法**: `POST`\
**描述**: 同步上传单篇报告文档至指定文件夹。

### 请求参数

| 参数名             | 类型    | 描述                                                |
| --------------- | ----- | ------------------------------------------------- |
| folder\_id      | str   | 目标文件夹 ID。                                         |
| docs            | array | 文档数组，每个文档包含以下字段：                                  |
|   name          | str   | 文档名称。                                             |
|   url           | str   | 文档的互联网 URL 路径。                                    |
|   published\_at | str   | 发布时间，格式为 millisecond timestamp `1712832000000`。   |
|   tags          | dict  | 标签数组。                                             |
|     key         | str   | 标签类型（如 `industry`, `company`, `person`, `event`）。 |
|     value       | array | 标签内容数组。                                           |
|   metadatas     | dict  | 元数据字典，包含以下字段：                                     |
|     key         | str   | 元数据类型（如 `periods`, `entities`）。                   |
|     value       | array | 元数据内容数组。                                          |

### 响应参数

| 参数名             | 类型    | 描述               |
| --------------- | ----- | ---------------- |
| docs            | array | 文档数组，每个文档包含以下字段： |
|   id            | str   | 文档唯一 ID          |
|   title         | str   | 文档标题             |
|   original\_url | str   | 文档原始URL          |

### 请求示例

**cURL**

```bash theme={null}
curl -X POST https://api.reportify.cn/v1/docs/upload/async \
-H "Authorization: Bearer 447460****09c9" \
-H "Content-Type: application/json" \
-d '{
    "folder_id": "folder_12345",
    "name": "Tesla AI Report",
    "url": "https://files.reportify.cn/tesla_report.pdf",
    "metadatas": {
      "periods": "Q4 2023",
      "entities": [
        "Tesla Inc.",
        "TSLA"
      ]
    }
}'
```

**Python 示例**

```python theme={null}
import requests

url = "https://api.reportify.cn/v1/docs/upload/async"
headers = {
    "Authorization": "Bearer 447460****09c9",
    "Content-Type": "application/json"
}
payload = {
    "folder_id": "folder_12345",
    "docs": [
        {
            "name": "Tesla AI Report",
            "url": "https://files.reportify.cn/tesla_report.pdf",
            "metadatas": {
                "periods": "Q4 2023",
                "entities": [
                    "Tesla Inc.",
                    "TSLA"
                ]
            }
        }
    ]
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```

### 响应示例

```json theme={null}
{
  "docs": [
    {
      "id": "doc_67890",
      "title": "Tesla AI Report",
      "original_url": "https://files.reportify.cn/tesla_report_uploaded.pdf"
    }
  ]
}
```


## OpenAPI

````yaml POST /v1/docs/upload/async
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/upload/async:
    post:
      tags:
        - openapi-files
      summary: Upload Docs Async
      description: OAI docs upload async
      operationId: upload_docs_async_reportify_api_v1_docs_upload_async_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAIDocsUploadRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAIDocsUploadResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    OAIDocsUploadRequest:
      properties:
        docs:
          items:
            $ref: '#/components/schemas/OAIDocsUrlRequest'
          type: array
          title: Docs
        folder_id:
          type: string
          title: Folder Id
          description: 文件夹ID，不传则使用默认文件夹
        pdf_parsing_mode:
          type: integer
          title: Pdf Parsing Mode
          description: 'pdf解析模式: 1-按页,3-按逻辑 @see PDFParsingModeEnum'
          default: 1
      type: object
      required:
        - docs
      title: OAIDocsUploadRequest
    OAIDocsUploadResponse:
      properties:
        docs:
          items:
            $ref: '#/components/schemas/OAIDocsIdResponse'
          type: array
          title: Docs
      type: object
      required:
        - docs
      title: OAIDocsUploadResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OAIDocsUrlRequest:
      properties:
        url:
          type: string
          title: Url
        name:
          type: string
          title: Name
          description: 文件名称，不传则使用URL中的文件名
        metadatas:
          type: object
          title: Metadatas
          description: 文档元数据，包含 period 和 entities
          example:
            period: 2023Q4
            entities:
              - 公司A
              - 公司B
        published_at:
          type: integer
          title: Published At
          description: 文档发布时间, 毫秒级时间戳
        tags:
          additionalProperties:
            items: {}
            type: array
          type: object
          title: Tags
          description: 文档标签列表
      type: object
      required:
        - url
      title: OAIDocsUrlRequest
    OAIDocsIdResponse:
      properties:
        id:
          type: string
          title: Id
        title:
          type: string
          title: Title
        original_url:
          type: string
          title: Original Url
      type: object
      required:
        - id
        - title
        - original_url
      title: OAIDocsIdResponse
    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
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your Bearer token

````