> ## 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 - KYTルール

> Didit APIでカスタムKYTルールを作成。条件、ベロシティウィンドウ、スコープ、アクションの完全なスキーマを掲載。TESTモードで作成し、バックテスト後に有効化します。



ルール作成APIプロンプト
        プロンプトをクリップボードにコピー



      
      

\<pre>

\`Create a custom transaction-monitoring rule on my Didit application.

Endpoint:
POST https://verification.didit.me/v3/transactions/rules/

Authentication:
Use the x-api-key header with my Didit API key.

Request body (application/json):
\{
"title": "Structuring - inbound (custom)",   // required, unique per application - duplicate -> 400
"description": "20+ inbound EUR transfers, all under 10,000 EUR, 30 days",
"category": "finance",                        // required: finance, aml_ctf, anomaly_detection, fatf, device_intelligence, crypto_monitoring, travel_rule, responsible_gaming, e_commerce, ...
"mode": "TEST",                               // required: TEST (recommended start - evaluates, never affects transactions), ACTIVE, DISABLED
"evaluation_mode": "ALL",                     // ALL = every condition must match, ANY = at least one
"scope": {"transaction_types": ["finance"], "directions": ["INBOUND"]},  // constrains the transaction being evaluated; optional keys: transaction_types, directions (INBOUND/OUTBOUND), action_types
"conditions": [                               // read the transaction being evaluated, never the history window
\{"field": "currency", "operator": "eq", "value": "EUR"},
\{"field": "amount", "operator": "lt", "value": 10000}
],
"aggregation": [                              // velocity over the history window: ALL entries must match
\{"metric": "count", "operator": "gte", "value": 20, "window": "30d",
 "filters": {"direction": "INBOUND", "transaction_type": "finance", "currency": "EUR", "subject_vendor_data": "__current__"}},
\{"metric": "max", "field": "amount", "operator": "lt", "value": 10000, "window": "30d",
 "filters": {"direction": "INBOUND", "transaction_type": "finance", "currency": "EUR", "subject_vendor_data": "__current__"}}
],
"actions": [{"type": "add_score", "value": 35}]
}

Schema essentials:
\- Condition operators: eq, ne, gt, gte, lt, lte, in, not_in, contains, not_contains, contains_any (list of strings), regex, fuzzy_match (needs "score" 0-100), exists/is_not_empty/is_not_null, not_exists/is_empty/is_null.
\- Condition fields include amount, preferred_currency_amount, direction, action_type, payment_details, subject_vendor_data, counterparty_country, subject_device_fingerprint, subject_payment_method_*, travel_rule_status, tags, and custom_values.<key> for your own custom_properties.
\- value_type turns "value" into a List UUID ("list"), another field path ("field"), or a relative date ("relative_date").
\- Aggregation windows: <N>m (MINUTES), <N>h, <N>d. A filter value of "__current__" means same-as-the-evaluated-transaction.
\- Conditions and aggregation filters are NOT interchangeable. A condition constrains only the transaction being evaluated; an aggregation filter constrains only the historical window, and it compares by equality or list membership - there is no lt/gte filter. Express a range over the window as a max/min aggregation (e.g. max amount lt 10000 with currency pinned to EUR keeps every transaction in that window under 10,000 EUR), and repeat direction/currency/transaction_type on BOTH halves when the rule promises them - otherwise the rule fires on transactions it never meant to cover.
\- Actions: add_score {value}, change_status {value, workflow_id (REQUIRED for AWAITING_USER)}, add_tags {tag_uuid|tag_name, tag_color}, add_note {note}, add_to_list {list_id}, open_case {blueprint, grouping, attach_matched_transaction}.

Recommended workflow:
1\. Create in mode TEST.
2\. POST /v3/transactions/rules/backtest/ with the SAME conditions, aggregation, evaluation_mode and scope to see matches over your history. Omitted conditions, aggregation and scope add no constraints of their own; dropping scope can include directions or transaction types the saved rule skips. Omitted evaluation_mode defaults to ALL (which can reduce matches for an ANY rule), and omitted period_days defaults to 90 days, not unlimited history.
3\. PATCH the rule to mode ACTIVE once the numbers look right.

Sandbox fixtures for this example: at least 20 inbound EUR finance transactions for the same subject within 30 days, each with raw amount below 10000. No normalized amount is required. Sandbox ingestion does not evaluate rules; call backtest explicitly.

Failure modes:
\- 400 - duplicate title, unknown operator/metric, malformed window, invalid scope direction, contains_any without a list, fuzzy_match without a score, or AWAITING_USER without workflow_id. The body names the exact index and problem.
\- 401 - missing or malformed x-api-key.

Full guide: /transaction-monitoring/rules-api.`

