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

# 更新 AML 检查状态 API

> 通过 Didit API 设置会话的 AML 筛查检查状态，例如清除命中项后设为已通过，且不改变会话的整体决策。



更新 AML 检查状态 API 提示词
        将提示词复制到剪贴板



      
      

\<pre>

\`Set the status of the AML screening check of a Didit verification session through the API.

Endpoint:
PATCH https://verification.didit.me/v3/session/{session_id}/update-aml-status/

Authentication:
Send my Didit API key in the x-api-key header. A scoped key needs decisions: write.

Goal:
\- Record my compliance decision on a session's AML check as a whole (the status of an aml_screenings[] entry in the session decision), for example Approved after my team cleared every hit.

Request body (JSON):
\- status (required): "Approved", "Declined", "In Review", "Not Finished" or "Resub Requested".
\- node_id (optional): the workflow node ID of the AML check when the session ran several AML steps. It can also be sent as the node_id query parameter. Without it the most recent AML check is updated.

Behavior:
\- Works for user (KYC) and business (KYB) session IDs.
\- Only the AML check changes. The session status is not recomputed: use PATCH /v3/session/{session_id}/update-status/ to change the session decision, and PATCH /v3/session/{session_id}/update-aml-hit-status/ to mark individual hits.
\- When the status changes, Didit adds an AML_STATUS_UPDATED activity entry and sends a data.updated webhook.
\- Sending the status the check already has returns 200 and changes nothing (no activity entry, no webhook).

Example call:
curl -X PATCH "https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/update-aml-status/" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"status": "Approved"}'

What to read from the response:
\- status: the AML check status now.
\- previous_status: the status before the call (equal to status when nothing changed).

Failure modes:
\- 400: status missing or not one of the allowed values.
\- 401: the API key has expired.
\- 403: missing key (a wrong, revoked or expired key gets 401), a key of another application, a scoped key without decisions: write, or a request from outside the key's IP allowlist.
\- 404: the session does not exist, was deleted, or is outside a scoped key's limits, or it has no AML check (for that node_id). This is checked before the body, so it wins over a 400.

Side effects: changes the AML check status, adds an activity entry and sends a data.updated webhook (only when the status changed).

For the full integration shape, see /integration/integration-prompt.`

\</pre>



      
      

粘贴到

