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

# 更新工作流 API：编辑 KYC 流程

> 通过 API 编程更新 Didit KYC 或 KYB 工作流：重命名、替换有序功能或调整阈值。按次计费，无需签订合同。



更新工作流 API 提示词
        将提示词复制到剪贴板



      
      

\<pre>

\`Update a simple Didit workflow through the Management API.

Endpoint:
PATCH https://verification.didit.me/v3/workflows/{settings_uuid}/

Authentication:
Use the x-api-key header with my Didit API key.

Requirements:
\- Use PATCH and include only the fields I want to change.
\- To rename the workflow, send workflow_label only.
\- To change workflow checks, send the full desired features array. This replaces the previous feature order and config.
\- Do not send workflow_graph, branches, actions, webhooks, or conditional logic.
\- Send features in the exact execution order.
\- Use uppercase feature values such as OCR, LIVENESS, FACE_MATCH, AML, QUESTIONNAIRE, EMAIL_VERIFICATION, PHONE_VERIFICATION, or PROOF_OF_ADDRESS.
\- Configure each feature with the fields from /management-api/workflows/feature-configs.
\- For an OCR feature, omit config.documents_allowed or send an empty object to allow every supported document type. Send config.documents_allowed only to restrict the allowed documents.
\- Keep dependency order valid. For example, put OCR before FACE_MATCH.
\- If the workflow includes QUESTIONNAIRE, use the latest questionnaire_id as config.questionnaire_uuid.

Example metadata update body:
\{
"workflow_label": "Premium KYC"
}

Example full feature replacement body:
\{
"features": [
\{
  "feature": "OCR",
  "config": {
    "documents_allowed": {
      "USA": {
        "DL": {
          "enabled": 1,
          "sides": 2
        }
      }
    }
  }
},
\{
  "feature": "AML",
  "config": {
    "aml_score_review_threshold": 70,
    "aml_score_approve_threshold": 30
  }
}
]
}

Build the API call, handle validation errors, and return the updated workflow response.`

\</pre>



      
      

粘贴到

使用 `PATCH` 进行部分更新。要重命名工作流，只需发送 `workflow_label`。```json theme={null}
{
  "workflow_label": "Premium KYC"
}
```要更改工作流中的检查项，请发送完整的目标 `features` 数组。这会替换之前的功能顺序和配置。```json theme={null}
{
  "features": [
    {
      "feature": "OCR",
      "config": {
        "documents_allowed": {
          "USA": {
            "DL": {
              "enabled": 1,
              "sides": 2
            }
          }
        }
      }
    },
    {
      "feature": "AML",
      "config": {
        "aml_score_review_threshold": 70,
        "aml_score_approve_threshold": 30
      }
    }
  ]
}
```v3 API 让工作流保持简单：一条线性路径和一个最终状态步骤。此处不接受分支、操作节点和 Webhook 节点。## 功能配置参考在 `PATCH` 中发送 `features` 时，该数组会替换之前的功能顺序和配置。请重新包含所有必需的配置。`config` 对象的具体内容取决于功能。请在 [工作流功能配置](https://docs.didit.me/zh/management-api/workflows/feature-configs.md) 中查看完整的字段列表、默认值、必填设置、取值范围和示例。对于 `OCR`，省略 `config.documents_allowed`、发送 `null` 或发送 `{}`，即可允许所有受支持的证件类型。仅当您想将工作流限制为特定国家/地区或证件类型时，才需要包含该字段。对于 `QUESTIONNAIRE`，`config.questionnaire_uuid` 为必填项。## 更新工作流设置您可以在不修改功能列表的情况下更新会话级设置。只需发送您想更改的字段。| 字段 | 类型 | 说明 |
| - | - | - |
| `is_white_label_enabled` | 布尔值 | 为使用此工作流创建的会话启用白标定制。 |
| `is_desktop_allowed` | 布尔值 | 允许验证流程在桌面浏览器中运行。 |
| `max_retry_attempts` | 整数（0–10） | 验证被拒绝后允许的最大重试次数。`0` 表示用户在首次被拒绝后即被拦截。 |
| `retry_window_days` | 整数（1–365）或 `null` | 用于统计重试次数的滚动时间窗口（天）（`null` = 全时段限制）。 |
| `session_expiration_time` | 整数（3600–2419200） | 未完成会话过期前的秒数。最短 1 小时，最长 4 周。 |```json theme={null}
{
  "is_white_label_enabled": true,
  "is_desktop_allowed": true,
  "max_retry_attempts": 5,
  "retry_window_days": 14,
  "session_expiration_time": 86400
}
```将列表、创建或获取 endpoint 返回的工作流 `uuid` 用作此 URL 中的 `settings_uuid`。


