> ## 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 支持在单次请求中提交最多 500 个监控事件，并为每个事件返回独立的处理结果，单个格式错误的事件不会阻塞批次中其余事件。



在批量 API 中创建监控事件的提示词
        将提示词复制到剪贴板



      
      

\<pre>

\`Send up to 500 monitoring events to Didit in one request from my backend, and handle the per-item outcomes.

Endpoint:
POST https://verification.didit.me/v3/events/batch/

Authentication:
Use the x-api-key header with my Didit API key, from my backend only. A scoped key needs transactions: write.

Goal:
\- Flush a queue of events (logins, gameplay rounds, payment steps, chargebacks) in as few requests as possible, without one bad event blocking the others.

Request body (application/json):
\{
"events": [ { ...one event, same envelope as POST /v3/events/... }, ... ]   // 1 to 500 events
}
A bare JSON array of events is also accepted.

Behavior:
\- Each item is validated, stored and evaluated on its own, exactly like POST /v3/events/. A rejected item never rolls back the others.
\- HTTP 201 when no item was rejected, 207 when at least one was. Treat both as success and read results[].
\- results[] has one entry per item in request order, with index pointing into my events array and outcome accepted, replayed or rejected.
\- accepted and replayed items carry the same fields as the single-event response (event_uuid, status, score, rule_matches, correlation_pending, retention_class, expires_at, idempotent_replay).
\- rejected items carry errors keyed by field, in the same shape as the 400 of POST /v3/events/. A reused event_id with different content is reported as a string under errors.event_id. Send event_id in snake_case so a rejected item's results[].event_id is filled.
\- Retry only the rejected items after fixing them. Resending an accepted item is safe: it comes back as replayed.
\- occurred_at must still be within 7 days in the past and 5 minutes in the future for every item.

Example call:
curl -X POST "https://verification.didit.me/v3/events/batch/" \
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"events":[{"event_id":"login-2026-10-17-000001","event_category":"auth","action_type":"login","occurred_at":"2026-10-17T09:15:02.481Z","subject":{"vendor_data":"user-42"}}]}'

What to read from the response:
\- accepted_count, replayed_count, rejected_count.
\- results[].index and results[].outcome.
\- results[].errors for rejected items.
\- results[].event_uuid and results[].status for stored items.

Failure modes:
\- 400 - events missing, not an array, empty, or longer than 500 items ({ "events": "<message>" }). Nothing is stored; split the batch.
\- 429 - more than 600 ingestion requests per minute for this API key (event and transaction ingestion share this budget, apart from the 300 of every other write); honor Retry-After.
\- 401 - the API key has expired.
\- 403 - missing API key (a wrong, revoked or expired key gets 401), a scoped key without transactions: write, or code event_monitoring_disabled (event ingestion is not switched on; nothing is stored).

Side effects: stores every valid item, may create subjects, and applies the actions of matched active rules.

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

\</pre>



      
      

粘贴到

请参阅事件采集指南中的[批次](https://docs.didit.me/zh/transaction-monitoring/events.md#批量)。设备通道对 SDK 刷新的逐项处理结果与此相同，参见[SDK 事件提交](https://docs.didit.me/zh/transaction-monitoring/sdk-event-submission.md#批量处理)。


## OpenAPI

````yaml zh/openapi-25.json POST /v3/events/batch/
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/events/batch/:
    post:
      tags:
        - Monitoring Events
      summary: 批量创建监控事件
      description: >-
        在单个请求中提交 1 到 500 个事件，每个事件使用与 `POST /v3/events/`
        相同的外层结构。每个项目均单独进行验证、存储和评估，并获得各自的处理结果（`accepted`、`replayed` 或
        `rejected`），因此某个格式错误的事件绝不会导致其他事件回滚：当没有项目被拒绝时响应为 `201`，当至少有一个项目被拒绝时响应为
        `207`，两者均表示请求已处理。发送 `{"events": [...]}`；纯 JSON
        事件数组也可接受。必须为该应用开启事件摄取，否则整个请求将返回 `403` 及 `code:
        event_monitoring_disabled`，且不会存储任何内容。具有限定作用域的 API 密钥需要具备 `transactions:
        write` 权限。请参见
        [Batches](https://docs.didit.me/zh/transaction-monitoring/events#批量)。
      operationId: create_monitoring_events_batch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - events
              properties:
                events:
                  type: array
                  minItems: 1
                  maxItems: 500
                  description: >-
                    1 到 500 个事件。每项均遵循 `MonitoringEventCreateRequest`，包括
                    `occurred_at` 的过去 7 天和未来 5 分钟时间窗口。
                  items:
                    $ref: '#/components/schemas/MonitoringEventCreateRequest'
            example:
              events:
                - event_id: login-2026-10-17-000001
                  event_category: auth
                  action_type: login
                  occurred_at: '2026-10-17T09:15:02.481Z'
                  subject:
                    vendor_data: user-42
                - event_id: deposit-2026-10-17-000002
                  event_category: payment
                  action_type: deposit_completed
                  occurred_at: '2026-10-17T09:16:40Z'
                  subject:
                    vendor_data: user-42
                  transaction_context:
                    amount: '100.00'
                    currency: EUR
                    payment_reference_id: dep_736
                  payload:
                    payment_method: card
                    status: completed
      responses:
        '201':
          description: 没有任何项目被拒绝：每个项目均为 `accepted` 或 `replayed`。
          content:
            application/json:
              schema:
                type: object
                required:
                  - accepted_count
                  - replayed_count
                  - rejected_count
                  - results
                properties:
                  accepted_count:
                    type: integer
                    minimum: 0
                    description: 已存储并已评估的项目。
                  replayed_count:
                    type: integer
                    minimum: 0
                    description: 已存储且内容相同的项目。
                  rejected_count:
                    type: integer
                    minimum: 0
                    description: 未存储的项目。
                  results:
                    type: array
                    description: 每个项目对应一个条目，按请求顺序排列。
                    items:
                      type: object
                      description: >-
                        单个条目的处理结果。已接受和重放的条目还会包含 `MonitoringEventIngestResult`
                        的每个字段；被拒绝的条目则包含 `event_id` 和 `errors`。
                      required:
                        - index
                        - outcome
                      properties:
                        index:
                          type: integer
                          minimum: 0
                          description: 项目在 `events` 数组中的位置。
                        outcome:
                          type: string
                          enum:
                            - accepted
                            - replayed
                            - rejected
                          description: >-
                            `accepted`：已存储并评估。`replayed`：已存储相同内容。`rejected`：未存储；请参见
                            `errors`。
                        event_id:
                          type: string
                          nullable: true
                          description: >-
                            您的 `event_id`。对于因验证被拒绝的项，系统会从该项的 snake_case 命名
                            `event_id` 键中读取；因此当该项省略该键或发送了 `eventId` 别名时，此值为
                            null。
                        errors:
                          type: object
                          additionalProperties: true
                          description: >-
                            仅限已拒绝的项。以字段为键的验证错误，格式与 `POST /v3/events/` 的 `400`
                            相同；具有不同内容的重复使用的 `event_id` 会在 `errors.event_id`
                            下报告为字符串。
                        event_uuid:
                          type: string
                          format: uuid
                          description: 仅限已接受和重放的项目。
                        status:
                          type: string
                          enum:
                            - ACCEPTED
                            - APPROVED
                            - IN_REVIEW
                            - DECLINED
                          description: 仅限已接受和重放的项目。
                        score:
                          type: integer
                          description: 仅限已接受和重放的项目。
                        rules_evaluated_count:
                          type: integer
                          description: 仅限已接受和重放的项目。
                        rules_matched_count:
                          type: integer
                          description: 仅限已接受和重放的项目。
                        correlation_pending:
                          type: boolean
                          description: 仅限已接受和重放的项目。
                        retention_class:
                          type: string
                          enum:
                            - low_value
                            - standard
                            - risk_relevant
                            - monetary_or_compliance
                          description: 仅限已接受和重放的项目。
                        expires_at:
                          type: string
                          format: date-time
                          nullable: true
                          description: 仅限已接受和重放的项目。
                        idempotent_replay:
                          type: boolean
                          description: 仅限已接受和重放的项目。
                        rule_matches:
                          type: array
                          description: 仅限已接受和重放的项目。
                          items:
                            type: object
                            required:
                              - rule_id
                              - library_key
                              - mode
                              - is_async
                            properties:
                              rule_id:
                                type: string
                                format: uuid
                                description: 规则的 UUID。
                              library_key:
                                type: string
                                nullable: true
                                description: 规则从规则库安装时的库密钥，否则为 null。
                              mode:
                                type: string
                                enum:
                                  - ACTIVE
                                  - TEST
                                description: '`TEST` 规则会记录匹配，但不应用任何操作。'
                              is_async:
                                type: boolean
                                description: 当比对结果来自异步轮次时为 `true`。
              examples:
                All landed:
                  value:
                    accepted_count: 1
                    replayed_count: 1
                    rejected_count: 0
                    results:
                      - index: 0
                        outcome: accepted
                        event_uuid: 33333333-4444-5555-6666-777777777777
                        event_id: login-2026-10-17-000001
                        status: ACCEPTED
                        score: 0
                        rules_evaluated_count: 6
                        rules_matched_count: 0
                        correlation_pending: false
                        retention_class: standard
                        expires_at: '2026-11-16T09:15:02.481000Z'
                        idempotent_replay: false
                        rule_matches: []
                      - index: 1
                        outcome: replayed
                        event_uuid: 11111111-2222-3333-4444-555555555555
                        event_id: deposit-2026-10-17-000002
                        status: ACCEPTED
                        score: 0
                        rules_evaluated_count: 6
                        rules_matched_count: 0
                        correlation_pending: false
                        retention_class: monetary_or_compliance
                        expires_at: null
                        idempotent_replay: true
                        rule_matches: []
        '207':
          description: 至少有一个项目被拒绝。其他项目已存储；请仅修复并重新发送被拒绝的项目（重新发送已接受的项目是安全的，会返回 `replayed`）。
          content:
            application/json:
              schema:
                type: object
                required:
                  - accepted_count
                  - replayed_count
                  - rejected_count
                  - results
                properties:
                  accepted_count:
                    type: integer
                    minimum: 0
                    description: 已存储并已评估的项目。
                  replayed_count:
                    type: integer
                    minimum: 0
                    description: 已存储且内容相同的项目。
                  rejected_count:
                    type: integer
                    minimum: 0
                    description: 未存储的项目。
                  results:
                    type: array
                    description: 每个项目对应一个条目，按请求顺序排列。
                    items:
                      type: object
                      description: >-
                        单个条目的处理结果。已接受和重放的条目还会包含 `MonitoringEventIngestResult`
                        的每个字段；被拒绝的条目则包含 `event_id` 和 `errors`。
                      required:
                        - index
                        - outcome
                      properties:
                        index:
                          type: integer
                          minimum: 0
                          description: 项目在 `events` 数组中的位置。
                        outcome:
                          type: string
                          enum:
                            - accepted
                            - replayed
                            - rejected
                          description: >-
                            `accepted`：已存储并评估。`replayed`：已存储相同内容。`rejected`：未存储；请参见
                            `errors`。
                        event_id:
                          type: string
                          nullable: true
                          description: >-
                            您的 `event_id`。对于因验证被拒绝的项，系统会从该项的 snake_case 命名
                            `event_id` 键中读取；因此当该项省略该键或发送了 `eventId` 别名时，此值为
                            null。
                        errors:
                          type: object
                          additionalProperties: true
                          description: >-
                            仅限已拒绝的项。以字段为键的验证错误，格式与 `POST /v3/events/` 的 `400`
                            相同；具有不同内容的重复使用的 `event_id` 会在 `errors.event_id`
                            下报告为字符串。
                        event_uuid:
                          type: string
                          format: uuid
                          description: 仅限已接受和重放的项目。
                        status:
                          type: string
                          enum:
                            - ACCEPTED
                            - APPROVED
                            - IN_REVIEW
                            - DECLINED
                          description: 仅限已接受和重放的项目。
                        score:
                          type: integer
                          description: 仅限已接受和重放的项目。
                        rules_evaluated_count:
                          type: integer
                          description: 仅限已接受和重放的项目。
                        rules_matched_count:
                          type: integer
                          description: 仅限已接受和重放的项目。
                        correlation_pending:
                          type: boolean
                          description: 仅限已接受和重放的项目。
                        retention_class:
                          type: string
                          enum:
                            - low_value
                            - standard
                            - risk_relevant
                            - monetary_or_compliance
                          description: 仅限已接受和重放的项目。
                        expires_at:
                          type: string
                          format: date-time
                          nullable: true
                          description: 仅限已接受和重放的项目。
                        idempotent_replay:
                          type: boolean
                          description: 仅限已接受和重放的项目。
                        rule_matches:
                          type: array
                          description: 仅限已接受和重放的项目。
                          items:
                            type: object
                            required:
                              - rule_id
                              - library_key
                              - mode
                              - is_async
                            properties:
                              rule_id:
                                type: string
                                format: uuid
                                description: 规则的 UUID。
                              library_key:
                                type: string
                                nullable: true
                                description: 规则从规则库安装时的库密钥，否则为 null。
                              mode:
                                type: string
                                enum:
                                  - ACTIVE
                                  - TEST
                                description: '`TEST` 规则会记录匹配，但不应用任何操作。'
                              is_async:
                                type: boolean
                                description: 当比对结果来自异步轮次时为 `true`。
              examples:
                Partial success:
                  value:
                    accepted_count: 1
                    replayed_count: 0
                    rejected_count: 2
                    results:
                      - index: 0
                        outcome: accepted
                        event_uuid: 33333333-4444-5555-6666-777777777777
                        event_id: login-2026-10-17-000001
                        status: ACCEPTED
                        score: 0
                        rules_evaluated_count: 6
                        rules_matched_count: 0
                        correlation_pending: false
                        retention_class: standard
                        expires_at: '2026-11-16T09:15:02.481000Z'
                        idempotent_replay: false
                        rule_matches: []
                      - index: 1
                        event_id: deposit-2026-10-17-000002
                        outcome: rejected
                        errors:
                          payload:
                            - >-
                              payment.deposit_completed requires:
                              payment_method, status.
                      - index: 2
                        event_id: login-2026-10-16-000777
                        outcome: rejected
                        errors:
                          event_id: >-
                            event_id 'login-2026-10-16-000777' already exists
                            with a different payload.
        '400':
          description: 批次本身格式错误：`events` 缺失、非数组、为空或包含超过 500 项。未存储任何内容；请拆分大批次。
          content:
            application/json:
              examples:
                Not a list:
                  value:
                    events: Expected a list of events.
                Empty:
                  value:
                    events: At least one event is required.
                Too many:
                  value:
                    events: A batch accepts at most 500 events; received 612.
        '401':
          description: 作用域 API 密钥已过期。仅过期的密钥会收到 `401`；缺失或无效的密钥会收到 `403`。
          content:
            application/json:
              examples:
                Expired key:
                  value:
                    detail: This API key has expired.
        '403':
          description: >-
            缺少 `x-api-key`（错误、已撤销或已过期的密钥会返回 `401`）、无 `transactions: write`
            权限的作用域密钥、仅限于某些工作流或已通过会话的密钥（此类密钥绝无法访问交易监控数据），或来自密钥 IP
            白名单之外的请求。在应用关闭事件摄取时也会返回 `code:
            event_monitoring_disabled`；在此情况下不会存储任何内容，且该检查在验证请求体之前运行。
          content:
            application/json:
              examples:
                Event monitoring disabled:
                  value:
                    detail: >-
                      Event monitoring is not enabled for this application. Turn
                      on event ingestion in the transaction monitoring settings
                      before submitting events.
                    code: event_monitoring_disabled
                Missing or invalid API key:
                  value:
                    detail: You do not have permission to perform this action.
                Scoped key without access:
                  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.
                IP not allowed:
                  value:
                    detail: This API key can't be used from this IP address.
        '429':
          description: >-
            超出速率限制：交易创建和事件摄入（`POST /v3/transactions/`、`POST /v3/events/`、`POST
            /v3/events/batch/`）共享每个 API 密钥每分钟 600 次请求的配额，独立于所有其他写入请求共享的 300
            次配额。请等待 `Retry-After` 秒，然后重试。
          headers:
            Retry-After:
              description: 重试前需等待的秒数，向上取整以确保重试落在下一个时间窗口内。
              schema:
                type: integer
                minimum: 1
                example: 30
          content:
            application/json:
              examples:
                Throttled:
                  value:
                    detail: >-
                      Ingestion rate limit exceeded. You can make up to 600
                      requests per minute.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: |-
            curl -X POST 'https://verification.didit.me/v3/events/batch/' \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{
                "events": [
                  {"event_id": "login-2026-10-17-000001", "event_category": "auth", "action_type": "login",
                   "occurred_at": "2026-10-17T09:15:02.481Z", "subject": {"vendor_data": "user-42"}},
                  {"event_id": "deposit-2026-10-17-000002", "event_category": "payment", "action_type": "deposit_completed",
                   "occurred_at": "2026-10-17T09:16:40.000Z", "subject": {"vendor_data": "user-42"},
                   "transaction_context": {"amount": "100.00", "currency": "EUR", "payment_reference_id": "dep_736"},
                   "payload": {"payment_method": "card", "status": "completed"}}
                ]
              }'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.monitoring_events.create_batch(
                events=[{
                    "event_id": "login-2026-10-17-000001",
                    "event_category": "auth",
                    "action_type": "login",
                    "occurred_at": "2026-10-17T09:15:02.481Z",
                    "subject": {
                        "vendor_data": "user-42",
                    },
                }, {
                    "event_id": "deposit-2026-10-17-000002",
                    "event_category": "payment",
                    "action_type": "deposit_completed",
                    "occurred_at": "2026-10-17T09:16:40Z",
                    "subject": {
                        "vendor_data": "user-42",
                    },
                    "transaction_context": {
                        "amount": "100.00",
                        "currency": "EUR",
                        "payment_reference_id": "dep_736",
                    },
                    "payload": {"payment_method": "card", "status": "completed"},
                }],
            )
            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.monitoringEvents.createBatch({
              events: [{
                event_id: "login-2026-10-17-000001",
                event_category: "auth",
                action_type: "login",
                occurred_at: "2026-10-17T09:15:02.481Z",
                subject: {
                  vendor_data: "user-42",
                },
              }, {
                event_id: "deposit-2026-10-17-000002",
                event_category: "payment",
                action_type: "deposit_completed",
                occurred_at: "2026-10-17T09:16:40Z",
                subject: {
                  vendor_data: "user-42",
                },
                transaction_context: {
                  amount: "100.00",
                  currency: "EUR",
                  payment_reference_id: "dep_736",
                },
                payload: { payment_method: "card", status: "completed" },
              }],
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.MonitoringEvents.CreateBatch(ctx, didit.MonitoringEventsCreateBatchParams{\n\tEvents: []didit.MonitoringEventCreateRequest{{\n\t\tEventID:       \"login-2026-10-17-000001\",\n\t\tEventCategory: \"auth\",\n\t\tActionType:    \"login\",\n\t\tOccurredAt:    time.Date(2026, 10, 17, 9, 15, 2, 0, time.UTC),\n\t\tSubject: didit.MonitoringEventCreateRequestSubject{\n\t\t\tVendorData: \"user-42\",\n\t\t},\n\t}, {\n\t\tEventID:       \"deposit-2026-10-17-000002\",\n\t\tEventCategory: \"payment\",\n\t\tActionType:    \"deposit_completed\",\n\t\tOccurredAt:    time.Date(2026, 10, 17, 9, 16, 40, 0, time.UTC),\n\t\tSubject: didit.MonitoringEventCreateRequestSubject{\n\t\t\tVendorData: \"user-42\",\n\t\t},\n\t\tTransactionContext: didit.Some(didit.MonitoringEventCreateRequestTransactionContext{\n\t\t\tAmount:             didit.String(\"100.00\"),\n\t\t\tCurrency:           didit.String(\"EUR\"),\n\t\t\tPaymentReferenceID: didit.String(\"dep_736\"),\n\t\t}),\n\t\tPayload: didit.Some(map[string]any{\"payment_method\": \"card\", \"status\": \"completed\"}),\n\t}},\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import java.time.OffsetDateTime;

            import java.util.List;

            import java.util.Map;

            import me.didit.Didit;

            import me.didit.types.MonitoringEventCreateRequest;

            import me.didit.types.MonitoringEventsCreateBatchParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.monitoringEvents().createBatch(MonitoringEventsCreateBatchParams.builder()
                    .events(List.of(
                            MonitoringEventCreateRequest.builder()
                                    .eventId("login-2026-10-17-000001")
                                    .eventCategory(MonitoringEventCreateRequest.EventCategory.of("auth"))
                                    .actionType("login")
                                    .occurredAt(OffsetDateTime.parse("2026-10-17T09:15:02.481Z"))
                                    .subject(MonitoringEventCreateRequest.Subject.builder()
                                            .vendorData("user-42")
                                            .build())
                                    .build(),
                            MonitoringEventCreateRequest.builder()
                                    .eventId("deposit-2026-10-17-000002")
                                    .eventCategory(MonitoringEventCreateRequest.EventCategory.of("payment"))
                                    .actionType("deposit_completed")
                                    .occurredAt(OffsetDateTime.parse("2026-10-17T09:16:40Z"))
                                    .subject(MonitoringEventCreateRequest.Subject.builder()
                                            .vendorData("user-42")
                                            .build())
                                    .transactionContext(MonitoringEventCreateRequest.TransactionContext.builder()
                                            .amount("100.00")
                                            .currency("EUR")
                                            .paymentReferenceId("dep_736")
                                            .build())
                                    .payload(Map.of("payment_method", "card", "status", "completed"))
                                    .build()))
                    .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->monitoringEvents->createBatch([
                'events' => [[
                    'event_id' => 'login-2026-10-17-000001',
                    'event_category' => 'auth',
                    'action_type' => 'login',
                    'occurred_at' => '2026-10-17T09:15:02.481Z',
                    'subject' => [
                        'vendor_data' => 'user-42',
                    ],
                ], [
                    'event_id' => 'deposit-2026-10-17-000002',
                    'event_category' => 'payment',
                    'action_type' => 'deposit_completed',
                    'occurred_at' => '2026-10-17T09:16:40Z',
                    'subject' => [
                        'vendor_data' => 'user-42',
                    ],
                    'transaction_context' => [
                        'amount' => '100.00',
                        'currency' => 'EUR',
                        'payment_reference_id' => 'dep_736',
                    ],
                    'payload' => ['payment_method' => 'card', 'status' => 'completed'],
                ]],
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            result = didit.monitoring_events.create_batch(
              events: [{
                event_id: "login-2026-10-17-000001",
                event_category: "auth",
                action_type: "login",
                occurred_at: "2026-10-17T09:15:02.481Z",
                subject: {
                  vendor_data: "user-42",
                },
              }, {
                event_id: "deposit-2026-10-17-000002",
                event_category: "payment",
                action_type: "deposit_completed",
                occurred_at: "2026-10-17T09:16:40Z",
                subject: {
                  vendor_data: "user-42",
                },
                transaction_context: {
                  amount: "100.00",
                  currency: "EUR",
                  payment_reference_id: "dep_736",
                },
                payload: { payment_method: "card", status: "completed" },
              }]
            )
            puts result.to_h
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using System.Collections.Generic;

            using System.Text.Json;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            var result = await client.MonitoringEvents.CreateBatchAsync(new
            MonitoringEventsCreateBatchParams

            {
                Events = new MonitoringEventCreateRequest[]
                {
                    new()
                    {
                        EventId = "login-2026-10-17-000001",
                        EventCategory = "auth",
                        ActionType = "login",
                        OccurredAt = DateTimeOffset.Parse("2026-10-17T09:15:02.481Z"),
                        Subject = new()
                        {
                            VendorData = "user-42",
                        },
                    },
                    new()
                    {
                        EventId = "deposit-2026-10-17-000002",
                        EventCategory = "payment",
                        ActionType = "deposit_completed",
                        OccurredAt = DateTimeOffset.Parse("2026-10-17T09:16:40Z"),
                        Subject = new()
                        {
                            VendorData = "user-42",
                        },
                        TransactionContext = new MonitoringEventCreateRequestTransactionContext
                        {
                            Amount = "100.00",
                            Currency = "EUR",
                            PaymentReferenceId = "dep_736",
                        },
                        Payload = new Dictionary<string, object> { ["payment_method"] = "card", ["status"] = "completed" },
                    },
                },
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    MonitoringEventCreateRequest:
      type: object
      description: >-
        事件信封，每个类别均相同。支持 camelCase 别名：`eventId`、`eventCategory`（或
        `category`）、`actionType`、`occurredAt`、`timeZone`（或
        `zoneId`）、`deviceContext`（或
        `device`）、`transactionContext`、`customValues`（或 `props`）；在 `subject`
        内支持：`vendorData`、`entityType`、`fullName`；在 `session`
        内支持：`sessionId`、`pageUrl`；在 `transaction_context`
        内支持：`paymentReferenceId`。
      required:
        - event_id
        - event_category
        - action_type
        - occurred_at
        - subject
      properties:
        event_id:
          type: string
          maxLength: 128
          description: >-
            您对事件的标识符，在每个应用中唯一。它是幂等性密钥：在其下重新发送相同的
            `event_category`、`action_type`、`occurred_at`、`subject.vendor_data` 和
            `payload` 将被视为重放，任何不同则会导致冲突。
          example: login-2026-10-17-000001
        event_category:
          type: string
          enum:
            - auth
            - session
            - gameplay
            - bonus
            - affiliate
            - payment
            - dispute
            - security
            - responsible_gambling
            - custom
          description: 事件类别。
          example: auth
        action_type:
          type: string
          minLength: 1
          maxLength: 128
          description: >-
            该类别中发生的情况。开放词汇；[事件摄入](https://docs.didit.me/zh/transaction-monitoring/events)中列出的托管操作（例如
            `login`、`deposit_completed`、`chargeback_opened`）会启用类型化验证和托管规则字段。首尾空格会被去除。
          example: login
        occurred_at:
          type: string
          format: date-time
          description: 事件在您方发生的时间，ISO 8601 格式（无偏移量的值视为 UTC）。不能早于过去 7 天，也不能晚于未来 5 分钟。
          example: '2026-10-17T09:15:02.481Z'
        time_zone:
          type: string
          nullable: true
          maxLength: 64
          description: 您所在一侧事件发生时的时区，例如 `Europe/Madrid`。与事件一同存储；读取 endpoint 不会返回。
        subject:
          type: object
          description: 事件所属的用户或公司。它会解析为您的应用中具有此 `vendor_data` 的用户（或公司）；若不存在则会创建一个。
          required:
            - vendor_data
          properties:
            vendor_data:
              type: string
              minLength: 1
              maxLength: 255
              description: 您对主体的 ID。
              example: user-42
            entity_type:
              type: string
              maxLength: 32
              default: individual
              description: >-
                `company` 将主体解析为企业；任何其他值（默认 `individual`）将其解析为个人。同一个
                `vendor_data` 可以分别指代一个企业和一个个人。
              example: individual
            full_name:
              type: string
              nullable: true
              maxLength: 512
              description: 显示名称，仅在此事件创建用户或企业时使用。
            email:
              type: string
              format: email
              nullable: true
              description: 已验证为邮箱地址；不会存储在事件中。
            phone:
              type: string
              nullable: true
              maxLength: 32
              description: 已验证；不会存储在事件中。
            country:
              type: string
              nullable: true
              maxLength: 3
              description: 已验证；不会存储在事件中。
        business:
          type: object
          description: 事件所属的企业（当与主体不同时）。仅读取 `vendor_data`。
          additionalProperties: true
          properties:
            vendor_data:
              type: string
              maxLength: 255
              description: 您对企业的 ID。可作为 `business_vendor_data` 进行过滤。
              example: merchant-7
        session:
          type: object
          description: 您针对该事件的会话上下文。
          properties:
            session_id:
              type: string
              nullable: true
              maxLength: 255
              description: 您的会话标识符。可作为 `session_id` 进行过滤和返回。
            sequence:
              type: integer
              nullable: true
              description: 事件在会话中的位置。以 `session_sequence` 返回。
            page_url:
              type: string
              nullable: true
              maxLength: 2048
              description: 已验证；不会存储在事件中。
            referrer:
              type: string
              nullable: true
              maxLength: 2048
              description: 已验证；不会存储在事件中。
        device_context:
          type: object
          additionalProperties: true
          description: >-
            设备与网络上下文，按发送原样存储并通过 `GET /v3/events/{event_uuid}/` 返回。在此服务器通道上，Didit
            无法看到终端用户的连接，因此规则进行丰富并使用的 IP 是您发送的 `network_context.ip_address`。
          properties:
            fingerprint:
              type: string
              maxLength: 255
              description: 设备指纹。可通过 `device_fingerprint` 进行过滤。
            persistent_device_id:
              type: string
              maxLength: 255
              description: 您的持久化设备标识符。
            bot_score:
              type: integer
              description: 来自您自有检测的机器人评分，为整数。
            network_context:
              type: object
              additionalProperties: true
              properties:
                ip_address:
                  type: string
                  maxLength: 64
                  description: 终端用户的地址。公网地址按每个唯一地址丰富化一次。
                  example: 203.0.113.42
        transaction_context:
          type: object
          description: 金额上下文。此处的非空值也会满足操作所需的 payload 键。
          properties:
            amount:
              type: string
              nullable: true
              description: 以十进制字符串表示的金额（亦可接受数字）。
              example: '1000.00'
            currency:
              type: string
              nullable: true
              maxLength: 10
              description: 货币代码。
            direction:
              type: string
              nullable: true
              maxLength: 16
              description: 资金流动方向，例如 `inbound` 或 `outbound`。
            payment_reference_id:
              type: string
              nullable: true
              maxLength: 255
              description: 您的付款参考编号。可作为 `payment_reference_id` 进行过滤。
        payload:
          type: object
          additionalProperties: true
          description: >-
            类别的领域字段，JSON 编码后最多 16384 字节。部分操作需要指定键（在 `payload` 或
            `transaction_context` 中）：`gameplay.p2p_settlement` 需要
            `game_id`、`counterparty_vendor_data`、`stake_amount`、`net_result_amount`、`role`
            以及 `hand_id`、`round_id`、`match_id` 之一；`gameplay.bet_placed` 和
            `gameplay.bet_settled` 需要
            `game_id`；`payment.deposit_initiated`、`payment.deposit_completed`、`payment.withdrawal_requested`
            和 `payment.withdrawal_completed` 需要
            `payment_reference_id`、`amount`、`currency`、`payment_method`、`status`；`payment.withdrawal_address_changed`
            需要
            `withdrawal_address_hash`；`dispute.chargeback_opened`、`dispute.chargeback_won`
            和 `dispute.chargeback_lost` 需要 `payment_reference_id` 以及
            `dispute_id`、`chargeback_id` 之一；`session.bot_signal_observed` 需要
            `telemetry_schema_version` 以及
            `bot_score`、`actions_per_minute`、`timing_variance_ms`、`pointer_entropy`、`keystroke_entropy`、`reaction_time_ms_p50`
            之一；`responsible_gambling.self_exclusion_match` 需要
            `registry_source`、`exclusion_status`、`identity_match_ref`。以
            `_changed` 结尾的每个 `security` 操作都需要 `changed_field`，并且当字段为
            `password`、`mfa_method`、`mfa`、`email`、`phone`、`withdrawal_address`、`payout_method`
            或 `api_key` 时，还需要 `previous_reference_hash` 或
            `new_reference_hash`。请发送哈希和引用，切勿发送卡号、完整提现地址、密码哈希或 MFA 密钥。
        custom_values:
          type: object
          description: >-
            最多 100 个自定义键，可在规则中通过 `custom_values.<key>` 寻址。值必须为标量（字符串、数字、布尔值或
            null）；不支持嵌套对象和数组。
          additionalProperties:
            nullable: true
            oneOf:
              - type: string
              - type: number
              - type: boolean
      example:
        event_id: login-2026-10-17-000001
        event_category: auth
        action_type: login
        occurred_at: '2026-10-17T09:15:02.481Z'
        time_zone: Europe/Madrid
        subject:
          vendor_data: user-42
          entity_type: individual
        session:
          session_id: web-session-abc
          sequence: 142
        device_context:
          fingerprint: fp-a8c1
          network_context:
            ip_address: 203.0.113.42
        payload:
          method: password
        custom_values:
          vip_tier: gold
  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.