若要对单个命中项而非整个检查进行判定，请使用[更新 AML 命中状态](https://docs.didit.me/zh/sessions-api/update-aml-hit-status.md)。关于筛查结果和状态的生成方式，请参阅 [AML 筛查](https://docs.didit.me/zh/core-technology/aml-screening/overview.md)。


## OpenAPI

````yaml zh/openapi-25.json PATCH /v3/session/{sessionId}/update-aml-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/session/{sessionId}/update-aml-status/:
    patch:
      tags:
        - Sessions
      summary: 更新 AML 检查状态
      description: >-
        设置整个会话 AML 筛查检查的状态（会话决策中 `aml_screenings[]` 条目的
        `status`），例如在您的团队排除了所有命中项后设置为 `Approved`。适用于 KYC 和 KYB 会话 ID；当会话运行了多个
        AML 步骤时，请传递 `node_id`（查询参数或请求体字段），否则将更新最新的 AML 检查。当状态实际发生变化时，会记录
        `AML_STATUS_UPDATED` 活动条目并发送 `data.updated`
        [Webhook](https://docs.didit.me/zh/integration/webhooks)；发送当前状态将返回 `200`
        且不进行任何更改。会话状态不会重新计算：会话决策请使用 `PATCH
        /v3/session/{sessionId}/update-status/`，单个命中项请使用 `PATCH
        /v3/session/{sessionId}/update-aml-hit-status/`。限定权限范围的 API 密钥需要
        `decisions: write` 权限。
      operationId: patch_v3_session_update_aml_status
      parameters:
        - name: sessionId
          in: path
          required: true
          description: >-
            验证会话的 UUID（由 `POST /v3/session/` 返回的
            `session_id`）。支持用户验证（KYC）和企业验证（KYB）会话 ID：服务器会跨两种会话类型解析该 ID。必须是格式正确的
            UUID；格式不正确的值无法匹配路由并返回 HTML `404`。
          schema:
            type: string
            format: uuid
            example: 11111111-2222-3333-4444-555555555555
        - name: node_id
          in: query
          required: false
          description: 要更新的 AML 检查的工作流图谱节点 ID。仅在会话运行了多个 AML 步骤时需要。优先于请求体中的 `node_id`。
          schema:
            type: string
            example: feature_aml_1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - status
              properties:
                status:
                  type: string
                  enum:
                    - Not Finished
                    - Approved
                    - Declined
                    - In Review
                    - Resub Requested
                  description: AML 检查的新状态。
                  example: Approved
                node_id:
                  type: string
                  description: AML 检查的工作流图谱节点 ID，作为查询参数的替代项。
                  example: feature_aml_1
            example:
              status: Approved
      responses:
        '200':
          description: 已设置的 AML 检查状态（若已具备该值则保持不变）。
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - status
                  - previous_status
                properties:
                  message:
                    type: string
                    description: 始终为 `AML status updated successfully`。
                  status:
                    type: string
                    enum:
                      - Not Finished
                      - Approved
                      - Declined
                      - In Review
                      - Resub Requested
                    description: 当前 AML 检查的状态。
                  previous_status:
                    type: string
                    enum:
                      - Not Finished
                      - Approved
                      - Declined
                      - In Review
                      - Resub Requested
                    description: 调用前的状态。未发生变更时与 `status` 相同。
              example:
                message: AML status updated successfully
                status: Approved
                previous_status: In Review
        '400':
          description: >-
            验证错误：`status` 缺失或不属于允许的值。AML 检查查询会优先执行，因此即使请求体无效，没有 AML 检查的会话也会返回
            `404`。
          content:
            application/json:
              examples:
                Missing status:
                  summary: 空请求体或无状态
                  value:
                    status:
                      - This field is required.
                Invalid status:
                  summary: status 不在枚举中
                  value:
                    status:
                      - '"Cleared" is not a valid choice.'
        '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: >-
            会话不存在、已被删除或超出了限定作用域密钥的限制，或者该会话没有 AML 检查（针对给定的
            `node_id`）。会话查找在凭证检查之前执行，因此即使没有有效密钥，未知的 `sessionId` 也会返回 `404`。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 便于人类阅读的错误消息。
              examples:
                Unknown session:
                  summary: 不存在具有此 ID 的会话，或该会话已被删除
                  value:
                    detail: Not found.
                Outside key limits:
                  summary: 会话超出了限定作用域密钥的限制（对于刚刚删除的会话也会返回此错误）
                  value:
                    detail: Session not found.
                No AML check:
                  summary: 该会话从未运行过 AML 步骤
                  value:
                    detail: The session does not have an AML check.
                No AML check for node:
                  summary: node_id 与该会话的 AML 检查不匹配
                  value:
                    detail: >-
                      The session does not have an AML check for node
                      'feature_aml_2'.
        '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: curl
          label: curl
          source: >-
            curl -X PATCH
            'https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/update-aml-status/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"status": "Approved"}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.sessions.update_aml_status(
                "11111111-2222-3333-4444-555555555555",
                status="Approved",
            )
            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.updateAmlStatus("11111111-2222-3333-4444-555555555555",
            {
              status: "Approved",
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Sessions.UpdateAMLStatus(ctx, \"11111111-2222-3333-4444-555555555555\", didit.SessionsUpdateAMLStatusParams{\n\tStatus: \"Approved\",\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.SessionsUpdateAmlStatusParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.sessions().updateAmlStatus("11111111-2222-3333-4444-555555555555",
            SessionsUpdateAmlStatusParams.builder()
                    .status(SessionsUpdateAmlStatusParams.Status.of("Approved"))
                    .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->updateAmlStatus('11111111-2222-3333-4444-555555555555',
            [
                'status' => 'Approved',
            ]);

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

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

            result = didit.sessions.update_aml_status(
              "11111111-2222-3333-4444-555555555555",
              status: "Approved"
            )
            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.UpdateAmlStatusAsync("11111111-2222-3333-4444-555555555555",
            new SessionsUpdateAmlStatusParams

            {
                Status = "Approved",
            });

            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.