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

# 上传类别样本

> 为指定文件类别批量上传样本文件。单次请求最多上传 20 个；上传后该类别的样本总数不能超过 20 个。



## OpenAPI

````yaml /docflow/cn/rest-api/openapi.bundle.yaml post /api/app-api/sip/platform/v2/category/sample/batch_upload
openapi: 3.0.0
info:
  title: DocFlow API
  description: DocFlow REST API，提供文件上传和获取文件处理结果能力
  version: 2.14.1
servers:
  - url: https://docflow.textin.com
security:
  - ApiId: []
    SecretCode: []
paths:
  /api/app-api/sip/platform/v2/category/sample/batch_upload:
    post:
      tags:
        - 文件类别样本
      summary: 上传类别样本
      description: 为指定文件类别批量上传样本文件。单次请求最多上传 20 个；上传后该类别的样本总数不能超过 20 个。
      operationId: batchUploadCategorySample
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                workspace_id:
                  type: string
                  description: 空间ID
                  example: '1234567890'
                category_id:
                  type: string
                  description: 文件类别ID
                  example: '1234567890'
                files:
                  type: array
                  description: 本次上传的样本文件列表，单次最多 20 个；实际可上传数量还受该类别已有样本数限制
                  items:
                    type: string
                    format: binary
                  minItems: 1
                  maxItems: 20
                with_detail:
                  type: boolean
                  description: 传 true 时响应返回该分类的全部样本列表
              required:
                - workspace_id
                - category_id
                - files
      responses:
        '200':
          description: 批量上传成功
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/CodeMessage'
                  - type: object
                    properties:
                      result:
                        type: object
                        properties:
                          samples:
                            type: array
                            description: 该分类的全部样本列表（with_detail=true 时返回）
                            items:
                              $ref: '#/components/schemas/CategorySample'
components:
  schemas:
    CodeMessage:
      type: object
      properties:
        code:
          type: integer
          description: 状态码
          example: 200
        msg:
          type: string
          description: 状态描述
      required:
        - code
        - msg
    CategorySample:
      type: object
      description: 文件类别样本
      properties:
        sample_id:
          type: string
          description: 样本ID
          example: '1234567890'
        file_name:
          type: string
          description: 文件名
          example: invoice_sample.pdf
      required:
        - sample_id
        - file_name
  securitySchemes:
    ApiId:
      type: apiKey
      in: header
      name: x-ti-app-id
    SecretCode:
      type: apiKey
      in: header
      name: x-ti-secret-code

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.