## OpenAPI

````yaml zh/openapi-25.json PATCH /v3/workflows/{settings_uuid}/
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/workflows/{settings_uuid}/:
    patch:
      tags:
        - Workflows
      summary: 更新工作流
      description: >-
        更新工作流。版本控制取决于您发送的 `status` 字段以及该版本的当前状态：(1) **已发布**版本未传 `status` →
        已发布版本就地更新（相同的 `uuid`，相同的 `version`）；(2) **草稿**未传 `status` →
        草稿更新并立即发布；(3) **已发布**版本传入 `status: "published"` → 在同一个 `workflow_id`
        下创建并返回一个新的已发布版本（新的 `uuid`，`version` + 1），并删除该分组中现有的任何草稿；(4) `status:
        "draft"` 将草稿保持为草稿（自动保存），但若在已发布版本上操作则会被拒绝并返回 400（`"Cannot revert a
        published version to draft."`）。请求体接受与创建时相同的严格字段白名单 — 未知键将被拒绝并返回 400。
      operationId: update_workflow
      parameters:
        - name: settings_uuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 要更新的工作流版本 UUID。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SimpleWorkflowUpdateRequest'
            examples:
              Replace features:
                summary: 发送完整的预期功能顺序
                value:
                  features:
                    - feature: OCR
                    - feature: AML
              Rename:
                summary: 重命名工作流
                value:
                  workflow_label: Premium KYC
              Set as default:
                summary: 将此工作流设为应用的默认工作流
                value:
                  is_default: true
              Update config:
                summary: 更改功能配置
                value:
                  features:
                    - feature: OCR
                    - feature: LIVENESS
                      config:
                        face_liveness_method: passive
              Publish a draft:
                summary: 将草稿转为已发布
                value:
                  status: published
      responses:
        '200':
          description: >-
            工作流已更新。响应体为最终版本的完整配置（与 `GET /v3/workflows/{settings_uuid}/` 相同的原始
            `VerificationSettings` 结构）。当更新创建了新版本（在已发布的记录上发送了 `status:
            "published"`）时，返回的 `uuid` 和 `version` 会与您执行 PATCH 操作时的不同，后续调用请使用返回的
            `uuid`。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowDetail'
        '400':
          description: >-
            验证错误 — 存在白名单之外的顶层键、未知的功能、无效的排序、超出范围的阈值、引用了不存在的问卷、配置了 `SIGNATURE`
            功能但在上线时没有待签署的证件、新增了 `signature_level: "aes"` 的 `SIGNATURE`
            功能但高级（AES）不可用（`aes_not_available`，请参见工作流上的
            `signature_availability`；已存储 `aes` 的步骤将予以保留），或者对已发布的版本提交了 `status:
            "draft"`（`"Cannot revert a published version to
            draft."`）。响应体是以字段名为键的 DRF 验证错误。
        '403':
          description: API 密钥缺失或无效。
          content:
            application/json:
              examples:
                Invalid token:
                  value:
                    detail: You do not have permission to perform this action.
        '404':
          description: 已验证身份的应用中不存在具有此 `settings_uuid` 的工作流。
        '415':
          description: '不支持的媒体类型。请设置 `Content-Type: application/json`。'
        '429':
          description: 超出速率限制。请使用指数退避重试。
        '500':
          description: 意外服务器错误。可安全重试。
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >-
            curl -X PATCH
            'https://verification.didit.me/v3/workflows/a1b2c3d4-5678-90ab-cdef-111111111111/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"workflow_label": "Premium KYC"}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.workflows.update(
                "11111111-2222-3333-4444-555555555555",
                features=[{
                    "feature": "OCR",
                }, {
                    "feature": "AML",
                }],
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: >-
            import Didit from "@didit-protocol/sdk-node";


            // Reads DIDIT_API_KEY.

            const didit = new Didit();


            const result = await
            didit.workflows.update("11111111-2222-3333-4444-555555555555", {
              features: [{
                feature: "OCR",
              }, {
                feature: "AML",
              }],
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Workflows.Update(ctx, \"11111111-2222-3333-4444-555555555555\", didit.SimpleWorkflowUpdateRequest{\n\tFeatures: didit.Some([]didit.SimpleWorkflowFeature{{\n\t\tFeature: \"OCR\",\n\t}, {\n\t\tFeature: \"AML\",\n\t}}),\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import java.util.List;

            import me.didit.Didit;

            import me.didit.types.SimpleWorkflowFeature;

            import me.didit.types.SimpleWorkflowUpdateRequest;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.workflows().update("11111111-2222-3333-4444-555555555555",
            SimpleWorkflowUpdateRequest.builder()
                    .features(List.of(
                            SimpleWorkflowFeature.builder()
                                    .feature(SimpleWorkflowFeature.Feature.of("OCR"))
                                    .build(),
                            SimpleWorkflowFeature.builder()
                                    .feature(SimpleWorkflowFeature.Feature.of("AML"))
                                    .build()))
                    .build());
            System.out.println(result);
        - lang: php
          label: PHP
          source: >-
            <?php


            require 'vendor/autoload.php';


            use Didit\DiditClient;


            // Reads DIDIT_API_KEY.

            $didit = new DiditClient();


            $result =
            $didit->workflows->update('11111111-2222-3333-4444-555555555555', [
                'features' => [[
                    'feature' => 'OCR',
                ], [
                    'feature' => 'AML',
                ]],
            ]);

            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

            # Reads DIDIT_API_KEY.
            didit = Didit::Client.new

            result = didit.workflows.update(
              "11111111-2222-3333-4444-555555555555",
              features: [{
                feature: "OCR",
              }, {
                feature: "AML",
              }]
            )
            puts result.to_h
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using System.Text.Json;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            var result = await
            client.Workflows.UpdateAsync("11111111-2222-3333-4444-555555555555",
            new SimpleWorkflowUpdateRequest

            {
                Features = new SimpleWorkflowFeature[]
                {
                    new()
                    {
                        Feature = "OCR",
                    },
                    new()
                    {
                        Feature = "AML",
                    },
                },
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    SimpleWorkflowUpdateRequest:
      type: object
      description: 更新工作流元数据或替换完整的线性功能列表。严格的字段白名单：此处未列出的任何键都将被拒绝并返回 400。
      properties:
        workflow_label:
          type: string
          maxLength: 50
          description: 工作流的显示名称（最多 50 个字符）。
        is_default:
          type: boolean
          description: 将此工作流设为新会话的默认工作流。
        status:
          type: string
          enum:
            - draft
            - published
          description: >-
            控制版本管理。省略此项将就地更新当前版本（草稿会自动发布）。对已发布的版本传入 `published`
            将创建并返回新版本。`draft` 仅在当前版本仍为草稿时有效。
        features:
          type: array
          minItems: 1
          description: 如果提供，将替换完整的功能顺序和配置。
          items:
            $ref: '#/components/schemas/SimpleWorkflowFeature'
        is_white_label_enabled:
          type: boolean
          description: 为使用此工作流创建的会话启用白标定制。
        is_desktop_allowed:
          type: boolean
          description: 允许验证流程在桌面端浏览器上运行。
        max_retry_attempts:
          type: integer
          minimum: 0
          maximum: 10
          description: 验证被拒绝后允许的最大重试次数。`0` 表示在首次拒绝后即阻止用户。
        retry_window_days:
          type: integer
          minimum: 1
          maximum: 365
          nullable: true
          description: 用于计算重试次数的滑动时间窗口，以天为单位。`null` 执行历史累计限制。
        face_liveness_max_attempts:
          type: integer
          minimum: 1
          maximum: 3
          description: 每次会话允许的最大活体检测提交次数。除非功能级配置覆盖，否则该值也会复制到生成的活体检测和年龄估算工作流节点中。
        face_match_max_attempts:
          type: integer
          minimum: 1
          maximum: 3
          description: 每次会话允许的最大人脸比对提交次数。除非功能级配置覆盖，否则该值也会复制到生成的人脸比对工作流节点中。
        session_expiration_time:
          type: integer
          minimum: 3600
          maximum: 2419200
          description: 未完成会话过期前的秒数。最短 1 小时（3600），最长 4 周（2419200）。
    WorkflowDetail:
      type: object
      description: >-
        以下字段均为类型化字段；该对象还包含工作流配置的每个其他列（功能开关、阈值、警告操作、允许的证件、回调）作为附加属性。不适用于该
        `workflow_type` 的字段为 `null`。
      properties:
        uuid:
          type: string
          format: uuid
          description: 每个版本对应的标识符（`settings_uuid`）。工作流的每个版本都有其独有的标识符。
        workflow_id:
          type: string
          format: uuid
          description: 工作流所有版本共享的稳定标识符。使用它创建的会话将采用最新发布的版本。
        workflow_label:
          type: string
          description: 工作流的显示名称。
        workflow_type:
          type: string
          nullable: true
          enum:
            - kyc
            - kyb
            - adaptive_age_verification
            - biometric_authentication
            - address_verification
            - questionnaire_verification
            - email_verification
            - phone_verification
            - null
          description: 工作流模板。对于未使用模板创建的图谱工作流为 `null`。
        is_default:
          type: boolean
          description: 这是否为该应用的默认工作流。
        is_archived:
          type: boolean
          description: 已归档的工作流无法启动新会话。
        version:
          type: integer
          description: 工作流内的版本号。
        status:
          type: string
          enum:
            - draft
            - published
          description: 草稿版本可编辑；已发布版本不可更改，并用于新会话。
        published_at:
          type: string
          format: date-time
          nullable: true
          description: 此版本发布的时间。草稿为 `null`。
        is_simple_workflow:
          type: boolean
          description: 当工作流没有自定义 `workflow_graph` 时为 `true`。
        is_editable:
          type: boolean
          description: 仅对 `draft` 版本为 `true`。
        workflow_url:
          type: string
          format: uri
          description: 启动此工作流会话的公开 URL。
        workflow_graph:
          type: object
          nullable: true
          additionalProperties: true
          description: 工作流的图谱结构（节点和边）。简单工作流为 `null`。
        features:
          type: string
          description: 用 `" + "` 连接的已启用功能，例如 `"OCR + LIVENESS"`。
        total_price:
          type: number
          nullable: true
          description: 每次会话的价格；对于图谱工作流，为最昂贵路径的价格。
        min_price:
          type: number
          nullable: true
          description: 工作流中最便宜路径的价格。
        max_price:
          type: number
          nullable: true
          description: 工作流中最昂贵路径的价格。
        special_add_on_prices:
          type: object
          nullable: true
          additionalProperties: true
          description: 特定于组织的附加项价格，未设置时为 `null`。
        max_retry_attempts:
          type: integer
          description: 验证被拒绝后允许的重试次数。
        retry_window_days:
          type: integer
          nullable: true
          description: 允许重试的天数。
        session_expiration_time:
          type: integer
          description: 未完成会话过期前的秒数。
        questionnaire:
          type: object
          nullable: true
          additionalProperties: true
          description: 附加到工作流的问卷，或为 `null`。
        kyb_role_settings:
          type: array
          items:
            type: object
            additionalProperties: true
          description: 针对 KYB 关键人员的按角色验证设置。
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        signature_availability:
          type: object
          description: >-
            当前哪些电子签名等级可以签署。在设置 `signature_level` 之前请检查此项。在 `kyc`、`kyb`
            和图谱工作流中返回。
          properties:
            simple:
              type: boolean
              description: Simple 始终可用。
            aes:
              type: boolean
              description: >-
                高级电子签名（AES）当前是否可以签署。当其为 `false` 时，若保存带有 `signature_level: "aes"`
                的新步骤，将因 `aes_not_available` 而被拒绝。
            qes:
              type: boolean
              description: 合格电子签名（QES）当前是否可以签署。在连接合格提供商之前，该值为 `false`。
        is_bank_verification_enabled:
          type: boolean
          description: >-
            简易 KYC 或 KYB 工作流是否运行银行验证。它在联系方式步骤（以及位置验证）之后、数据库核验、AML 及 IP
            分析之前运行。银行验证目前尚未正式公开发布：在未启用的情况下开启将被拒绝。
        bank_verification_config:
          type: object
          additionalProperties: true
          description: >-
            简单工作流的银行验证设置，包含与 `BANK_VERIFICATION` 节点相同的键（例如 `bank_countries` 和
            `bank_method_order`）。未知键将被丢弃。每个键均为可选，缺少的键保持其默认值，因此 `{}`
            表示全部使用默认值。参见[银行验证设置](/zh/management-api/workflows/feature-configs#银行验证)。
          example: {}
        is_geolocation_enabled:
          type: boolean
          description: 简易 KYC 工作流是否运行位置验证。它在联系方式步骤之后、银行验证和数据库核验之前运行。企业（KYB）工作流无法运行该验证。
        geolocation_config:
          type: object
          additionalProperties: true
          description: >-
            简易工作流的位置验证设置，具有与 `GEOLOCATION` 节点相同的键（例如
            `is_geolocation_geofencing_enabled` 和
            `geolocation_max_attempts`）。未知的键将被丢弃。每个键都是可选的，缺少的键保持其默认值，因此 `{}`
            表示全部使用默认值。
          example: {}
      additionalProperties: true
    SimpleWorkflowFeature:
      type: object
      required:
        - feature
      properties:
        feature:
          type: string
          description: 要运行的功能。请使用此处显示的大写值。
          enum:
            - OCR
            - NFC
            - LIVENESS
            - FACE_MATCH
            - PROOF_OF_ADDRESS
            - QUESTIONNAIRE
            - DOCUMENT_AI
            - PHONE_VERIFICATION
            - EMAIL_VERIFICATION
            - DATABASE_VALIDATION
            - AML
            - IP_ANALYSIS
            - AGE_ESTIMATION
            - KYB_REGISTRY
            - KYB_DOCUMENTS
            - KYB_KEY_PEOPLE
            - SIGNATURE
        config:
          type: object
          description: >-
            特定功能的设置。对于 `QUESTIONNAIRE`，请在 `questionnaire_uuid` 中传入问卷创建 endpoint
            返回的 `questionnaire_id`。对于 `SIGNATURE`，上线的工​​作流需要待签署的证件：将
            `signature_documents_source` 设置为 `session` 或 `both` 以便每次会话自带证件，或者发送
            `status: "draft"` 并在发布前添加证件。当工作流上的 `signature_availability.aes` 为
            `false` 时，`signature_level: "aes"` 会被拒绝并返回 `aes_not_available`。对于
            `OCR`，`methods`
            用于选择每个国家/地区可以使用的身份证件验证方法（证件采集、针对政府或其他权威来源的非证件查询，以及数字身份钱包）；如果省略，则所有国家/地区仅支持证件采集。对于
            `SIGNATURE`，请参阅[电子签名设置](/zh/management-api/workflows/feature-configs#电子签名)：`signature_level`
            目前接受 `simple`（默认值，无需身份证件验证、邮箱或电话）和 `aes`，工作流证件及其字段在控制台中管理，因此通过 API
            请使用 `signature_documents_source: "session"` 按每次会话发送证件和字段。
          additionalProperties: true
        label:
          type: string
          description: 此工作流节点的可选内部标签。
  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.