> ## 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：封禁或标记企业

> Didit 可封禁、标记或激活企业（KYB）。状态将同步至后续 KYB 会话和交易筛查。按次计费的企业管理 API。



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



      
      

\<pre>

\`Goal: Flip ONLY the lifecycle status of a Didit Business (KYB) entity. Use the full PATCH /v3/businesses/{vendor_data}/ when you also need to touch other fields.

Endpoint: PATCH https://verification.didit.me/v3/businesses/{vendor_data}/update-status/
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:
\- status (enum, REQUIRED) — "ACTIVE" | "FLAGGED" | "BLOCKED" (VendorBusinessStatusChoices, NOT the session enum).
\- 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 the status actually changes. Webhooks do not carry it.

Status semantics:
\- ACTIVE  → normal. New KYB sessions allowed for this vendor_data.
\- FLAGGED → still accepted, highlighted in Console for manual review; filterable with ?status=FLAGGED.
\- BLOCKED → terminal. Adds vendor_data to the system blocklist. Subsequent KYB session creations for the same identifier are rejected. Flipping back to ACTIVE/FLAGGED removes the blocklist entry automatically.

curl:
curl -X PATCH 'https://verification.didit.me/v3/businesses/company-123/update-status/' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"status": "BLOCKED", "reason": "Registry shows the company dissolved"}'

Response 200: full updated BusinessDetailItem (same shape as GET /v3/businesses/{vendor_data}/). See /reference/data-models.

Side effects:
\- Toggles the system blocklist entry when entering/leaving BLOCKED.
\- Writes one status-change entry to the company's activity (actor = API key identity), with reason as its comment.
\- Idempotent — re-sending the same status is a no-op (no extra audit row, no extra blocklist toggle).

Failure modes:
\- 400 — validation:
\{ "status": "This field is required." }
\{ "status": "Invalid status. Valid options are: ACTIVE, FLAGGED, BLOCKED" }
\{ "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 (or deleted). { "detail": "Not found." }
\- 429 — rate-limited.

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) 的 `ACTIVE`、`FLAGGED` 和 `BLOCKED` 状态之间进行切换。完整的状态机请参阅 [实体生命周期](https://docs.didit.me/zh/entities/lifecycle.md)。## 适用场景- **封禁**受到制裁或已确认存在欺诈的企业。
- **标记**待人工审核的企业。
- 整改完成后**解除封禁**。
- **同步外部信号**，来源于您自有的合规系统。## 注意事项- 有效值：`ACTIVE`、`FLAGGED`、`BLOCKED`。
- 可选传入 `reason`（最多 1000 个字符），用于记录状态变更的原因。
  Didit 会将其保存在 Business Console 中该企业的 **活动** 里对应的状态变更记录中。
  仅当状态实际发生变化时才会记录。
- `BLOCKED` 企业的所有新企业验证（KYB）会话都会被自动拒绝，所有新交易也会被自动拒绝，包括该企业作为交易对手出现的交易。
- 发出包含 `previous_status` 和 `status` 的 `business.status.updated` 事件。
  Webhook 不包含 `reason`。## 执行规则| 状态 | 新的企业验证（KYB）会话 | 涉及该企业的交易 |
| - | - | - |
| `ACTIVE` | 正常流程 | 正常流程 |
| `FLAGGED` | 转入 `IN_REVIEW` | 可能通过规则自动升级 |
| `BLOCKED` | 自动拒绝 | 自动拒绝 |## 权限主密钥和具有完全访问权限的 [API 密钥](https://docs.didit.me/zh/console/api-keys.md) 始终可以调用此端点。
具有自定义访问权限的密钥需要具备 **企业**（`businesses`）的写入权限。
仅限特定工作流或已通过会话的密钥无法访问此端点。控制台的[角色和权限](https://docs.didit.me/zh/console/roles-permissions.md)决定团队成员在控制台中可以执行的操作。这些设置不会用于 API 密钥请求的判断。## 相关内容- [实体生命周期](https://docs.didit.me/zh/entities/lifecycle.md)
- [企业黑名单](https://docs.didit.me/zh/entities/businesses/blocklist.md)
- [实体 Webhook](https://docs.didit.me/zh/entities/webhooks.md)


## OpenAPI

````yaml zh/openapi-25.json PATCH /v3/businesses/{vendor_data}/update-status/
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}/update-status/:
    patch:
      tags:
        - Businesses
      summary: 更新企业状态
      description: >-
        仅切换企业的生命周期 `status`：`ACTIVE`、`FLAGGED` 或 `BLOCKED`（非会话状态）。`BLOCKED` 会将
        `vendor_data` 添加到系统黑名单中；脱离 `BLOCKED` 状态则会移除该条目。每次变更都会记录在企业的活动中，并附带可选的
        `reason`。发送当前状态不会产生任何更改，也不会记录 `reason`。`business.status.updated` Webhook
        不包含 `reason`。
      operationId: update_business_status
      parameters:
        - name: vendor_data
          in: path
          required: true
          schema:
            type: string
          description: 您对该企业的唯一标识符（自由格式字符串，非 UUID）。
          example: company-123
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/EntityStatusUpdateRequest'
                - type: object
                  properties:
                    reason:
                      type: string
                      nullable: true
                      maxLength: 1000
                      description: >-
                        状态变更的原因。仅在状态实际变更时，记录在 Business Console 中该企业的
                        **Activity** 状态变更条目上。Webhook 不包含此项。
            examples:
              Flag:
                summary: 标记企业以待审核
                value:
                  status: FLAGGED
              Block:
                summary: 拉黑该企业（添加到系统黑名单）
                value:
                  status: BLOCKED
              Reactivate:
                summary: 重新激活企业
                value:
                  status: ACTIVE
              Block with reason:
                summary: 拉黑该企业并记录原因
                value:
                  status: BLOCKED
                  reason: Registry shows the company dissolved
      responses:
        '200':
          description: 企业状态已更新。返回完整的企业记录。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusinessDetailItem'
              examples:
                Blocked:
                  value:
                    didit_internal_id: a1b2c3d4-e5f6-4890-abcd-ef1234567890
                    vendor_data: company-123
                    display_name: null
                    legal_name: Acme Trading Ltd
                    registration_number: '12345678'
                    country_code: GB
                    effective_name: Acme Trading Ltd
                    status: BLOCKED
                    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
                    updated_at: '2026-03-15T10:30:00Z'
        '400':
          description: '`status` 缺失或无效，或 `reason` 超过 1000 个字符。'
          content:
            application/json:
              examples:
                Missing status:
                  value:
                    status:
                      - This field is required.
                Bad status:
                  value:
                    status:
                      - >-
                        Invalid status. Valid options are: ACTIVE, FLAGGED,
                        BLOCKED
                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/update-status/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"status": "BLOCKED"}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.businesses.update_status(
                "company-123",
                status="FLAGGED",
            )
            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.updateStatus("company-123", {
              status: "FLAGGED",
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Businesses.UpdateStatus(ctx, \"company-123\", didit.BusinessesUpdateStatusParams{\n\tStatus: \"FLAGGED\",\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.BusinessesUpdateStatusParams;

            import me.didit.types.EntityStatusUpdateRequest;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result = client.businesses().updateStatus("company-123",
            BusinessesUpdateStatusParams.builder()
                    .status(EntityStatusUpdateRequest.Status.of("FLAGGED"))
                    .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->updateStatus('company-123', [
                'status' => 'FLAGGED',
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            result = didit.businesses.update_status(
              "company-123",
              status: "FLAGGED"
            )
            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.UpdateStatusAsync("company-123", new
            BusinessesUpdateStatusParams

            {
                Status = "FLAGGED",
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    EntityStatusUpdateRequest:
      type: object
      required:
        - status
      properties:
        status:
          type: string
          enum:
            - ACTIVE
            - FLAGGED
            - BLOCKED
          description: 新的生命周期状态。`BLOCKED` 还会将 `vendor_data` 添加到系统黑名单中。
    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.