> ## 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 в приложение через API: по отдельному ключу из библиотеки или сразу пакетом. Работает в Didit.



Промпт для API установки правил библиотеки
        Скопировать промпт в буфер обмена



      
      

\<pre>

\`Install preset rules from the Didit library onto my application.

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

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

Request body (application/json) - provide at least one selector:
\{ "library_keys": ["structuring-inbound", "structuring-outbound"] }
\{ "bundle": "responsible_gaming" }
\{ "library_keys": ["structuring-inbound"], "bundle": "aml_ctf" }

Response:
\{ "installed_library_keys": ["structuring-inbound", "structuring-outbound"], "installed_count": 2 }

Behavior:
\- Installed presets evaluate immediately - in ACTIVE mode when transaction monitoring is enabled on the application, DISABLED otherwise. Tune them afterwards with PATCH (mode only).
\- You may send both selectors. When you do, only the requested library keys that belong to the bundle are installed.
\- Already-installed keys are skipped, so the call is safe to repeat.
\- Discover keys and bundles via GET /v3/transactions/rules/library/.

Failure modes:
\- 400 - neither library_keys nor bundle provided, or library_keys is not a list.`

\</pre>



      
      

Вставьте в



## OpenAPI

````yaml ru/openapi-25.json POST /v3/transactions/rules/install/
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/install/:
    post:
      tags:
        - Transactions
      summary: Установить правила из библиотеки
      description: >-
        Установите один или несколько пресетов в приложение по `library_keys`
        или целым `bundle`. Установленный пресет становится активным сразу, если
        мониторинг транзакций включён, и отключён в противном случае; уже
        установленные ключи пропускаются. Библиотечное правило, условия которого
        считывают данные, которые движок правил ещё не может оценить,
        откладывается до тех пор, пока оно не сможет выполняться. Запрос с
        указанием такого ключа в `library_keys` возвращает 400 и ничего не
        устанавливает («These library rules cannot run yet: their conditions
        read data the rules engine cannot evaluate.» с перечислением ключей), а
        установка `bundle` пропускает его. Отложенное правило восстанавливается
        автоматически, как только его условия можно будет оценить. Запись в
        `library_keys`, отсутствующая в библиотеке, пропускается, а не
        отклоняется.
      operationId: installTransactionRuleLibrary
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionRuleInstallRequest'
            example:
              library_keys:
                - structuring-inbound
                - structuring-outbound
      responses:
        '200':
          description: Что было установлено.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionRuleInstallResult'
              example:
                installed_library_keys:
                  - structuring-inbound
                  - structuring-outbound
                installed_count: 2
        '400':
          description: >-
            Не указаны ни library_keys, ни bundle, `library_keys` не является
            списком или элемент `library_keys` скрыт. Неизвестный элемент
            пропускается, и возвращается ответ 200 без него.
          content:
            application/json:
              schema:
                type: object
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X POST
            'https://verification.didit.me/v3/transactions/rules/install/' \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"library_keys": ["structuring-inbound", "structuring-outbound"]}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.transactions.rules.install_library(
                library_keys=["structuring-inbound", "structuring-outbound"],
            )
            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.installLibrary({
              library_keys: ["structuring-inbound", "structuring-outbound"],
            });
            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.InstallLibrary(ctx, didit.TransactionRuleInstallRequest{\n\tLibraryKeys: didit.Some([]string{\"structuring-inbound\", \"structuring-outbound\"}),\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.TransactionRuleInstallRequest;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.transactions().rules().installLibrary(TransactionRuleInstallRequest.builder()
                    .libraryKeys(List.of("structuring-inbound", "structuring-outbound"))
                    .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->installLibrary([
                'library_keys' => ['structuring-inbound', 'structuring-outbound'],
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: >-
            require "didit"


            # Reads DIDIT_API_KEY.

            didit = Didit::Client.new


            result = didit.transactions.rules.install_library(library_keys:
            ["structuring-inbound", "structuring-outbound"])

            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.Rules.InstallLibraryAsync(new
            TransactionRuleInstallRequest

            {
                LibraryKeys = new string[] { "structuring-inbound", "structuring-outbound" },
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    TransactionRuleInstallRequest:
      type: object
      properties:
        library_keys:
          type: array
          items:
            type: string
          description: Конкретные пресеты для установки или удаления.
        bundle:
          type: string
          description: Вместо этого установить или удалить все пресеты из этого набора.
      description: Укажите library_keys ИЛИ bundle.
    TransactionRuleInstallResult:
      type: object
      properties:
        installed_library_keys:
          type: array
          items:
            type: string
          description: 'Только POST (установка): пресеты, установленные этим вызовом.'
        installed_count:
          type: integer
          description: Только POST (установка).
        uninstalled_count:
          type: integer
          description: 'Только для DELETE (удаление): пресеты, удалённые этим вызовом.'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API-ключ вашего приложения из раздела «Разработчикам» -> «API-ключи» в
        Business Console. Основной ключ имеет полный доступ. Именованный ключ
        может иметь ограниченную область действия: без доступа, чтение или
        запись для каждого ресурса, ограничение определенными сценариями или
        одобренными сессиями, списком IP-адресов и сроком действия. 401
        означает, что ключ неверен, отозван или его срок действия истек; 403
        означает, что ключ не был передан, у ключа нет доступа к этому ресурсу
        или действию, либо запрос поступил с адреса вне его списка IP-адресов;
        404 на маршруте сессии означает, что сессия не входит в сценарии или
        статусы ключа. Ключ без доступа к медиа получает URL изображений, видео
        и PDF как null, а ключ без прав на запись сессий получает ссылки на
        сессии и токены как null. См. https://docs.didit.me/console/api-keys.

````

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