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

# 初始化项目导入并检查重复项目

> 根据当前租户和 PDF MD5 检查重复项目，并决定是否需要上传文件。

- `data.decision=REUSE_PROJECT`：已找到相同 PDF 对应的有效项目。调用方应停止上传并使用 `data.recommendedProjectId`。`data.projects` 包含全部候选及其最近 N1 状态。
- `data.decision=UPLOAD_REQUIRED`：未找到重复项目。调用方按 `data.backend` 和上传会话信息上传文件。

重复判断限定在当前租户，依据是文件内容 MD5。它不会识别同一企业的不同版本 PDF。`forceCreateProject` 默认并建议保持为 `false`。



## OpenAPI

````yaml /specs/bp-agent-account.openapi.json post /api/project-imports/init
openapi: 3.1.0
info:
  title: BP-Agent Account API
  description: BP-Agent 账号接口：项目导入与重复复用、N1 打标及项目卡读取。除登录和刷新外，接口使用账号 JWT 鉴权。
  contact:
    name: BP Agent 开发团队
    email: support@bpagent.com
  license:
    name: MIT License
    url: https://opensource.org/licenses/MIT
  version: 1.0.0
servers:
  - url: https://bptest.mapleai.cc
    description: 测试环境（仅 relay 上传）
  - url: https://project.mapleai.cc
    description: 生产环境（OSS；STS 直传需服务端启用）
security: []
paths:
  /api/project-imports/init:
    post:
      tags:
        - 项目导入 / Project Imports
      summary: 初始化项目导入并检查重复项目
      description: >-
        根据当前租户和 PDF MD5 检查重复项目，并决定是否需要上传文件。


        - `data.decision=REUSE_PROJECT`：已找到相同 PDF 对应的有效项目。调用方应停止上传并使用
        `data.recommendedProjectId`。`data.projects` 包含全部候选及其最近 N1 状态。

        - `data.decision=UPLOAD_REQUIRED`：未找到重复项目。调用方按 `data.backend`
        和上传会话信息上传文件。


        重复判断限定在当前租户，依据是文件内容 MD5。它不会识别同一企业的不同版本 PDF。`forceCreateProject` 默认并建议保持为
        `false`。
      operationId: init_project_import_api_project_imports_init_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProjectImportInitRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_dict_'
              examples:
                reuseProject:
                  summary: 发现重复项目
                  value:
                    code: 0
                    message: 已找到相同 BP 对应的项目
                    data:
                      decision: REUSE_PROJECT
                      fileMd5: 507e5bcffa043764bffeff67d4e5b595
                      sourceFile:
                        fileId: source-file-uuid-or-null
                        fileName: demo.pdf
                        fileSize: 2097736
                        md5: 507e5bcffa043764bffeff67d4e5b595
                      recommendedProjectId: project-uuid
                      projects:
                        - projectId: project-uuid
                          latestActureRunId: n1-run-uuid-or-null
                          latestActureRunStatus: SUCCEEDED
                          latestSucceededActureRunId: n1-run-uuid-or-null
                          latestSucceededActureRunStatus: SUCCEEDED
                uploadRequired:
                  summary: 需要上传文件
                  value:
                    code: 0
                    message: 需要上传 BP 文件
                    data:
                      decision: UPLOAD_REQUIRED
                      backend: local
                      sessionId: upload-session-uuid
                      chunkSize: 2097152
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ProjectImportInitRequest:
      properties:
        fileName:
          type: string
          minLength: 1
          title: Filename
        fileSize:
          type: integer
          exclusiveMinimum: 0
          title: Filesize
        md5:
          type: string
          minLength: 1
          title: Md5
        forceCreateProject:
          type: boolean
          title: Forcecreateproject
          default: false
      type: object
      required:
        - fileName
        - fileSize
        - md5
      title: ProjectImportInitRequest
    SuccessResponse_dict_:
      properties:
        code:
          type: integer
          title: Code
          description: 响应码，成功时为0
          default: 0
        message:
          type: string
          title: Message
          description: 成功消息
          default: 操作成功
        data:
          type: object
          title: Data
          description: 响应数据
        timestamp:
          anyOf:
            - type: integer
            - type: 'null'
          title: Timestamp
          description: 响应时间戳（可选）
      type: object
      title: SuccessResponse[dict]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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:
    HTTPBearer:
      type: http
      scheme: bearer

````