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

# 提交项目导入并再次检查重复项目

> 验证已上传文件并提交项目导入。

- `data.decision=PROJECT_CREATED`：项目创建成功，保存 `data.projectId`。
- `data.decision=REUSE_PROJECT`：init 之后有其他请求先完成相同 MD5 的入库。调用方应使用 `data.recommendedProjectId`，不能假定 commit 一定创建新项目。

每个新的业务请求应生成唯一 `Idempotency-Key`，同一次请求的超时重试必须复用原 key。`forceCreateProject=true` 会绕过默认重复复用，仅在业务明确需要独立项目时使用。



## OpenAPI

````yaml /specs/bp-agent-account.openapi.json post /api/project-imports/commit
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/commit:
    post:
      tags:
        - 项目导入 / Project Imports
      summary: 提交项目导入并再次检查重复项目
      description: >-
        验证已上传文件并提交项目导入。


        - `data.decision=PROJECT_CREATED`：项目创建成功，保存 `data.projectId`。

        - `data.decision=REUSE_PROJECT`：init 之后有其他请求先完成相同 MD5 的入库。调用方应使用
        `data.recommendedProjectId`，不能假定 commit 一定创建新项目。


        每个新的业务请求应生成唯一 `Idempotency-Key`，同一次请求的超时重试必须复用原
        key。`forceCreateProject=true` 会绕过默认重复复用，仅在业务明确需要独立项目时使用。
      operationId: commit_project_import_api_project_imports_commit_post
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProjectImportCommitRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_dict_'
              examples:
                projectCreated:
                  summary: 项目创建成功
                  value:
                    code: 0
                    message: 项目导入成功
                    data:
                      decision: PROJECT_CREATED
                      projectId: project-uuid
                      projectStatus: UPLOADED
                      idempotentReplay: false
                reuseProject:
                  summary: 并发入库后复用已有项目
                  value:
                    code: 0
                    message: 已找到相同 BP 对应的项目
                    data:
                      decision: REUSE_PROJECT
                      fileMd5: 507e5bcffa043764bffeff67d4e5b595
                      recommendedProjectId: project-uuid
                      projects:
                        - projectId: project-uuid
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ProjectImportCommitRequest:
      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
        sessionId:
          type: string
          minLength: 1
          title: Sessionid
        storage:
          $ref: '#/components/schemas/ProjectImportStorage'
        idempotencyKey:
          anyOf:
            - type: string
              maxLength: 100
            - type: 'null'
          title: Idempotencykey
      type: object
      required:
        - fileName
        - fileSize
        - md5
        - sessionId
        - storage
      title: ProjectImportCommitRequest
    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
    ProjectImportStorage:
      properties:
        backend:
          type: string
          title: Backend
        objectKey:
          anyOf:
            - type: string
            - type: 'null'
          title: Objectkey
        etag:
          anyOf:
            - type: string
            - type: 'null'
          title: Etag
      type: object
      required:
        - backend
      title: ProjectImportStorage
    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

````