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

# 创建 KYB 关键人员草稿 API

> 在 Didit 的 KYB 会话关键人员列表中添加个人或企业，暂不声明。



## OpenAPI

````yaml zh/openapi-25.json POST /v3/session/{sessionId}/kyb/parties/drafts/
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/session/{sessionId}/kyb/parties/drafts/:
    post:
      tags:
        - Sessions
      summary: 创建 KYB 相关方草稿
      description: >-
        向您为此 KYB 会话准备的列表中添加一个参与方（个人或企业）。适用与托管关键人员界面相同的字段和规则：个人需要 `full_name` 或
        `first_name` 和 `last_name`、至少一个角色以及国籍；企业需要 `company_name` 并在
        `nationality` 中填写注册国家/地区。在调用 `POST
        /v3/session/{sessionId}/kyb/parties/submit/` 之前，不会申报任何内容，也不会进行计费。需要
        `write:businesses` 权限。
      operationId: post_v3_session_kyb_party_drafts
      parameters:
        - name: sessionId
          in: path
          required: true
          description: 企业验证（KYB）会话的 UUID。它必须属于 API 密钥所属的应用。
          schema:
            type: string
            format: uuid
            example: 33333333-4444-5555-6666-777777777777
        - name: node_id
          in: query
          required: false
          description: KYB 步骤的工作流节点。仅在工作流具有多个 KYB 节点时需要；默认情况下，Didit 会使用会话自身的节点。
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - entity_type
                - nationality
              properties:
                entity_type:
                  type: string
                  enum:
                    - person
                    - company
                  description: 该主体是个人还是公司。
                full_name:
                  type: string
                  maxLength: 255
                  description: 个人的姓名。发送此字段，或者发送 `first_name` 和 `last_name`。
                first_name:
                  type: string
                  maxLength: 128
                last_name:
                  type: string
                  maxLength: 128
                role:
                  type: string
                  enum:
                    - director
                    - non_executive_director
                    - secretary
                    - chairman
                    - ubo
                    - shareholder
                    - representative
                    - founder
                    - legal_advisor
                    - authorized_signatory
                    - trustee
                    - beneficiary
                    - settlor
                    - protector
                    - company_officer
                    - investor
                    - other
                  description: 当事方持有的角色。可与 `roles` 互换；两者都发送时将被合并。
                roles:
                  type: array
                  items:
                    type: string
                    enum:
                      - director
                      - non_executive_director
                      - secretary
                      - chairman
                      - ubo
                      - shareholder
                      - representative
                      - founder
                      - legal_advisor
                      - authorized_signatory
                      - trustee
                      - beneficiary
                      - settlor
                      - protector
                      - company_officer
                      - investor
                      - other
                  description: 该主体拥有的每个角色。人员至少需要一个角色（在此处或在 `role` 中）。
                position:
                  type: string
                  maxLength: 128
                  description: 个人的职位头衔。
                date_of_birth:
                  type: string
                  format: date
                  nullable: true
                company_name:
                  type: string
                  maxLength: 255
                  description: 企业相关方的名称。当 `entity_type` 为 `company` 时必填。
                registration_number:
                  type: string
                  maxLength: 100
                  description: 企业关联方的注册号。
                email:
                  type: string
                  format: email
                  description: 验证链接发送到的位置。当当事方必须完成验证时为必填项，这取决于工作流的角色设置和股权结构阈值。
                ownership_percent:
                  type: number
                  nullable: true
                  description: 该方拥有的公司股份比例。
                nationality:
                  type: string
                  maxLength: 100
                  description: 个人的国籍，或企业的注册国家/地区。每个当事方都必须提供此信息。
                phone_number:
                  type: string
                  maxLength: 32
                custom_fields:
                  type: object
                  additionalProperties: true
                  description: 工作流定义的附加字段。
                skip_verification:
                  type: boolean
                  default: false
                  description: 请求跳过此主体的验证。仅当主体的角色在工作流的“关键人员”设置中允许跳过时才有效。
            example:
              entity_type: person
              first_name: Ana
              last_name: Lopez
              roles:
                - ubo
                - director
              ownership_percent: 60
              nationality: MEX
              email: ana.lopez@example.com
              date_of_birth: '1984-06-12'
      responses:
        '201':
          description: 草稿已创建。
          content:
            application/json:
              schema:
                type: object
                required:
                  - draft_id
                  - created_at
                  - updated_at
                  - party
                properties:
                  draft_id:
                    type: string
                    format: uuid
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                    format: date-time
                  party:
                    type: object
                    required:
                      - entity_type
                      - nationality
                    properties:
                      entity_type:
                        type: string
                        enum:
                          - person
                          - company
                        description: 该主体是个人还是公司。
                      full_name:
                        type: string
                        maxLength: 255
                        description: 个人的姓名。发送此字段，或者发送 `first_name` 和 `last_name`。
                      first_name:
                        type: string
                        maxLength: 128
                      last_name:
                        type: string
                        maxLength: 128
                      role:
                        type: string
                        enum:
                          - director
                          - non_executive_director
                          - secretary
                          - chairman
                          - ubo
                          - shareholder
                          - representative
                          - founder
                          - legal_advisor
                          - authorized_signatory
                          - trustee
                          - beneficiary
                          - settlor
                          - protector
                          - company_officer
                          - investor
                          - other
                        description: 当事方持有的角色。可与 `roles` 互换；两者都发送时将被合并。
                      roles:
                        type: array
                        items:
                          type: string
                          enum:
                            - director
                            - non_executive_director
                            - secretary
                            - chairman
                            - ubo
                            - shareholder
                            - representative
                            - founder
                            - legal_advisor
                            - authorized_signatory
                            - trustee
                            - beneficiary
                            - settlor
                            - protector
                            - company_officer
                            - investor
                            - other
                        description: 该主体拥有的每个角色。人员至少需要一个角色（在此处或在 `role` 中）。
                      position:
                        type: string
                        maxLength: 128
                        description: 个人的职位头衔。
                      date_of_birth:
                        type: string
                        format: date
                        nullable: true
                      company_name:
                        type: string
                        maxLength: 255
                        description: 企业相关方的名称。当 `entity_type` 为 `company` 时必填。
                      registration_number:
                        type: string
                        maxLength: 100
                        description: 企业关联方的注册号。
                      email:
                        type: string
                        format: email
                        description: 验证链接发送到的位置。当当事方必须完成验证时为必填项，这取决于工作流的角色设置和股权结构阈值。
                      ownership_percent:
                        type: number
                        nullable: true
                        description: 该方拥有的公司股份比例。
                      nationality:
                        type: string
                        maxLength: 100
                        description: 个人的国籍，或企业的注册国家/地区。每个当事方都必须提供此信息。
                      phone_number:
                        type: string
                        maxLength: 32
                      custom_fields:
                        type: object
                        additionalProperties: true
                        description: 工作流定义的附加字段。
                      skip_verification:
                        type: boolean
                        default: false
                        description: 请求跳过此主体的验证。仅当主体的角色在工作流的“关键人员”设置中允许跳过时才有效。
              example:
                draft_id: 5b0d7a52-9d3e-4f0c-8c6a-0e5f3a1b2c4d
                created_at: '2026-10-31T10:00:00Z'
                updated_at: '2026-10-31T10:00:00Z'
                party:
                  entity_type: person
                  first_name: Ana
                  last_name: Lopez
                  roles:
                    - ubo
                    - director
                  ownership_percent: 60
                  nationality: MEX
                  email: ana.lopez@example.com
                  date_of_birth: '1984-06-12'
        '400':
          description: 参与方字段无效或缺少必填字段。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 便于人类阅读的错误消息。
              example:
                non_field_errors:
                  - Person parties require at least one role.
        '401':
          description: 作用域 API 密钥已过期。这是唯一返回 `401` 的情况：缺失、无效或已吊销的密钥将返回 `403`。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 便于人类阅读的错误消息。
              examples:
                Expired key:
                  summary: 密钥的到期日期已过
                  value:
                    detail: This API key has expired.
        '403':
          description: >-
            身份验证或授权失败。缺少密钥，以及属于其他应用的密钥、缺少该 endpoint 所需权限的限定作用域密钥和来自该密钥 IP
            允许名单之外的请求均返回 `403`；错误、已撤销或已过期的密钥返回 `401`。可通过 `detail` 区分它们。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 便于人类阅读的错误消息。
              examples:
                Missing or invalid credentials:
                  summary: 缺少 x-api-key 请求头，或该密钥验证失败
                  value:
                    detail: >-
                      Authentication credentials were not provided or are
                      invalid.
                Other application:
                  summary: 属于与该会话不同应用的有效密钥
                  value:
                    detail: You do not have permission to perform this action.
                Scoped key without decisions write:
                  summary: '作用域密钥缺少 decisions: write 权限'
                  value:
                    detail: This API key has no write access to decisions.
                IP not allowed:
                  summary: 来自密钥 IP 白名单之外的请求
                  value:
                    detail: This API key can't be used from this IP address.
        '404':
          description: 会话不存在、已被删除、属于另一个应用或超出了限定作用域密钥的限制；无法通过 detail 区分具体情况。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 便于人类阅读的错误消息。
              example:
                detail: Session not found.
        '409':
          description: 会话已完成（`kyb_session_not_writable`）。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 便于人类阅读的错误消息。
                  code:
                    type: string
              example:
                detail: This verification session is no longer accepting changes.
                code: kyb_session_not_writable
        '429':
          description: >-
            超出速率限制：每个 API 密钥每分钟 300 次写入（POST、PATCH、DELETE）请求。请等待 `Retry-After`
            秒后再重试；`X-RateLimit-*` 响应头显示了额度。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 便于人类阅读的错误消息。
              examples:
                Rate limited:
                  summary: 当前分钟的预算已耗尽
                  value:
                    detail: >-
                      Write request rate limit exceeded. You can make up to 300
                      requests per minute.
          headers:
            Retry-After:
              description: 重试前需要等待的秒数。
              schema:
                type: integer
                minimum: 1
                example: 30
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.sessions.create_kyb_party_draft(
                "33333333-4444-5555-6666-777777777777",
                entity_type="person",
                first_name="Ana",
                last_name="Lopez",
                roles=["ubo", "director"],
                date_of_birth="1984-06-12",
                email="ana.lopez@example.com",
                ownership_percent=60.0,
                nationality="MEX",
            )
            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.sessions.createKybPartyDraft("33333333-4444-5555-6666-777777777777",
            {
              entity_type: "person",
              first_name: "Ana",
              last_name: "Lopez",
              roles: ["ubo", "director"],
              date_of_birth: "1984-06-12",
              email: "ana.lopez@example.com",
              ownership_percent: 60.0,
              nationality: "MEX",
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Sessions.CreateKYBPartyDraft(ctx, \"33333333-4444-5555-6666-777777777777\", didit.SessionsCreateKYBPartyDraftParams{\n\tEntityType:       \"person\",\n\tFirstName:        didit.String(\"Ana\"),\n\tLastName:         didit.String(\"Lopez\"),\n\tRoles:            didit.Some([]didit.SessionsCreateKYBPartyDraftParamsRoles{\"ubo\", \"director\"}),\n\tDateOfBirth:      didit.String(\"1984-06-12\"),\n\tEmail:            didit.String(\"ana.lopez@example.com\"),\n\tOwnershipPercent: didit.Float(60.0),\n\tNationality:      \"MEX\",\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import java.time.LocalDate;

            import java.util.List;

            import me.didit.Didit;

            import me.didit.types.SessionsCreateKybPartyDraftParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.sessions().createKybPartyDraft("33333333-4444-5555-6666-777777777777",
            SessionsCreateKybPartyDraftParams.builder()
                    .entityType(SessionsCreateKybPartyDraftParams.EntityType.of("person"))
                    .firstName("Ana")
                    .lastName("Lopez")
                    .roles(List.of(SessionsCreateKybPartyDraftParams.Roles.of("ubo"), SessionsCreateKybPartyDraftParams.Roles.of("director")))
                    .dateOfBirth(LocalDate.parse("1984-06-12"))
                    .email("ana.lopez@example.com")
                    .ownershipPercent(60.0)
                    .nationality("MEX")
                    .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->sessions->createKybPartyDraft('33333333-4444-5555-6666-777777777777',
            [
                'entity_type' => 'person',
                'first_name' => 'Ana',
                'last_name' => 'Lopez',
                'roles' => ['ubo', 'director'],
                'date_of_birth' => '1984-06-12',
                'email' => 'ana.lopez@example.com',
                'ownership_percent' => 60.0,
                'nationality' => 'MEX',
            ]);

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

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

            result = didit.sessions.create_kyb_party_draft(
              "33333333-4444-5555-6666-777777777777",
              entity_type: "person",
              first_name: "Ana",
              last_name: "Lopez",
              roles: ["ubo", "director"],
              date_of_birth: "1984-06-12",
              email: "ana.lopez@example.com",
              ownership_percent: 60.0,
              nationality: "MEX"
            )
            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.Sessions.CreateKybPartyDraftAsync("33333333-4444-5555-6666-777777777777",
            new SessionsCreateKybPartyDraftParams

            {
                EntityType = "person",
                FirstName = "Ana",
                LastName = "Lopez",
                Roles = new SessionsCreateKybPartyDraftParamsRoles[] { "ubo", "director" },
                DateOfBirth = "1984-06-12",
                Email = "ana.lopez@example.com",
                OwnershipPercent = 60.0,
                Nationality = "MEX",
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  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.