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

# Didit 更新企业 API：修改企业 KYB 实体

> Didit 可更新企业（KYB）的可变字段：显示名称、元数据、标签。注册表衍生的身份字段不可修改。按次计费的 KYB 管理。



更新企业的提示词
        将提示词复制到剪贴板



      
      

\<pre>

\`Goal: Partial-update a Didit Business (KYB) entity by vendor_data.

Endpoint: PATCH https://verification.didit.me/v3/businesses/{vendor_data}/
Auth header: x-api-key: <DIDIT_API_KEY>
Content-Type: application/json

Path param:
\- vendor_data (string, REQUIRED) — free-form string, NOT a UUID. URL-encode.

Request body (PARTIAL — only included fields are touched; counters and session history are left alone):
\- display_name (string, nullable)
\- legal_name (string, nullable)
\- registration_number (string, nullable)
\- country_code (string, nullable) — ISO 3166-1 alpha-2.
\- region (string, nullable) — ISO 3166-2.
\- status (enum) — "ACTIVE" | "FLAGGED" | "BLOCKED" (VendorBusinessStatusChoices). Setting "BLOCKED" auto-adds vendor_data to the system blocklist.
\- metadata (object, nullable) — REPLACES existing metadata wholesale; merge client-side if you only want to add keys.
\- reason (string, optional, max 1000): why the status changed. Recorded on the status-change entry in the company's Activity in the Business Console, only when this update actually changes status. Webhooks do not carry it.

curl:
curl -X PATCH 'https://verification.didit.me/v3/businesses/company-123/' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"display_name": "Acme", "metadata": {"tier": "enterprise"}}'

Response 200: full updated BusinessDetailItem (same shape as GET). See /reference/data-models.

Side effects:
\- Every edit is recorded in the company's activity (actor derived from the API key): a status change with reason, and a profile update when display_name, legal_name, registration_number, country_code or metadata change.
\- last_activity_at bumped to now().
\- Re-sending an unchanged body is safe.

Failure modes:
\- 400 — validation. Common: { "status": ["Invalid status. Valid options are: ACTIVE, FLAGGED, BLOCKED"] }, { "metadata": ["Metadata must be a JSON object."] }
\{ "reason": ["Ensure this field has no more than 1000 characters."] }
\- 401 — missing/invalid x-api-key.
\- 403: a scoped API key without businesses write. { "detail": "This API key has no write access to companies." }
\- 404 — vendor_data not found.
\- 429 — rate-limited.

Notes:
\- vendor_data in the URL cannot be changed via this endpoint.
\- For status-only flips, prefer the dedicated PATCH /v3/businesses/{vendor_data}/update-status/.
\- Overriding registry-derived fields is allowed but flagged in the audit log.

For end-to-end Didit integration, paste in the full prompt at /integration/integration-prompt.`

\</pre>



      
      

粘贴到

