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

# 使用 AI 起草案件蓝图 API

> 通过 Didit 管理 API，根据提示生成未保存的案件蓝图草案，审核阶段与案件类型后，再单独保存所选策略设置。

Didit 的蓝图 AI 草稿 API 可将策略描述转换为未保存的审核策略提案。
请使用 `x-api-key` 以及应用的 `write:cases` 权限，以进行身份验证。

## 生成并审阅提案

发送一个非空白的 `prompt`，长度不超过 4000 个字符。响应状态码为 `200`，返回的是 `draft` 对象，而不是已保存的案件蓝图或 UUID。

```json theme={null}
{"prompt": "Draft an AML review policy with triage and evidence review stages."}
```

提案可以包含 `name`、`description`、`applies_to`、`content_config`、`require_resolution_note`、`assignment_method`、`max_active_cases` 和 `default_deadline_hours` 字段。部分字段可能不存在，因此使用前请务必审阅响应内容。顶层提案不包括处理人列表、审批设置和路由引用。

保存前，请自行选择处理人、团队、审批和路由。如果生成的阶段包含 `worked_by`，应用会将其验证为一个已启用的审核团队 UUID；不要把提案视为已批准的指派。

审阅后，使用[创建案件蓝图](https://docs.didit.me/zh/management-api/case-blueprints/create.md)，并填写其必填的 `name` 和非空的 `assignee_pool`。生成提案不会保存策略草稿、发布策略，也不会修改现有案件。[已保存草稿与发布流程](https://docs.didit.me/zh/console/case-management/blueprints.md#保存并发布策略变更)与此相互独立。

## 错误

| 状态 | 含义 |
| - | - |
| `400` | 提示词缺失、为空或超出长度限制 |
| `401` / `403` | 缺少身份验证或权限 |
| `404` | 未找到应用 |
| `503` | 生成失败，或生成的提案未通过校验；请稍后重试 |

生成失败时返回：

```json theme={null}
{"detail": "A blueprint draft could not be generated. Please try again."}
```

## 相关内容

* [列出案件蓝图](https://docs.didit.me/zh/management-api/case-blueprints/list.md)
* [蓝图设置与审核策略](https://docs.didit.me/zh/console/case-management/blueprints.md)


## OpenAPI

````yaml zh/openapi-25.json POST /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/ai-draft/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: 身份证件验证 API。使用 x-api-key 请求头进行身份验证。
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/organization/{organization_id}/application/{application_id}/cases/blueprints/ai-draft/:
    post:
      tags:
        - Case Blueprints
      summary: 使用 AI 草拟案件蓝图
      description: >-
        生成未保存的蓝图提案。需要 write:cases 权限。返回草稿对象，而非蓝图
        UUID；不会创建蓝图或已保存的策略草稿。请审阅提案，选择负责人以及任何团队、审批或路由设置，然后再单独创建或更新蓝图。生成的内容无效或生成失败时返回
        503。请参阅[蓝图 AI 草稿](/zh/management-api/case-blueprints/ai-draft)。
      operationId: draft_case_blueprint
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 组织 UUID。
        - name: application_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 应用 UUID。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CaseBlueprintAiDraftRequest'
            example:
              prompt: >-
                Draft an AML review policy with triage and evidence review
                stages.
      responses:
        '200':
          description: 未保存的提案。未更改任何状态。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CaseBlueprintAiDraftResponse'
              example:
                draft:
                  name: AML review
                  applies_to:
                    - AML
                  require_resolution_note: true
                  content_config:
                    stages:
                      items:
                        - key: triage
                          label: Triage
                          sla_hours: 24
        '400':
          description: prompt 缺失、为空白或超过 4000 个字符。
        '401':
          description: 需要身份验证。
        '403':
          description: 需要 write:cases 权限。
        '404':
          description: 未找到应用。
        '503':
          description: 生成失败或生成了无效提案。请稍后重试。
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    type: string
              example:
                detail: A blueprint draft could not be generated. Please try again.
      security:
        - ApiKeyAuth: []
      x-codeSamples: []
components:
  schemas:
    CaseBlueprintAiDraftRequest:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          minLength: 1
          maxLength: 4000
          description: 拟提议的审核策略描述，不得为空。
          example: Draft an AML review policy with triage and evidence review stages.
    CaseBlueprintAiDraftResponse:
      type: object
      required:
        - draft
      properties:
        draft:
          $ref: '#/components/schemas/CaseBlueprintAiDraft'
    CaseBlueprintAiDraft:
      type: object
      additionalProperties: false
      description: 未保存、已验证的提案。字段均为可选；请检查结果，并在保存前选择负责人、团队和路由。
      properties:
        name:
          type: string
          maxLength: 24
          description: 最多 24 个字符，例如“AML 调查”。
        description:
          type: string
          nullable: true
        content_config:
          $ref: '#/components/schemas/CaseContentConfig'
        require_resolution_note:
          type: boolean
        assignment_method:
          type: string
          enum:
            - MANUAL
            - AUTOMATIC
        max_active_cases:
          type: integer
          nullable: true
          minimum: 1
          description: 自动模式阈值：“分配此蓝图的案件少于 N 个”。
        default_deadline_hours:
          type: integer
          nullable: true
          minimum: 1
          maximum: 8760
          description: 新开启案件的默认截止时间。现有案件的截止时间保持不变。
        applies_to:
          $ref: '#/components/schemas/CaseBlueprintAppliesTo'
    CaseContentConfig:
      type: object
      description: 案件内容部分和可选的审核阶段。未知的部分或键将被拒绝。案件开启时会保存所接受的策略快照；之后对蓝图的编辑不会改写该快照。
      properties:
        checklist:
          type: object
          properties:
            enabled:
              type: boolean
            optional:
              type: boolean
              description: 为 true 时，可以在核对清单项未完成的情况下解决案件。
            items:
              type: array
              items:
                type: object
                properties:
                  label:
                    type: string
                    maxLength: 255
                  order:
                    type: integer
        aml_control:
          type: object
          properties:
            enabled:
              type: boolean
            financial:
              type: boolean
            identity:
              type: boolean
        identity:
          type: object
          properties:
            enabled:
              type: boolean
            personal_information:
              type: boolean
            applicant_tags:
              type: boolean
            contact_information:
              type: boolean
            risk_overview:
              type: boolean
            poi_documents:
              type: boolean
            poa_documents:
              type: boolean
        verifications:
          type: object
          properties:
            enabled:
              type: boolean
            summary:
              type: boolean
        reporting:
          type: object
          properties:
            enabled:
              type: boolean
            fiu_reports:
              type: boolean
        financial:
          type: object
          properties:
            enabled:
              type: boolean
            payment_methods:
              type: boolean
            transactions:
              type: boolean
        stages:
          type: object
          additionalProperties: false
          description: 有序的审核阶段。省略的阶段项或空阶段项使用默认阶段 Triage、Evidence review 和 Decision。
          properties:
            items:
              type: array
              maxItems: 10
              items:
                $ref: '#/components/schemas/CaseBlueprintStage'
              description: 最多十个阶段，且每个阶段的键各不相同。解决案件是状态变更，而不是阶段。
    CaseBlueprintAppliesTo:
      type: array
      maxItems: 6
      items:
        type: string
        enum:
          - GENERAL
          - VERIFICATION_REVIEW
          - BUSINESS_REVIEW
          - AML
          - TRANSACTION_MONITORING
          - DUPLICATES
      description: 本蓝图所描述的案件类型。创建和更新时可选；新蓝图默认为空列表。存储于所接受的案件策略快照中。
      example:
        - AML
    CaseBlueprintStage:
      type: object
      additionalProperties: false
      required:
        - label
      properties:
        key:
          type: string
          pattern: ^[a-z0-9_]{1,64}$
          description: 在策略内必须唯一。省略时从标签生成。解析得到的键是保留的。
          example: triage
        label:
          type: string
          minLength: 1
          maxLength: 64
          description: 非空的阶段标签。
          example: Triage
        sla_hours:
          type: integer
          minimum: 1
          maximum: 8760
          nullable: true
          description: 阶段 SLA（小时），无 SLA 时为 null。
          example: 24
        worked_by:
          type: string
          format: uuid
          nullable: true
          description: 可选，审核团队 UUID。非 null 值必须标识此应用中处于活动状态的团队。省略或使用 null 表示没有阶段团队。
          example: a0000000-0000-4000-8000-000000000001
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        您的应用 API 密钥，可在 Business Console 的“开发者 -> API
        密钥”中获取。主密钥拥有完整访问权限。指定名称的密钥可设置作用域：针对每个资源设为无权限、只读或读写，限定于特定工作流或已通过的会话、限定于
        IP 地址列表，以及设置到期日期。401 表示密钥错误、已撤销或已过期；403 表示未发送密钥、密钥无权访问该资源或操作，或请求来自其 IP
        列表之外的地址；在会话路由上返回 404 表示该会话不在该密钥允许的工作流或状态范围内。没有媒体访问权限的密钥获取到的图片、视频和 PDF
        URL 将为 null；没有会话写入权限的密钥获取到的会话链接和 token 将为 null。请参阅
        https://docs.didit.me/console/api-keys。

````

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