> ## 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 供应商用户的可变字段：显示名称、元数据、标签。已验证的身份字段不可修改。按次计费的用户管理。



更新用户提示
        将提示词复制到剪贴板



      
      

\<pre>

\`Goal: Partial-update a Didit User entity by vendor_data.

Endpoint: PATCH https://verification.didit.me/v3/users/{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; auto-derived counters and session history are left alone):
\- full_name (string, max 512, nullable)
\- display_name (string, nullable)
\- date_of_birth (string YYYY-MM-DD, nullable)
\- status (enum) — "ACTIVE" | "FLAGGED" | "BLOCKED" (VendorUserStatusChoices). Setting "BLOCKED" auto-adds vendor_data to the system blocklist; flipping away removes it.
\- metadata (object, nullable) — REPLACES existing metadata wholesale; merge client-side if you only want to add keys.
\- approved_emails (object<string, boolean>)
\- approved_phones (object<string, boolean>)
\- issuing_states (object<ISO3, int>)
\- reason (string, optional, max 1000): why the status changed. Recorded as the comment of the STATUS_CHANGED entry in the user's activity (comments[].comment), only when this update actually changes status. Webhooks do not carry it.

curl:
curl -X PATCH 'https://verification.didit.me/v3/users/user-abc-123/' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"display_name": "Jane S.", "status": "FLAGGED", "reason": "Address does not match the billing country"}'

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

Side effects:
\- Writes to the user's comments activity log (actor derived from the API key): a STATUS_CHANGED entry with reason when status changes, and a PROFILE_UPDATED entry when display_name, full_name, date_of_birth or metadata change.
\- last_activity_at bumped to now().
\- Concurrent updates: last-write-wins per field.
\- Re-sending an unchanged body is safe (no extra audit row).

Failure modes:
\- 400 — validation. Examples:
\{ "status": ["Invalid status. Valid options are: ACTIVE, FLAGGED, BLOCKED"] }
\{ "metadata": ["Metadata must be a JSON object."] }
date_of_birth must be YYYY-MM-DD.
\{ "reason": ["Ensure this field has no more than 1000 characters."] }
\- 401 — missing/invalid x-api-key. { "detail": "Authentication credentials were not provided." }
\- 403 — the API key is revoked or is not valid for this application. { "detail": "You do not have permission to perform this action." }
\- 403: a scoped API key without users write. { "detail": "This API key has no write access to people." }
\- 404 — vendor_data not found. { "detail": "Not found." }
\- 429 — rate-limited.

Notes:
\- vendor_data in the URL itself cannot be changed via this endpoint — create new + delete old to rekey.
\- For status-only flips, prefer the dedicated PATCH /v3/users/{vendor_data}/update-status/.
\- Overriding fields populated by a verified session 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/users/overview.md) 中的可变字段。由已验证的用户验证（KYC）会话同步而来的字段（`full_name`、`date_of_birth`、`portrait_image`、汇总计数器和 `features`）为只读。## 适用场景- **更新您自己的元数据**：将用户调整到其他等级、修改标签或记录内部备注。
- **重命名**：为内部控制台视图设置更合适的 `display_name`。
- **覆盖已验证数据**（请谨慎操作）：允许手动覆盖，但会记录到审计日志中。## 注意事项- 此接口无法修改 URL 中的 `vendor_data`。如需更换标识，请创建新用户并删除旧用户。
- 会发出包含 `changed_fields` 数组的 `user.data.updated` Webhook 事件，便于使用方高效同步。
- 在此修改 `status` 的效果与[更新用户状态](https://docs.didit.me/zh/management-api/users/update-status.md)相同。该变更会记录在用户的活动记录中，可选的 `reason`（最多 1000 个字符）将作为其备注。将状态设为 `BLOCKED` 时，还会把 `vendor_data` 添加到系统黑名单中。`user.status.updated` Webhook 事件不包含 `reason`。
- 若您通过 PATCH 修改当前由已验证会话管理的字段，该覆盖会被接受，但会在[审计日志](https://docs.didit.me/zh/console/audit-logs.md)中标记。## 权限主密钥和全权限 [API 密钥](https://docs.didit.me/zh/console/api-keys.md)始终可以调用此接口。具有自定义访问权限的密钥需要 **用户**（`users`）的写入权限。仅限于部分工作流或已通过会话的密钥，无法调用此接口。控制台中的[角色与权限](https://docs.didit.me/zh/console/roles-permissions.md)决定团队成员可在控制台中执行的操作。对于 API 密钥请求，系统不会评估这些设置。## 相关内容- [用户操作](https://docs.didit.me/zh/entities/users/operations.md)
- [数据模型](https://docs.didit.me/zh/entities/users/data-model.md)
- [更新状态](https://docs.didit.me/zh/management-api/users/update-status.md)


## OpenAPI

````yaml zh/openapi-25.json PATCH /v3/users/{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/users/{vendor_data}/:
    patch:
      tags:
        - Users
      summary: 更新用户
      description: >-
        用户的部分更新：`display_name`、`full_name`、`date_of_birth`、`status`、`metadata`、`approved_emails`/`approved_phones`/`issuing_states`。`metadata`
        将完全替换。在此处更改 `status`
        的效果类似于[更新用户状态](#patch-/v3/users/-vendor_data-/update-status/)：它会记录一条带有可选
        `reason` 的 `STATUS_CHANGED` 活动记录，且 `BLOCKED` 会将 `vendor_data`
        添加到系统黑名单（移出 `BLOCKED` 则会移除该条目）。对
        `display_name`、`full_name`、`date_of_birth` 或 `metadata` 的更改会记录为
        `PROFILE_UPDATED` 活动记录。
      operationId: update_user
      parameters:
        - name: vendor_data
          in: path
          required: true
          schema:
            type: string
          description: 您对该用户的唯一标识符（自由格式字符串，非 UUID）。
          example: user-abc-123
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                full_name:
                  type: string
                  nullable: true
                  maxLength: 512
                  description: 用户的姓名
                display_name:
                  type: string
                  nullable: true
                  description: 该用户的自定义显示名称
                date_of_birth:
                  type: string
                  format: date
                  nullable: true
                  description: YYYY-MM-DD 格式的出生日期
                status:
                  type: string
                  enum:
                    - ACTIVE
                    - FLAGGED
                    - BLOCKED
                  description: >-
                    用户生命周期状态。状态变更会记录为 `STATUS_CHANGED` 活动，且 `BLOCKED` 会将
                    `vendor_data` 添加到系统黑名单中（移出 `BLOCKED` 会移除该条目）。
                metadata:
                  type: object
                  nullable: true
                  description: 附加到用户的任意 JSON 对象。更新时将**完全替换**现有元数据；如果仅想添加键，请在客户端进行合并。
                approved_emails:
                  type: array
                  items:
                    type: string
                  description: 该用户的已验证邮箱地址，例如 `["john@example.com"]`。完全替换已存储的列表。
                approved_phones:
                  type: array
                  items:
                    type: string
                  description: 该用户的已验证电话号码。完全替换已存储的列表。
                issuing_states:
                  type: array
                  items:
                    type: string
                  description: 签发国家/地区（ISO 3166-1 alpha-3），例如 `["USA"]`。完全替换已存储的列表。
                reason:
                  type: string
                  nullable: true
                  maxLength: 1000
                  description: >-
                    状态变更的原因。仅在状态实际变更时，记录在用户活动的状态变更条目（`comments[].comment`，以及
                    Business Console 中的 **Activity**）上。Webhook 不包含此项。
            examples:
              Rename:
                summary: 设置显示名称
                value:
                  display_name: Jane S.
              Override status:
                summary: 标记用户以待审核
                value:
                  status: FLAGGED
              Add metadata:
                summary: 替换元数据 JSON
                value:
                  metadata:
                    tier: premium
                    risk_level: low
              Fix extracted DOB:
                summary: 提取的个人资料字段正确
                value:
                  full_name: Jane Elizabeth Smith
                  date_of_birth: '1985-11-22'
              Flag with reason:
                summary: 标记用户并记录原因
                value:
                  status: FLAGGED
                  reason: Address does not match the billing country
      responses:
        '200':
          description: 用户已更新。返回完整的已更新用户记录（格式与获取用户相同）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserDetailItem'
              examples:
                Updated:
                  value:
                    didit_internal_id: f4e5e1f2-94a9-4f86-8c16-2b7d9b4db418
                    vendor_data: user-abc-123
                    display_name: Jane S.
                    full_name: Jane Elizabeth Smith
                    date_of_birth: '1985-11-22'
                    effective_name: Jane S.
                    status: FLAGGED
                    metadata:
                      tier: premium
                    portrait_image_url: https://<media-host>/...
                    session_count: 3
                    approved_count: 2
                    declined_count: 0
                    in_review_count: 1
                    issuing_states:
                      - USA
                    approved_emails:
                      - john@example.com
                    approved_phones:
                      - '+14155551234'
                    features:
                      ID_VERIFICATION: Approved
                      LIVENESS: Approved
                      FACE_MATCH: Approved
                      AML: Approved
                    features_list:
                      - feature: ID_VERIFICATION
                        status: Approved
                      - feature: LIVENESS
                        status: Approved
                      - feature: FACE_MATCH
                        status: Approved
                      - feature: AML
                        status: Approved
                    last_session_at: '2025-06-15T10:30:00Z'
                    last_activity_at: '2025-06-15T10:30:00Z'
                    first_session_at: '2025-06-01T08:00:00Z'
                    tags:
                      - uuid: 9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d
                        tag:
                          uuid: e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b
                          name: VIP
                          color: '#2567FF'
                          description: null
                          source: custom
                          created_at: '2025-05-01T09:00:00Z'
                          updated_at: '2025-05-01T09:00:00Z'
                        added_by_email: analyst@acme.com
                        added_by_name: Jane Analyst
                        created_at: '2025-06-02T11:00:00Z'
                    comments: []
                    created_at: '2025-06-01T08:00:00Z'
                    updated_at: '2025-06-15T10:30:00Z'
        '400':
          description: 无效的请求体：通常是未知的 `status`，或 `date_of_birth` 不符合 `YYYY-MM-DD` 格式。
          content:
            application/json:
              examples:
                Bad status:
                  value:
                    status:
                      - '"INVALID" is not a valid choice.'
                Bad date_of_birth:
                  value:
                    date_of_birth:
                      - >-
                        Date has wrong format. Use one of these formats instead:
                        YYYY-MM-DD.
                Reason too long:
                  value:
                    reason:
                      - Ensure this field has no more than 1000 characters.
        '401':
          description: >-
            未提供凭证。对 `/v3/users/*` 路径的请求如果不包含 `x-api-key` 请求头（或 `Authorization:
            Bearer` token），将在到达 API 之前被身份验证中间件拒绝。
          content:
            application/json:
              examples:
                Missing credentials:
                  value:
                    detail: >-
                      You must be authenticated with a valid access token to
                      access this endpoint.
        '403':
          description: 该密钥无法更新此应用的用户。缺少密钥返回 `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/users/user-abc-123/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"display_name": "Jane S.", "status": "FLAGGED"}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.users.update(
                "user-abc-123",
                display_name="Jane S.",
            )
            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.users.update("user-abc-123", {
              display_name: "Jane S.",
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Users.Update(ctx, \"user-abc-123\", didit.UsersUpdateParams{\n\tDisplayName: didit.String(\"Jane S.\"),\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.UsersUpdateParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result = client.users().update("user-abc-123",
            UsersUpdateParams.builder()
                    .displayName("Jane S.")
                    .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->users->update('user-abc-123', [
                'display_name' => 'Jane S.',
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            result = didit.users.update(
              "user-abc-123",
              display_name: "Jane S."
            )
            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.Users.UpdateAsync("user-abc-123", new
            UsersUpdateParams

            {
                DisplayName = "Jane S.",
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    UserDetailItem:
      type: object
      description: 完整的用户详情。在 UserListItem 基础上扩展了元数据、备注和 updated_at。
      allOf:
        - $ref: '#/components/schemas/UserListItem'
        - type: object
          properties:
            metadata:
              type: object
              description: 您附加到此用户的自定义元数据 JSON。默认为 `{}`。
            tags:
              type: array
              description: >-
                标签分配情况。注意：与列表响应中使用的扁平 `{uuid, name, color}`
                结构不同，详情响应中的每个条目均为标签*链接*对象（`{uuid, tag: {...}, added_by_email,
                added_by_name, created_at}`）。
              items:
                type: object
                properties:
                  uuid:
                    type: string
                    format: uuid
                    description: 标签分配的 UUID（而非标签本身的 UUID）。
                  tag:
                    type: object
                    properties:
                      uuid:
                        type: string
                        format: uuid
                      name:
                        type: string
                      color:
                        type: string
                      description:
                        type: string
                        nullable: true
                      source:
                        type: string
                        enum:
                          - didit
                          - custom
                      created_at:
                        type: string
                        format: date-time
                      updated_at:
                        type: string
                        format: date-time
                  added_by_email:
                    type: string
                    nullable: true
                  added_by_name:
                    type: string
                    nullable: true
                  created_at:
                    type: string
                    format: date-time
            comments:
              type: array
              items:
                type: object
                properties:
                  uuid:
                    type: string
                    format: uuid
                  comment_type:
                    type: string
                    enum:
                      - COMMENT
                      - STATUS_CHANGED
                      - METADATA_UPDATED
                      - TAG_ADDED
                      - TAG_REMOVED
                      - PROFILE_UPDATED
                  comment:
                    type: string
                    nullable: true
                  actor_email:
                    type: string
                    nullable: true
                  actor_name:
                    type: string
                    nullable: true
                  previous_status:
                    type: string
                    nullable: true
                    enum:
                      - ACTIVE
                      - FLAGGED
                      - BLOCKED
                      - null
                  new_status:
                    type: string
                    nullable: true
                    enum:
                      - ACTIVE
                      - FLAGGED
                      - BLOCKED
                      - null
                  previous_value:
                    type: object
                    nullable: true
                    description: PROFILE_UPDATED 条目的先前字段值。
                  new_value:
                    type: object
                    nullable: true
                    description: PROFILE_UPDATED 条目的新字段值。
                  changed_fields:
                    type: array
                    items:
                      type: string
                    description: 由 PROFILE_UPDATED 条目更改的字段名称。
                  metadata:
                    type: object
                    nullable: true
                  mentioned_emails:
                    type: array
                    items:
                      type: string
                  created_at:
                    type: string
                    format: date-time
              description: 该用户的活动日志和评论（状态变更、资料修改、手动备注）。
            updated_at:
              type: string
              format: date-time
    UserListItem:
      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: 您设置的自定义显示名称
        full_name:
          type: string
          nullable: true
          description: 从已验证证件中提取的姓名
        date_of_birth:
          type: string
          format: date
          nullable: true
        effective_name:
          type: string
          nullable: true
          description: 最佳可用名称：如果已设置则为 display_name，否则为 full_name
        status:
          type: string
          enum:
            - ACTIVE
            - FLAGGED
            - BLOCKED
          description: >-
            用户记录的生命周期状态（并非会话状态）。`ACTIVE` 为默认值，`FLAGGED` 标记该用户需要人工关注，`BLOCKED`
            会阻止该 `vendor_data` 创建新会话。
        portrait_image_url:
          type: string
          nullable: true
          description: 用户肖像照片的预签名 URL（数小时后过期）
        session_count:
          type: integer
          description: 该用户的验证会话总数
        approved_count:
          type: integer
          description: 已通过的会话数量
        declined_count:
          type: integer
          description: 已拒绝的会话数量
        in_review_count:
          type: integer
          description: 审核中的会话数量
        issuing_states:
          type: array
          items:
            type: string
          description: >-
            此用户已通过的身份证件上显示的签发国家/地区的 ISO 3166-1 alpha-3 代码，例如 `["USA",
            "ESP"]`。无时为空数组。
        approved_emails:
          type: array
          items:
            type: string
          description: 从该用户已通过的会话中收集的已验证邮箱地址，例如 `["john@example.com"]`。
        approved_phones:
          type: array
          items:
            type: string
          description: 从该用户已通过的会话中收集的已验证电话号码，例如 `["+14155551234"]`。
        features:
          type: object
          description: >-
            该用户所有会话的每项功能汇总状态。可选键：`ID_VERIFICATION`、`NFC`、`LIVENESS`、`FACE_MATCH`、`POA`、`QUESTIONNAIRE`、`EMAIL_VERIFICATION`、`PHONE`、`AML`、`IP_ANALYSIS`、`AGE_ESTIMATION`、`DATABASE_VALIDATION`。可选值：`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.