> ## 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 管理 API，从您自己的系统向受监控交易的审核时间线添加纯文本备注，并可选择提及成员。



创建交易备注 API 提示词
        将提示词复制到剪贴板



      
      

\<pre>

\`Add a note to a Didit monitored transaction through the Management API.

Endpoint:
POST https://verification.didit.me/v3/transactions/{transaction_id}/notes/

Authentication:
Use the x-api-key header with my Didit API key. A scoped key needs transactions: write. Keys limited to specific workflows or to approved sessions cannot call this endpoint.

Goal:
\- Record context from my own systems (a support call, a manual check, an outcome from my case tool) on the transaction's review timeline, where Console reviewers see it.

Path parameter:
\- transaction_id: the Didit transaction uuid, not my own txn_id.

Request body (application/json):
\{
"note": "Customer confirmed the withdrawal by phone.",
"mentioned_emails": ["analyst@example.com"]
}
\- note: required. Plain text, no length limit. Leading and trailing whitespace is trimmed and a blank note is rejected.
\- mentioned_emails: optional list of emails of members of my organization to mention.

Behavior:
\- Returns 201 with the created note. actor_email and actor_name are null because the note comes from an API key, not a person.
\- Every mentioned email must belong to a member of my organization; one unknown address fails the whole request with 400. Mentions are stored lower-cased and de-duplicated in metadata.mentioned_emails. This endpoint does not notify the mentioned members.
\- Each call creates a new note. Retrying a request that timed out can add the same note twice, so check GET /v3/transactions/{transaction_id}/notes/ before retrying.
\- There is no API endpoint to edit or remove a note.

Example call:
curl -X POST "https://verification.didit.me/v3/transactions/{transaction_id}/notes/" \
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"note": "Customer confirmed the withdrawal by phone.", "mentioned_emails": ["analyst@example.com"]}'

What to read from the response:
\- uuid: the note id.
\- created_at: when the note was stored.
\- metadata.mentioned_emails: the normalized mention list (empty when nobody was mentioned).

Failure modes:
\- 400: note missing ({"note": ["This field is required."]}) or blank, an invalid email in mentioned_emails, or a mentioned address outside my organization ({"mentioned_emails": ["Mentioned users must belong to this organization and have access to this application."]}).
\- 401: the API key has expired.
\- 403: missing API key (a wrong, revoked or expired key gets 401), a scoped key without transactions: write ({"detail": "This API key has no write access to transactions."}), a key with workflow or status limits, or a request from outside the key's IP allowlist.
\- 404: no transaction with this uuid in my application ({"detail": "No Transaction matches the given query."}).
\- 429: more than 300 write requests per minute with this key; wait Retry-After seconds and retry.

Side effects: creates the note and adds a TRANSACTION_NOTE_ADDED entry to the transaction's activities. The transaction's status, score and alerts do not change, no webhook is sent, and nothing is billed.

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

\</pre>



      
      

粘贴到

备注只是上下文信息，而非决策结果：它永远不会更改交易的 `status`、`score` 或警报。审核员可以在 Console 的[交易详情](https://docs.didit.me/zh/transaction-monitoring/console.md#交易详情)中，在 **备注** 下查看备注。交易的 `activities` 还会新增一条 `TRANSACTION_NOTE_ADDED` 条目，您可以通过[获取交易](https://docs.didit.me/zh/management-api/transactions/get.md)读取该条目。由于备注来自 API 密钥，因此不包含作者信息：`actor_email` 和 `actor_name` 为 `null`。如果需要显示备注的作者，请将其写入备注内容中。使用[列出交易备注](https://docs.didit.me/zh/management-api/transactions/list-notes.md)可以读取完整的时间线。


## OpenAPI

````yaml zh/openapi-25.json POST /v3/transactions/{transaction_id}/notes/
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/transactions/{transaction_id}/notes/:
    post:
      tags:
        - Transactions
      summary: 创建交易备注
      description: >-
        向受监控交易的审核时间线添加纯文本备注，控制台审核员可以在此处查看。备注属于上下文信息，而非决策：交易的 `status`、`score`
        和警报均不会改变，不会发送 Webhook，也不会产生任何计费。该交易的 `activities` 将新增一条
        `TRANSACTION_NOTE_ADDED` 记录。


        使用 API 密钥创建的备注没有作者：`actor_email` 和 `actor_name` 为
        `null`，因此如果需要，请在文本中注明作者。`mentioned_emails` 中的每个地址必须属于您组织的成员，否则整个请求将失败并返回
        `400`；提及的邮箱将以小写形式去重存储，且此 endpoint 不会向被提及的成员发送通知。


        每次调用都会创建一条新备注，因此重试超时的请求可能会导致添加两次：在重试前请先列出备注。没有用于编辑或删除备注的 API
        endpoint。具有作用域限定的 API 密钥需要具备 `transactions: write`
        权限；仅限于某些工作流或已通过审核的会话的密钥无法调用此 endpoint。
      operationId: create_transaction_note
      parameters:
        - name: transaction_id
          in: path
          required: true
          description: >-
            Didit 交易 UUID：由 `POST /v3/transactions/` 和 `GET /v3/transactions/`
            返回的 `uuid`。不接受您自己的 `txn_id`。
          schema:
            type: string
            format: uuid
          example: abcdef12-3456-7890-abcd-ef1234567890
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - note
              properties:
                note:
                  type: string
                  minLength: 1
                  description: 纯文本备注。首尾空白字符会被修剪，空白备注会被拒绝。无长度限制。
                mentioned_emails:
                  type: array
                  items:
                    type: string
                    format: email
                  default: []
                  description: 要提及的组织成员的邮箱。每个邮箱必须是有效的组织成员邮箱。
            examples:
              Note with a mention:
                value:
                  note: Customer confirmed the withdrawal by phone.
                  mentioned_emails:
                    - analyst@example.com
              Plain note:
                value:
                  note: Source of funds document requested by email.
      responses:
        '201':
          description: 备注已创建。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionNote'
              examples:
                Created:
                  value:
                    uuid: c1111111-2222-4333-8444-555555555555
                    note: Customer confirmed the withdrawal by phone.
                    actor_email: null
                    actor_name: null
                    metadata:
                      mentioned_emails:
                        - analyst@example.com
                    created_at: '2026-10-16T10:05:12.481203Z'
        '400':
          description: >-
            请求体无效：`note` 缺失、为 null 或为空白；`mentioned_emails`
            中存在无效地址（按列表位置索引错误）；或提及的地址不是您组织的成员。未创建任何内容。
          content:
            application/json:
              schema:
                type: object
                description: 以字段名作为键的字段错误。
                additionalProperties: {}
              examples:
                Missing note:
                  value:
                    note:
                      - This field is required.
                Blank note:
                  value:
                    note:
                      - This field may not be blank.
                Invalid email:
                  value:
                    mentioned_emails:
                      '0':
                        - Enter a valid email address.
                Not an organization member:
                  value:
                    mentioned_emails:
                      - >-
                        Mentioned users must belong to this organization and
                        have access to this application.
        '401':
          description: API 密钥已过期。仅创建时设置了到期日期的密钥才会过期；超过该日期后，使用它的每次请求都会返回 `401`。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Expired key:
                  value:
                    detail: This API key has expired.
        '403':
          description: 请求不被允许。缺失密钥将返回常规错误信息；错误、已撤销或已过期的密钥将收到 `401`。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Missing or invalid key:
                  value:
                    detail: You do not have permission to perform this action.
                Scoped key without transactions write:
                  value:
                    detail: This API key has no write access to transactions.
                Key limited to workflows or approved sessions:
                  value:
                    detail: >-
                      This API key only reaches sessions inside its workflow or
                      status limits, so it can't use this endpoint.
                Outside the key's IP list:
                  value:
                    detail: This API key can't be used from this IP address.
        '404':
          description: >-
            应用中不存在具有此 UUID 的交易（从未创建、已删除或属于另一个应用）。非 UUID 格式的 `transaction_id`
            不会到达 API：它将返回 `404` HTML 页面，而不是此 JSON 正文。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Not found:
                  value:
                    detail: No Transaction matches the given query.
        '429':
          description: 使用此 API 密钥的写入请求每分钟超过 300 次。请等待 `Retry-After` 中指定的秒数，然后再重试。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Throttled:
                  value:
                    detail: >-
                      Write request rate limit exceeded. You can make up to 300
                      requests per minute.
          headers:
            Retry-After:
              description: 距离当前一分钟窗口重置的秒数。
              schema:
                type: integer
                example: 23
            X-RateLimit-Limit:
              description: 在此预算中每分钟允许的请求数。
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: 当前时间窗口内剩余的请求数。
              schema:
                type: integer
            X-RateLimit-Reset:
              description: 窗口重置的 Unix 时间。
              schema:
                type: integer
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X POST
            'https://verification.didit.me/v3/transactions/abcdef12-3456-7890-abcd-ef1234567890/notes/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"note": "Customer confirmed the withdrawal by phone.", "mentioned_emails": ["analyst@example.com"]}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.transactions.notes.create(
                "abcdef12-3456-7890-abcd-ef1234567890",
                note="Customer confirmed the withdrawal by phone.",
                mentioned_emails=["analyst@example.com"],
            )
            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.transactions.notes.create("abcdef12-3456-7890-abcd-ef1234567890",
            {
              note: "Customer confirmed the withdrawal by phone.",
              mentioned_emails: ["analyst@example.com"],
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Transactions.Notes.Create(ctx, \"abcdef12-3456-7890-abcd-ef1234567890\", didit.TransactionsNotesCreateParams{\n\tNote:            \"Customer confirmed the withdrawal by phone.\",\n\tMentionedEmails: didit.Some([]string{\"analyst@example.com\"}),\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import java.util.List;

            import me.didit.Didit;

            import me.didit.types.TransactionsNotesCreateParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.transactions().notes().create("abcdef12-3456-7890-abcd-ef1234567890",
            TransactionsNotesCreateParams.builder()
                    .note("Customer confirmed the withdrawal by phone.")
                    .mentionedEmails(List.of("analyst@example.com"))
                    .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->transactions->notes->create('abcdef12-3456-7890-abcd-ef1234567890',
            [
                'note' => 'Customer confirmed the withdrawal by phone.',
                'mentioned_emails' => ['analyst@example.com'],
            ]);

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

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

            result = didit.transactions.notes.create(
              "abcdef12-3456-7890-abcd-ef1234567890",
              note: "Customer confirmed the withdrawal by phone.",
              mentioned_emails: ["analyst@example.com"]
            )
            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.Transactions.Notes.CreateAsync("abcdef12-3456-7890-abcd-ef1234567890",
            new TransactionsNotesCreateParams

            {
                Note = "Customer confirmed the withdrawal by phone.",
                MentionedEmails = new string[] { "analyst@example.com" },
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    TransactionNote:
      type: object
      description: 受监控交易的审核时间线上的一条备注。
      required:
        - uuid
        - note
        - actor_email
        - actor_name
        - metadata
        - created_at
      properties:
        uuid:
          type: string
          format: uuid
          description: 备注标识符。
        note:
          type: string
          description: 纯文本备注内容。
        actor_email:
          type: string
          format: email
          nullable: true
          description: 撰写备注或更改状态的 Console 用户的邮箱。通过 API 密钥创建的备注以及 Didit 自动添加的备注为 `null`。
        actor_name:
          type: string
          nullable: true
          description: >-
            Console 用户的显示名称（若未设置姓名则为其邮箱）。对于 Didit 自动添加的备注，显示为 `Rule Engine`。对于使用
            API 密钥创建的备注，为 `null`。
        metadata:
          type: object
          description: >-
            区分不同的备注类型。通过 API 或控制台写入的备注包含 `mentioned_emails`。在控制台中执行的状态变更包含
            `type: status_change` 以及
            `previous_status`、`new_status`、`reason_code` 和 `reason_label`。Didit
            添加的备注包含 `source`：规则的 `add_note` 操作对应 `rule_action`（附带
            `rule_uuid`），而创建用户操作验证会话出现问题时则对应 `remediation_session`。
          properties:
            mentioned_emails:
              type: array
              items:
                type: string
                format: email
              description: 被提及的组织成员，已转为小写并去重。未提及任何人时为空。
            type:
              type: string
              enum:
                - status_change
              description: 在记录 Console 中进行的状态变更的备注中存在。
            previous_status:
              type: string
              enum:
                - APPROVED
                - IN_REVIEW
                - DECLINED
                - AWAITING_USER
              description: 变更前的状态。
            new_status:
              type: string
              enum:
                - APPROVED
                - IN_REVIEW
                - DECLINED
                - AWAITING_USER
              description: 变更后的状态。
            reason_code:
              type: string
              nullable: true
              description: 随变更一起提供的原因代码。
            reason_label:
              type: string
              nullable: true
              description: 随变更一起提供的原因标签。
            source:
              type: string
              enum:
                - rule_action
                - remediation_session
              description: 在 Didit 自动添加的备注中存在。
            rule_uuid:
              type: string
              format: uuid
              description: '其 `add_note` 操作写入了该备注的规则（带有 `source: rule_action`）。'
        created_at:
          type: string
          format: date-time
          description: 备注存储的时间。
  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.