\</pre>



      
      

貼り付け先



## OpenAPI

````yaml ja/openapi-25.json POST /v3/transactions/rules/
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/rules/:
    post:
      tags:
        - Transactions
      summary: ルールを作成
      description: >-
        CUSTOMのトランザクションモニタリングルールを作成します。タイトルはアプリケーションごとに一意です（重複すると400）。`AWAITING_USER`を対象とする`change_status`アクションには`workflow_id`を含める必要があります。ACTIVEモードで作成したルールは新しい取引に即座に適用されます。推奨される手順は、TESTモードで作成し、バックテストを行ってから、モードをACTIVEに切り替えることです。
      operationId: createTransactionRule
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionRuleCreateRequest'
            example:
              title: Structuring - inbound (custom)
              description: 20+ inbound EUR transfers, all under 10,000 EUR, 30 days
              category: finance
              mode: TEST
              evaluation_mode: ALL
              scope:
                transaction_types:
                  - finance
                directions:
                  - INBOUND
              conditions:
                - field: currency
                  operator: eq
                  value: EUR
                - field: amount
                  operator: lt
                  value: 10000
              aggregation:
                - metric: count
                  operator: gte
                  value: 20
                  window: 30d
                  filters:
                    direction: INBOUND
                    transaction_type: finance
                    subject_vendor_data: __current__
                    currency: EUR
                - metric: max
                  field: amount
                  operator: lt
                  value: 10000
                  window: 30d
                  filters:
                    direction: INBOUND
                    transaction_type: finance
                    subject_vendor_data: __current__
                    currency: EUR
              actions:
                - type: add_score
                  value: 35
      responses:
        '201':
          description: 作成されたルール。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionRuleDetail'
        '400':
          description: >-
            検証エラー：タイトルの重複、不明な演算子/メトリクス、不正な形式のウィンドウ、無効なスコープ方向、またはworkflow_idのないAWAITING_USER。
          content:
            application/json:
              schema:
                type: object
              example:
                title:
                  - A rule with this name already exists.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X POST 'https://verification.didit.me/v3/transactions/rules/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"title": "Structuring - inbound (custom)", "description": "20+ inbound EUR transfers, all under 10,000 EUR, 30 days", "category": "finance", "mode": "TEST", "evaluation_mode": "ALL", "scope": {"transaction_types": ["finance"], "directions": ["INBOUND"]}, "conditions": [{"field": "currency", "operator": "eq", "value": "EUR"}, {"field": "amount", "operator": "lt", "value": 10000}], "aggregation": [{"metric": "count", "operator": "gte", "value": 20, "window": "30d", "filters": {"direction": "INBOUND", "transaction_type": "finance", "subject_vendor_data": "__current__", "currency": "EUR"}}, {"metric": "max", "field": "amount", "operator": "lt", "value": 10000, "window": "30d", "filters": {"direction": "INBOUND", "transaction_type": "finance", "subject_vendor_data": "__current__", "currency": "EUR"}}], "actions": [{"type": "add_score", "value": 35}]}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.transactions.rules.create(
                title="Structuring - inbound (custom)",
                description="20+ inbound EUR transfers, all under 10,000 EUR, 30 days",
                category="finance",
                mode="TEST",
                evaluation_mode="ALL",
                scope={
                    "transaction_types": ["finance"],
                    "directions": ["INBOUND"],
                },
                conditions=[{
                    "field": "currency",
                    "operator": "eq",
                    "value": "EUR",
                }, {
                    "field": "amount",
                    "operator": "lt",
                    "value": 10000,
                }],
                aggregation=[{
                    "metric": "count",
                    "operator": "gte",
                    "value": 20.0,
                    "window": "30d",
                    "filters": {"direction": "INBOUND", "transaction_type": "finance", "subject_vendor_data": "__current__", "currency": "EUR"},
                }, {
                    "metric": "max",
                    "field": "amount",
                    "operator": "lt",
                    "value": 10000.0,
                    "window": "30d",
                    "filters": {"direction": "INBOUND", "transaction_type": "finance", "subject_vendor_data": "__current__", "currency": "EUR"},
                }],
                actions=[{
                    "type": "add_score",
                    "value": 35,
                }],
            )
            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.rules.create({
              title: "Structuring - inbound (custom)",
              description: "20+ inbound EUR transfers, all under 10,000 EUR, 30 days",
              category: "finance",
              mode: "TEST",
              evaluation_mode: "ALL",
              scope: {
                transaction_types: ["finance"],
                directions: ["INBOUND"],
              },
              conditions: [{
                field: "currency",
                operator: "eq",
                value: "EUR",
              }, {
                field: "amount",
                operator: "lt",
                value: 10000,
              }],
              aggregation: [{
                metric: "count",
                operator: "gte",
                value: 20.0,
                window: "30d",
                filters: { direction: "INBOUND", transaction_type: "finance", subject_vendor_data: "__current__", currency: "EUR" },
              }, {
                metric: "max",
                field: "amount",
                operator: "lt",
                value: 10000.0,
                window: "30d",
                filters: { direction: "INBOUND", transaction_type: "finance", subject_vendor_data: "__current__", currency: "EUR" },
              }],
              actions: [{
                type: "add_score",
                value: 35,
              }],
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Transactions.Rules.Create(ctx, didit.TransactionRuleCreateRequest{\n\tTitle:          \"Structuring - inbound (custom)\",\n\tDescription:    didit.String(\"20+ inbound EUR transfers, all under 10,000 EUR, 30 days\"),\n\tCategory:       \"finance\",\n\tMode:           \"TEST\",\n\tEvaluationMode: didit.Some(didit.TransactionRuleCreateRequestEvaluationMode(\"ALL\")),\n\tScope: didit.Some(didit.TransactionRuleScopeParam{\n\t\tTransactionTypes: didit.Some([]string{\"finance\"}),\n\t\tDirections:       didit.Some([]didit.TransactionRuleScopeDirections{\"INBOUND\"}),\n\t}),\n\tConditions: didit.Some([]didit.TransactionRuleConditionParam{{\n\t\tField:    \"currency\",\n\t\tOperator: \"eq\",\n\t\tValue:    didit.Some[any](\"EUR\"),\n\t}, {\n\t\tField:    \"amount\",\n\t\tOperator: \"lt\",\n\t\tValue:    didit.Some[any](10000),\n\t}}),\n\tAggregation: didit.Some([]didit.TransactionRuleAggregationParam{{\n\t\tMetric:   didit.Some(didit.TransactionRuleAggregationMetric(\"count\")),\n\t\tOperator: didit.Some(didit.TransactionRuleAggregationOperator(\"gte\")),\n\t\tValue:    20.0,\n\t\tWindow:   didit.String(\"30d\"),\n\t\tFilters:  didit.Some(map[string]any{\"direction\": \"INBOUND\", \"transaction_type\": \"finance\", \"subject_vendor_data\": \"__current__\", \"currency\": \"EUR\"}),\n\t}, {\n\t\tMetric:   didit.Some(didit.TransactionRuleAggregationMetric(\"max\")),\n\t\tField:    didit.String(\"amount\"),\n\t\tOperator: didit.Some(didit.TransactionRuleAggregationOperator(\"lt\")),\n\t\tValue:    10000.0,\n\t\tWindow:   didit.String(\"30d\"),\n\t\tFilters:  didit.Some(map[string]any{\"direction\": \"INBOUND\", \"transaction_type\": \"finance\", \"subject_vendor_data\": \"__current__\", \"currency\": \"EUR\"}),\n\t}}),\n\tActions: didit.Some([]didit.TransactionRuleActionParam{{\n\t\tType:  \"add_score\",\n\t\tValue: didit.Some[any](35),\n\t}}),\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import java.util.List;

            import java.util.Map;

            import me.didit.Didit;

            import me.didit.types.TransactionRuleAction;

            import me.didit.types.TransactionRuleActionAddScore;

            import me.didit.types.TransactionRuleAggregation;

            import me.didit.types.TransactionRuleCondition;

            import me.didit.types.TransactionRuleCreateRequest;

            import me.didit.types.TransactionRuleScope;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.transactions().rules().create(TransactionRuleCreateRequest.builder()
                    .title("Structuring - inbound (custom)")
                    .description("20+ inbound EUR transfers, all under 10,000 EUR, 30 days")
                    .category("finance")
                    .mode(TransactionRuleCreateRequest.Mode.of("TEST"))
                    .evaluationMode(TransactionRuleCreateRequest.EvaluationMode.of("ALL"))
                    .scope(TransactionRuleScope.builder()
                            .transactionTypes(List.of("finance"))
                            .directions(List.of(TransactionRuleScope.Directions.of("INBOUND")))
                            .build())
                    .conditions(List.of(
                            TransactionRuleCondition.builder()
                                    .field("currency")
                                    .operator(TransactionRuleCondition.Operator.of("eq"))
                                    .value("EUR")
                                    .build(),
                            TransactionRuleCondition.builder()
                                    .field("amount")
                                    .operator(TransactionRuleCondition.Operator.of("lt"))
                                    .value(10000)
                                    .build()))
                    .aggregation(List.of(
                            TransactionRuleAggregation.builder()
                                    .metric(TransactionRuleAggregation.Metric.of("count"))
                                    .operator(TransactionRuleAggregation.Operator.of("gte"))
                                    .value(20.0)
                                    .window("30d")
                                    .filters(Map.of("direction", "INBOUND", "transaction_type", "finance", "subject_vendor_data", "__current__", "currency", "EUR"))
                                    .build(),
                            TransactionRuleAggregation.builder()
                                    .metric(TransactionRuleAggregation.Metric.of("max"))
                                    .field("amount")
                                    .operator(TransactionRuleAggregation.Operator.of("lt"))
                                    .value(10000.0)
                                    .window("30d")
                                    .filters(Map.of("direction", "INBOUND", "transaction_type", "finance", "subject_vendor_data", "__current__", "currency", "EUR"))
                                    .build()))
                    .actions(List.of(TransactionRuleAction.ofAddScore(TransactionRuleActionAddScore.builder()
                            .type(TransactionRuleActionAddScore.Type.of("add_score"))
                            .value(35L)
                            .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->transactions->rules->create([
                'title' => 'Structuring - inbound (custom)',
                'description' => '20+ inbound EUR transfers, all under 10,000 EUR, 30 days',
                'category' => 'finance',
                'mode' => 'TEST',
                'evaluation_mode' => 'ALL',
                'scope' => [
                    'transaction_types' => ['finance'],
                    'directions' => ['INBOUND'],
                ],
                'conditions' => [[
                    'field' => 'currency',
                    'operator' => 'eq',
                    'value' => 'EUR',
                ], [
                    'field' => 'amount',
                    'operator' => 'lt',
                    'value' => 10000,
                ]],
                'aggregation' => [[
                    'metric' => 'count',
                    'operator' => 'gte',
                    'value' => 20.0,
                    'window' => '30d',
                    'filters' => ['direction' => 'INBOUND', 'transaction_type' => 'finance', 'subject_vendor_data' => '__current__', 'currency' => 'EUR'],
                ], [
                    'metric' => 'max',
                    'field' => 'amount',
                    'operator' => 'lt',
                    'value' => 10000.0,
                    'window' => '30d',
                    'filters' => ['direction' => 'INBOUND', 'transaction_type' => 'finance', 'subject_vendor_data' => '__current__', 'currency' => 'EUR'],
                ]],
                'actions' => [[
                    'type' => 'add_score',
                    'value' => 35,
                ]],
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            result = didit.transactions.rules.create(
              title: "Structuring - inbound (custom)",
              description: "20+ inbound EUR transfers, all under 10,000 EUR, 30 days",
              category: "finance",
              mode: "TEST",
              evaluation_mode: "ALL",
              scope: {
                transaction_types: ["finance"],
                directions: ["INBOUND"],
              },
              conditions: [{
                field: "currency",
                operator: "eq",
                value: "EUR",
              }, {
                field: "amount",
                operator: "lt",
                value: 10000,
              }],
              aggregation: [{
                metric: "count",
                operator: "gte",
                value: 20.0,
                window: "30d",
                filters: { direction: "INBOUND", transaction_type: "finance", subject_vendor_data: "__current__", currency: "EUR" },
              }, {
                metric: "max",
                field: "amount",
                operator: "lt",
                value: 10000.0,
                window: "30d",
                filters: { direction: "INBOUND", transaction_type: "finance", subject_vendor_data: "__current__", currency: "EUR" },
              }],
              actions: [{
                type: "add_score",
                value: 35,
              }]
            )
            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.Transactions.Rules.CreateAsync(new
            TransactionRuleCreateRequest

            {
                Title = "Structuring - inbound (custom)",
                Description = "20+ inbound EUR transfers, all under 10,000 EUR, 30 days",
                Category = "finance",
                Mode = "TEST",
                EvaluationMode = new TransactionRuleCreateRequestEvaluationMode("ALL"),
                Scope = new TransactionRuleScope
                {
                    TransactionTypes = new string[] { "finance" },
                    Directions = new TransactionRuleScopeDirections[] { "INBOUND" },
                },
                Conditions = new TransactionRuleCondition[]
                {
                    new()
                    {
                        Field = "currency",
                        Operator = "eq",
                        Value = "EUR",
                    },
                    new()
                    {
                        Field = "amount",
                        Operator = "lt",
                        Value = 10000,
                    },
                },
                Aggregation = new TransactionRuleAggregation[]
                {
                    new()
                    {
                        Metric = new TransactionRuleAggregationMetric("count"),
                        Operator = new TransactionRuleAggregationOperator("gte"),
                        Value = 20.0,
                        Window = "30d",
                        Filters = new Dictionary<string, object> { ["direction"] = "INBOUND", ["transaction_type"] = "finance", ["subject_vendor_data"] = "__current__", ["currency"] = "EUR" },
                    },
                    new()
                    {
                        Metric = new TransactionRuleAggregationMetric("max"),
                        Field = "amount",
                        Operator = new TransactionRuleAggregationOperator("lt"),
                        Value = 10000.0,
                        Window = "30d",
                        Filters = new Dictionary<string, object> { ["direction"] = "INBOUND", ["transaction_type"] = "finance", ["subject_vendor_data"] = "__current__", ["currency"] = "EUR" },
                    },
                },
                Actions = new TransactionRuleAction[]
                {
                    new()
                    {
                        Type = new TransactionRuleActionType("add_score"),
                        Value = 35,
                    },
                },
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    TransactionRuleCreateRequest:
      type: object
      required:
        - title
        - category
        - mode
      properties:
        title:
          type: string
          description: ルール名。アプリケーション内の削除されていないルールの間で一意である必要があり、重複する場合は400が返されます。
        description:
          type: string
          nullable: true
        category:
          type: string
          description: >-
            グループ化とレポートに使用されるリスクテーマです。例:
            finance、aml_ctf、anomaly_detection、fatf、device_intelligence、crypto_monitoring、travel_rule、responsible_gaming、e_commerce。
        mode:
          type: string
          enum:
            - ACTIVE
            - DISABLED
            - TEST
          description: >-
            ACTIVEは本番で評価します。TESTは評価してルールの実行を記録しますが、スコアやステータスには一切影響しません。最初に推奨されるモードです。DISABLEDはスキップされます。
        evaluation_mode:
          type: string
          enum:
            - ALL
            - ANY
          default: ALL
          description: >-
            すべての条件に一致する必要がある（ALL）か、少なくとも1つに一致すればよい（ANY）かです。条件でgroup_indexを使用する場合は無視されます。
        scope:
          $ref: '#/components/schemas/TransactionRuleScope'
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/TransactionRuleCondition'
        aggregation:
          type: array
          items:
            $ref: '#/components/schemas/TransactionRuleAggregation'
        actions:
          type: array
          items:
            $ref: '#/components/schemas/TransactionRuleAction'
        metadata:
          type: object
          description: ルールに保存される自由形式のメタデータ。
      description: >-
        CUSTOMルールを作成します。ACTIVEモードのルールは新しい取引に即座に適用されるため、まずTESTモードで作成してバックテストを行ってください。
    TransactionRuleDetail:
      type: object
      properties:
        uuid:
          type: string
          format: uuid
        title:
          type: string
          description: ルール名。アプリケーション内の削除されていないルールの間で一意である必要があり、重複する場合は400が返されます。
        description:
          type: string
          nullable: true
        category:
          type: string
          description: >-
            グループ化とレポートに使用されるリスクテーマです。例:
            finance、aml_ctf、anomaly_detection、fatf、device_intelligence、crypto_monitoring、travel_rule、responsible_gaming、e_commerce。
        mode:
          type: string
          enum:
            - ACTIVE
            - DISABLED
            - TEST
          description: >-
            ACTIVEは本番で評価します。TESTは評価してルールの実行を記録しますが、スコアやステータスには一切影響しません。最初に推奨されるモードです。DISABLEDはスキップされます。
        evaluation_mode:
          type: string
          enum:
            - ALL
            - ANY
          default: ALL
          description: >-
            すべての条件に一致する必要がある（ALL）か、少なくとも1つに一致すればよい（ANY）かです。条件でgroup_indexを使用する場合は無視されます。
        scope:
          $ref: '#/components/schemas/TransactionRuleScope'
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/TransactionRuleCondition'
        aggregation:
          type: array
          items:
            $ref: '#/components/schemas/TransactionRuleAggregation'
        actions:
          type: array
          items:
            $ref: '#/components/schemas/TransactionRuleAction'
        metadata:
          type: object
          description: ルールに保存される自由形式のメタデータ。
        severity:
          type: string
          enum:
            - UNKNOWN
            - LOW
            - MEDIUM
            - HIGH
            - CRITICAL
          nullable: true
          description: ライブラリルールが持つ情報レベルの重大度。カスタムルールでは設定できません。
        source:
          type: string
          enum:
            - PRESET
            - CUSTOM
          description: >-
            PRESETルールはライブラリから提供されます（インストール/アンインストール、モードのみの編集）。CUSTOMルールは完全にお客様のものです。
        library_key:
          type: string
          nullable: true
          description: 安定したライブラリ識別子。カスタムルールの場合はnullです。
        latest_triggered_at:
          type: string
          format: date-time
          nullable: true
        run_count:
          type: integer
          description: このルールに一致した取引の数。
        approved_count:
          type: integer
        reviewed_count:
          type: integer
        declined_count:
          type: integer
        awaiting_user_count:
          type: integer
        approved_pct:
          type: number
        reviewed_pct:
          type: number
        declined_pct:
          type: number
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    TransactionRuleScope:
      type: object
      properties:
        transaction_types:
          type: array
          items:
            type: string
          description: >-
            取引の種類に限定します（例：finance、kyc、travel_rule、user_event）。空または未指定の場合は制限なしとなります。
        directions:
          type: array
          items:
            type: string
            enum:
              - INBOUND
              - OUTBOUND
          description: 取引の方向に限定します（書き込み時は大文字と小文字を区別しません）。
        action_types:
          type: array
          items:
            type: string
          description: 独自のaction_type値に限定します（例：withdrawal、deposit）。
      description: ルールを適用する取引。受け付けられるキーはこの3つのみです。
    TransactionRuleCondition:
      type: object
      required:
        - field
        - operator
      properties:
        field:
          type: string
          description: >-
            評価する取引フィールドのパス。主要フィールド: amount, currency, direction, action_type,
            score, severity, transaction_type, payment_details,
            preferred_currency_amount（ない場合はamount_in_default_currencyにフォールバック）,
            default_currency_code, subject_country, counterparty_country,
            subject_vendor_data, counterparty_vendor_data,
            subject_device_fingerprint, counterparty_device_fingerprint,
            subject_browser_family, subject_browser_version, subject_platform,
            subject_accept_language, subject_session_age_ms, subject_ip_country,
            counterparty_ip_country, subject_ip_address,
            counterparty_ip_address, subject_payment_method_type,
            subject_payment_method_country, subject_payment_method_fingerprint,
            subject_payment_method_account_id（およびcounterparty_payment_method_*の対応フィールド）,
            travel_rule_status, travel_rule_required,
            travel_rule_obligations_count,
            counterparty_dd_status（トラベルルールの取引相手に対するあなたの判定:
            APPROVED、RESTRICTEDまたはBLOCKED。エンティティはそのブランドの判定に従います）,
            counterparty_risk_level（LOW、MEDIUMまたはHIGH。自社の取引相手スクリーニングでフラグが立っている間はHIGH）,
            counterparty_jurisdiction（取引相手VASPの国）,
            counterparty_responsiveness（RESPONSIVE、UNRESPONSIVEまたはUNKNOWN）,
            subject_days_since_previous_transaction,
            tags、および取引作成時にcustom_propertiesで送信した任意のキーに対するcustom_values.<key>。国コードのフィールドはISO-2またはISO-3を受け付け、比較の前に両側ともISO-3に正規化されます。
        operator:
          type: string
          enum:
            - eq
            - ne
            - gt
            - gte
            - lt
            - lte
            - in
            - not_in
            - contains
            - not_contains
            - contains_any
            - regex
            - fuzzy_match
            - exists
            - is_not_empty
            - is_not_null
            - not_exists
            - is_empty
            - is_null
          description: >-
            比較演算子。in/not_inはメンバーシップを判定します(valueにはリストまたは単一のスカラー値を指定できます)。contains/not_containsは文字列値に対して大文字と小文字を区別しない部分文字列チェックを行います。contains_anyは文字列のリストを受け取り、いずれかがフィールド値の部分文字列(大文字と小文字を区別しない)である場合に一致します。regexはvalueのパターンをフィールドに照合します。fuzzy_matchはvalueの文字列と比較し、必要な`score`しきい値(0-100)を適用します。gt/gte/lt/lteは、どちらか一方が欠落している場合は一致しません。exists/is_not_empty/is_not_null(エイリアス)およびnot_exists/is_empty/is_null(エイリアス)は存在チェックであり、`value`を無視します。
        value:
          description: >-
            比較値。形式は演算子とvalue_typeによって異なります。存在チェックの演算子では省略してください。それ以外のすべての演算子では`null`や空のリストではない値が必要で、そうでない場合ルールは`400`で拒否されます。`contains_any`には文字列のリストが、`contains`、`not_contains`、`regex`には単一の文字列が必要です。
        value_type:
          type: string
          enum:
            - list
            - field
            - relative_date
          description: >-
            任意の値の解釈方法です。`list`：値はリストのUUIDで、リストのエントリーが比較値になります。`field`：値は別のフィールドパスで、フィールド同士で比較されます。`relative_date`：値は相対日付オブジェクトです（例：{"direction":
            "past", "unit": "days", "amount": 30}）。
        score:
          type: number
          minimum: 0
          maximum: 100
          description: operatorがfuzzy_matchの場合は必須：0〜100の類似度しきい値。
        group_index:
          type: integer
          description: >-
            任意のグループ化ロジックです。いずれかの条件にgroup_indexが含まれる場合、同じインデックスを持つ条件がグループを形成し、evaluation_modeの代わりにグループ単位の評価が行われます。
        group_logic:
          type: string
          enum:
            - AND
            - OR
          default: AND
          description: グループ「内」で条件をどのように組み合わせるかを指定します。
        groups_logic:
          type: string
          enum:
            - AND
            - OR
          default: OR
          description: グループ「間」で各グループの結果をどのように組み合わせるかを指定します。最初の条件から読み取られます。
      description: 条件は評価対象の取引のみを読み取ります。集計ウィンドウを絞り込むことはありません。
    TransactionRuleAggregation:
      type: object
      required:
        - value
      properties:
        metric:
          type: string
          enum:
            - count
            - sum
            - max
            - min
            - avg
            - distinct_count
          default: count
          description: 一致する過去の取引の集計方法。unique_countはdistinct_countの別名として受け付けられます。
        field:
          type: string
          default: amount
          description: sum/max/min/avg/distinct_countで集計するフィールド。countでは無視されます。
        operator:
          type: string
          enum:
            - eq
            - ne
            - gt
            - gte
            - lt
            - lte
          default: eq
          description: 算出された指標に適用される比較。
        value:
          type: number
          description: 算出された指標と比較されるしきい値。
        window:
          type: string
          pattern: ^\d+(m|h|d)$
          default: 1d
          description: >-
            取引のtxn_dateを終点とする遡及期間: <N>m（月ではなく分）、<N>h（時間）、または<N>d（日）。例:
            30m、24h、7d、30d。
        filters:
          type: object
          additionalProperties: true
          description: >-
            集計の対象となる過去の取引を絞り込みます。キーは条件フィールドカタログのフィールドパスです。値に"__current__"を指定すると、評価中の取引における同じフィールドの値に解決されます（例:
            {"subject_vendor_data":
            "__current__"}は期間を同一の対象者に限定します）。リスト値は、そのいずれかに含まれることを意味します。フィルターの比較は等価または包含のみです。lt/gteのフィルターはないため、「10,000未満の過去の取引」のような範囲はここでは表現できません。範囲はメトリクス側で指定してください（メトリクスmaxと演算子ltを組み合わせると、期間内のすべての取引がしきい値未満であることを条件にできます）。
      description: >-
        ウィンドウ内のアプリケーションの過去の取引に対するベロシティチェックです。evaluation_modeにかかわらず、ルールが一致するにはすべての集計エントリーが一致する必要があります。集計が制約するのはウィンドウのみです。評価対象の取引はscopeとconditionsによって制約されるため、ルールでdirection、currency、transaction_typeを保証する場合は、その両方に同じ条件を繰り返し指定してください。
    TransactionRuleAction:
      oneOf:
        - $ref: '#/components/schemas/TransactionRuleActionAddScore'
        - $ref: '#/components/schemas/TransactionRuleActionChangeStatus'
        - $ref: '#/components/schemas/TransactionRuleActionAddTags'
        - $ref: '#/components/schemas/TransactionRuleActionAddNote'
        - $ref: '#/components/schemas/TransactionRuleActionAddToList'
        - $ref: '#/components/schemas/TransactionRuleActionOpenCase'
      discriminator:
        propertyName: type
        mapping:
          add_score: '#/components/schemas/TransactionRuleActionAddScore'
          change_status: '#/components/schemas/TransactionRuleActionChangeStatus'
          add_tags: '#/components/schemas/TransactionRuleActionAddTags'
          add_note: '#/components/schemas/TransactionRuleActionAddNote'
          add_to_list: '#/components/schemas/TransactionRuleActionAddToList'
          open_case: '#/components/schemas/TransactionRuleActionOpenCase'
      description: >-
        ルールのアクション1件です。1つのルールに複数のアクションを設定でき、ルールに一致した場合はすべてが同時に適用されます。TESTモードのルールは、アクションを一切適用せずに、実行していたはずの内容を記録します。
    TransactionRuleActionAddScore:
      type: object
      required:
        - type
        - value
      properties:
        type:
          type: string
          enum:
            - add_score
        value:
          type: integer
          description: 取引のリスクスコアに加算されるポイント。負の値になる場合があります。
      description: 取引の累積リスクスコアにポイントを加算します。合計値に応じて、アプリケーションのレビュー/却下のしきい値に基づきステータスが決まります。
    TransactionRuleActionChangeStatus:
      type: object
      required:
        - type
        - value
      properties:
        type:
          type: string
          enum:
            - change_status
        value:
          type: string
          enum:
            - APPROVED
            - IN_REVIEW
            - DECLINED
            - AWAITING_USER
          description: 'スコアに関係なく、即時に設定するステータス。エイリアスキー: status。'
        workflow_id:
          type: string
          format: uuid
          description: >-
            値がAWAITING_USERの場合は必須です。対象者に完了を求める認証ワークフローです。エイリアスキー:
            remediation_workflow_id。ルールが発動すると、Diditは対象者向けにホスト型の是正セッションを作成します。
      description: 取引ステータスを直接設定します。一致した複数のルールの間では、常にDECLINEDが優先されます。
    TransactionRuleActionAddTags:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - add_tags
        tag_uuid:
          type: string
          format: uuid
          description: 付与する既存のアプリケーションタグです。
        tag_name:
          type: string
          description: 付与するタグ名。初回使用時に作成されます(大文字で保存)。tag_uuidまたはtag_nameのいずれかを指定してください。
        tag_color:
          type: string
          description: 'tag_nameで新しいタグを作成する際に使用する16進カラーコードです。例: #007AFE。'
      description: 一致した取引にアプリケーションタグを付けます。
    TransactionRuleActionAddNote:
      type: object
      required:
        - type
        - note
      properties:
        type:
          type: string
          enum:
            - add_note
        note:
          type: string
          description: '取引に添付されたメモのテキスト（作成者: Rule Engine）。エイリアスキー: value。'
      description: 一致した取引に自動アナリストメモを添付します。
    TransactionRuleActionAddToList:
      type: object
      required:
        - type
        - list_id
      properties:
        type:
          type: string
          enum:
            - add_to_list
        list_id:
          type: string
          format: uuid
          description: サブジェクトのvendor_dataを追加するリスト。
      description: 対象者のvendor_dataをブロックリスト、許可リスト、またはカスタムリストに追加します。
    TransactionRuleActionOpenCase:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - open_case
        blueprint:
          type: string
          format: uuid
          description: ケースブループリントのUUID。デフォルトはアプリケーションのデフォルトブループリントです。
        grouping:
          type: string
          enum:
            - by_applicant
            - by_rule_and_applicant
          description: 繰り返しの一致を申請者ごとに1つのケースにまとめるか、ルールと申請者の組み合わせごとに1つのケースにまとめるかです。
        attach_matched_transaction:
          type: boolean
          description: 一致した取引をケースに添付します。
      description: 調査ケースを開きます（または既存のケースに追加します）。1つのルールでは、最初のopen_caseアクションのみが適用されます。
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        お客様のアプリケーションのAPIキーです。Business ConsoleのDevelopers -> API
        keysで取得できます。プライマリキーはフルアクセス権を持ちます。名前付きキーにはスコープを設定できます。リソースごとのアクセス権（なし、読み取り、書き込み）、一部のワークフローまたは承認済みセッションへの限定、IPアドレスのリストへの限定、有効期限の設定です。401は、キーが誤っている、失効している、または期限切れであることを意味します。403は、キーが送信されていない、キーにこのリソースやアクションへのアクセス権がない、またはIPリスト外のアドレスからリクエストが送信されたことを意味します。セッションのルートでの404は、セッションがキーのワークフローまたはステータスの対象外であることを意味します。メディアへのアクセス権がないキーでは、画像、動画、PDFのURLがnullで返されます。セッションの書き込み権限がないキーでは、セッションのリンクとトークンがnullで返されます。詳細は次を参照してください:
        https://docs.didit.me/console/api-keys

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.