## 概述更新[企业实体](https://docs.didit.me/zh/entities/businesses/overview.md)上的可变字段。从注册信息查询中填充的字段（`legal_name`、`registration_number`、`country_code`）在首次通过的企业验证（KYB）会话后变为只读。## 适用场景- **重命名**：设置更便于内部查看的 `display_name`。
- **更新元数据**：在内部等级之间调整企业的级别，记录内部备注，或更改标签。
- **覆盖注册信息**（请谨慎操作）：覆盖会被接受，但会在[审计日志](https://docs.didit.me/zh/console/audit-logs.md)中标记。## 注意事项- URL 中的 `vendor_data` 无法通过此 endpoint 更改。
- 会发出包含 `changed_fields` 数组的 `business.data.updated` Webhook。
- 每次编辑都会记录在 Business Console 中该公司的**活动**里。
  `status` 变更会记录可选的 `reason`（最多 1000 个字符）。对 `display_name`、`legal_name`、`registration_number`、`country_code` 或 `metadata` 的更改则记录为资料更新。
  `business.status.updated` Webhook 不包含 `reason`。## 权限主密钥和拥有完全访问权限的 [API 密钥](https://docs.didit.me/zh/console/api-keys.md)始终可以调用此 endpoint。
具有自定义访问权限的密钥需要具备**企业**（`businesses`）的写入权限。
仅限部分工作流或仅限已通过会话的密钥无法访问此 endpoint。Console 中的[角色与权限](https://docs.didit.me/zh/console/roles-permissions.md)决定团队成员在 Console 中可以执行的操作。这些设置不适用于 API 密钥请求。## 相关内容- [企业操作](https://docs.didit.me/zh/entities/businesses/operations.md)
- [数据模型](https://docs.didit.me/zh/entities/businesses/data-model.md)
- [更新状态](https://docs.didit.me/zh/management-api/businesses/update-status.md)


## OpenAPI

````yaml zh/openapi-25.json PATCH /v3/businesses/{vendor_data}/
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/businesses/{vendor_data}/:
    patch:
      tags:
        - Businesses
      summary: 更新企业
      description: >-
        企业的部分更新：`display_name`、`legal_name`、`registration_number`、`country_code`、`status`、`metadata`。`metadata`
        将完全替换。将 `status` 设置为 `BLOCKED` 会将 `vendor_data` 添加到系统黑名单；移出 `BLOCKED`
        则会移除该条目。每次修改都会记录在企业的活动记录中：状态变更带有可选的 `reason`，而对
        `display_name`、`legal_name`、`registration_number`、`country_code` 或
        `metadata` 的更改则记录为资料更新。
      operationId: update_business
      parameters:
        - name: vendor_data
          in: path
          required: true
          schema:
            type: string
          description: 您对该企业的唯一标识符（自由格式字符串，非 UUID）。
          example: company-123
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: 部分更新请求体。仅提供您想要更改的字段。
              properties:
                display_name:
                  type: string
                  nullable: true
                  description: 控制台中显示的易读显示名称（在界面显示时优先级高于 `legal_name`）。
                legal_name:
                  type: string
                  nullable: true
                  description: 来自登记处或手动输入的官方法定名称。
                registration_number:
                  type: string
                  nullable: true
                  description: 企业注册号或成立号。
                country_code:
                  type: string
                  nullable: true
                  description: 注册国家/地区（ISO 3166-1 alpha-2，例如 `GB`、`US`）。
                status:
                  type: string
                  enum:
                    - ACTIVE
                    - FLAGGED
                    - BLOCKED
                  description: >-
                    企业生命周期状态。设置为 `BLOCKED` 会自动将 `vendor_data` 添加至系统黑名单；从
                    `BLOCKED` 切出则会移除该黑名单条目。
                metadata:
                  type: object
                  nullable: true
                  description: 您附加到企业的任意 JSON 对象。更新时将**完全替换**现有元数据。如果仅想添加键，请在客户端进行合并。
                reason:
                  type: string
                  nullable: true
                  maxLength: 1000
                  description: >-
                    状态变更的原因。仅在状态实际变更时，记录在 Business Console 中该企业的 **Activity**
                    状态变更条目上。Webhook 不包含此项。
            examples:
              Update name:
                summary: 更新显示名称
                value:
                  display_name: Acme Corp
              Flag for review:
                summary: 切换状态
                value:
                  status: FLAGGED
              Add metadata:
                summary: 替换元数据 JSON
                value:
                  metadata:
                    industry: fintech
                    risk_level: low
              Fix registry data:
                summary: 提取的字段正确
                value:
                  legal_name: Acme Trading International Ltd
                  registration_number: '12345678'
                  country_code: GB
              Flag with reason:
                summary: 标记企业并记录原因
                value:
                  status: FLAGGED
                  reason: Ownership structure under review
      responses:
        '200':
          description: 企业已更新。返回完整的已更新企业记录。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusinessDetailItem'
              examples:
                Updated:
                  value:
                    didit_internal_id: a1b2c3d4-e5f6-4890-abcd-ef1234567890
                    vendor_data: company-123
                    display_name: Acme Corp
                    legal_name: Acme Trading Ltd
                    registration_number: '12345678'
                    country_code: GB
                    effective_name: Acme Corp
                    status: FLAGGED
                    session_count: 2
                    approved_count: 1
                    declined_count: 0
                    in_review_count: 1
                    features:
                      KYB: Approved
                    features_list:
                      - feature: KYB
                        status: Approved
                    last_session_at: '2026-03-15T10:30:00Z'
                    last_activity_at: '2026-03-15T10:30:00Z'
                    first_session_at: '2026-01-10T08:00:00Z'
                    tags:
                      - uuid: 9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d
                        name: VIP
                        color: '#2567FF'
                    created_at: '2026-01-10T08:00:00Z'
                    metadata:
                      industry: fintech
                      risk_level: low
                    updated_at: '2026-03-15T10:30:00Z'
        '400':
          description: 无效的请求体：通常是未知的 `status`、格式错误的 `metadata` 或超过 1000 个字符的 `reason`。
          content:
            application/json:
              examples:
                Bad status:
                  value:
                    status:
                      - >-
                        Invalid status. Valid options are: ACTIVE, FLAGGED,
                        BLOCKED
                Bad metadata:
                  value:
                    metadata:
                      - Metadata must be a JSON object.
                Reason too long:
                  value:
                    reason:
                      - Ensure this field has no more than 1000 characters.
        '403':
          description: >-
            缺少、无效或已撤销的 API 密钥，或者该密钥无法更新此应用的企业。缺少密钥返回 `403`；错误、已撤销或已过期的密钥返回
            `401`。
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    detail: You do not have permission to perform this action.
        '404':
          description: 该应用下不存在带有提供的 `vendor_data` 的（未删除）企业。
          content:
            application/json:
              examples:
                Not found:
                  value:
                    detail: Not found.
        '429':
          description: 超出速率限制；请退避并在 `Retry-After` 指定的间隔后重试。
          content:
            application/json:
              examples:
                Rate limited:
                  value:
                    detail: Request was throttled. Expected available in 30 seconds.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X PATCH
            'https://verification.didit.me/v3/businesses/company-123/' \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"display_name": "Acme Corp", "status": "FLAGGED"}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.businesses.update(
                "company-123",
                display_name="Acme Corp",
            )
            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.businesses.update("company-123", {
              display_name: "Acme Corp",
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Businesses.Update(ctx, \"company-123\", didit.BusinessesUpdateParams{\n\tDisplayName: didit.String(\"Acme Corp\"),\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import me.didit.Didit;

            import me.didit.types.BusinessesUpdateParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result = client.businesses().update("company-123",
            BusinessesUpdateParams.builder()
                    .displayName("Acme Corp")
                    .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->businesses->update('company-123', [
                'display_name' => 'Acme Corp',
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            result = didit.businesses.update(
              "company-123",
              display_name: "Acme Corp"
            )
            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.Businesses.UpdateAsync("company-123", new
            BusinessesUpdateParams

            {
                DisplayName = "Acme Corp",
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    BusinessDetailItem:
      type: object
      description: 完整企业详情。在 BusinessListItem 基础上扩展了元数据和 updated_at。
      allOf:
        - $ref: '#/components/schemas/BusinessListItem'
        - type: object
          properties:
            metadata:
              type: object
              description: 您附加到此企业的自定义元数据 JSON。默认为 `{}`。
            updated_at:
              type: string
              format: date-time
    BusinessListItem:
      type: object
      description: 已验证的企业。
      properties:
        didit_internal_id:
          type: string
          format: uuid
          description: Didit 为此企业分配的稳定内部 UUID。
        vendor_data:
          type: string
          nullable: true
          description: 您对此企业的唯一标识符（创建会话时传入）。未提供供应商标识符时可为 null。
        display_name:
          type: string
          nullable: true
          description: 您设置的自定义显示名称
        legal_name:
          type: string
          nullable: true
          description: 来自登记处或手动输入的官方法定名称
        registration_number:
          type: string
          nullable: true
          description: 企业注册号或成立号
        country_code:
          type: string
          nullable: true
          description: 注册国家/地区（ISO 3166-1 alpha-2，例如 `GB`、`US`）。
        effective_name:
          type: string
          nullable: true
          description: 最佳可用名称：如果已设置则为 display_name，否则为 legal_name
        status:
          type: string
          enum:
            - ACTIVE
            - FLAGGED
            - BLOCKED
          description: >-
            企业记录的生命周期状态（并非会话状态）。`ACTIVE` 为默认值，`FLAGGED` 标记为需要人工关注，`BLOCKED` 会阻止该
            `vendor_data` 创建新会话。
        session_count:
          type: integer
          description: 该企业的验证会话总数
        approved_count:
          type: integer
          description: 已通过的会话数量
        declined_count:
          type: integer
          description: 已拒绝的会话数量
        in_review_count:
          type: integer
          description: 审核中的会话数量
        features:
          type: object
          description: >-
            该企业所有 KYB 会话的每项功能汇总状态。目前唯一的键为
            `KYB`（公司登记核验状态）。可选值：`Approved`、`Declined`、`In Review`、`Not
            Finished`、`Resub Requested`。
        features_list:
          type: array
          items:
            type: object
            properties:
              feature:
                type: string
              status:
                type: string
          description: 与 `features` 相同的数据，为 `{feature, status}` 对象的有序数组。
        last_session_at:
          type: string
          format: date-time
          nullable: true
          description: 最近一次会话的时间戳
        first_session_at:
          type: string
          format: date-time
          nullable: true
          description: 首次会话的时间戳
        last_activity_at:
          type: string
          format: date-time
          nullable: true
          description: 最近一次活动的时间戳（状态变更、会话更新等）
        tags:
          type: array
          items:
            type: object
            properties:
              uuid:
                type: string
                format: uuid
              name:
                type: string
              color:
                type: string
          description: 分配给该企业的标签
        created_at:
          type: string
          format: date-time
  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.