> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Экспорт истории AML-скрининга в CSV через API

> Скачайте историю постоянного AML-мониторинга сессии в CSV: одна строка на каждый завершённый повторный скрининг. Удобно передать аудитору. Didit.

Промпт API: экспорт истории AML-скрининга
Скопировать промпт в буфер обмена

<pre>
  \`Download the ongoing AML monitoring history of one Didit verification session as a CSV file through the API.

  Endpoint:
  GET [https://verification.didit.me/v3/session/\{session\_id}/aml-screening-history/export/](https://verification.didit.me/v3/session/\{session_id}/aml-screening-history/export/)

  Authentication:
  Send my Didit API key in the x-api-key header. A scoped key needs decisions: read and media: read (the response is a file; without media: read the call returns 403).

  Goal:

  * Produce the audit evidence that ongoing AML monitoring ran for a subject, as a file a compliance team can hand to an auditor.

  Query parameters:

  * node\_id (optional): the workflow node ID of the AML check when the session ran several AML steps. Without it, the most recent AML check is used.

  Behavior:

  * Works for user (KYC) and business (KYB) session IDs.
  * Streams text/csv with Content-Disposition: attachment; filename="aml-screening-history-SESSION\_ID.csv". Not paginated: the file holds the whole history, newest first.
  * The first line is the header. Each following line is one completed re-screen.
  * Columns: screened\_at, outcome, provider, aml\_status, aml\_score, total\_hits, datasets\_captured\_at, datasets\_sanctions\_last\_updated\_at, datasets\_pep\_last\_updated\_at, datasets\_warnings\_last\_updated\_at, datasets\_adverse\_media\_last\_updated\_at, datasets\_catalog\_version.
  * Empty cell = unknown. Dataset dates are never estimated.
  * provider is an identifier of the data source; treat it as an opaque string.
  * Values that would start a spreadsheet formula (=, +, -, @) are prefixed with an apostrophe.
  * Errors come back as JSON, not CSV.

  Example call:
  curl -X GET "[https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/aml-screening-history/export/](https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/aml-screening-history/export/)" \
  -H "x-api-key: YOUR\_API\_KEY" \
  -o aml-screening-history.csv

  Failure modes:

  * 401: the API key has expired.
  * 403: missing key (a wrong, revoked or expired key gets 401), a key of another application, a scoped key without decisions: read or media: read, or a request from outside the key's IP allowlist.
  * 404: the session does not exist, was deleted, or is outside a scoped key's limits, or it has no AML check (for that node\_id).

  Side effects: none. This is a pure read.

  For the full integration shape, see /integration/integration-prompt.\`
</pre>

Вставьте в

Файл содержит те же проверки, что и [Список истории AML-скрининга](https://docs.didit.me/ru/management-api/sessions/aml-screening-history.md), но каждая проверка выводится в одну строку, с датой обновления набора данных каждого семейства списков (санкции, PEP, предупреждения и негативные публикации в СМИ), если такая дата указана. Та же выгрузка доступна в Business Console рядом с результатом AML. Подробнее о том, что означает каждое значение, см. в разделе [Постоянный AML-мониторинг](https://docs.didit.me/ru/core-technology/aml-screening/continuous-monitoring-aml-screening.md).


## OpenAPI

````yaml ru/openapi-25.json GET /v3/session/{sessionId}/aml-screening-history/export/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: >-
    API верификации личности. Аутентификация выполняется с помощью заголовка
    x-api-key.
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/session/{sessionId}/aml-screening-history/export/:
    get:
      tags:
        - Sessions
      summary: Экспорт истории AML-скрининга в формате CSV
      description: >-
        Скачать ту же историю постоянного мониторинга, что и при `GET
        /v3/session/{sessionId}/aml-screening-history/`, в виде CSV-файла: по
        одной строке на каждую завершённую повторную проверку, сначала новые,
        готовые для передачи аудитору. Файл передаётся целиком в потоковом
        режиме (без пагинации) и начинается со строки заголовка; пустая ячейка
        означает неизвестное значение, даты наборов данных никогда не
        оцениваются приблизительно, а перед значением, которое может начать
        формулу таблицы, ставится апостроф. Работает для ID сессий KYC и KYB;
        передайте `node_id`, если в сессии выполнялось более одного шага AML.
        Передайте `month` для экспорта за один календарный месяц. Ошибки
        возвращаются в формате JSON, а не CSV. Для API-ключа с ограниченными
        правами требуются `decisions: read` и `media: read`: ответ представляет
        собой файл, поэтому ключ без `media: read` получит `403`.
      operationId: get_v3_session_aml_screening_history_export
      parameters:
        - name: sessionId
          in: path
          required: true
          description: >-
            UUID сессии верификации (`session_id`, возвращённый `POST
            /v3/session/`). Принимает ID сессий как Проверки пользователей
            (KYC), так и Верификации бизнеса (KYB): сервер сопоставляет ID для
            обоих типов сессий. Должен быть корректным UUID; некорректное
            значение не соответствует маршруту и возвращает HTML `404`.
          schema:
            type: string
            format: uuid
            example: 11111111-2222-3333-4444-555555555555
        - name: node_id
          in: query
          required: false
          description: >-
            ID узла графа сценария для AML-проверки. Требуется, только если в
            сессии выполнялось более одного AML-шага; без него используется
            последняя по времени AML-проверка. Неизвестный узел возвращает
            `404`.
          schema:
            type: string
            example: feature_aml_1
        - name: month
          in: query
          required: false
          description: >-
            Календарный месяц в UTC в формате `YYYY-MM`. Возвращаются только
            проверки, завершённые в этом месяце; если параметр не указан,
            возвращаются все месяцы. Некорректный формат месяца возвращает
            `400`.
          schema:
            type: string
            pattern: ^\d{4}-(0[1-9]|1[0-2])$
            example: 2026-09
      responses:
        '200':
          description: >-
            CSV-файл, передаваемый как `text/csv` с окончаниями строк CRLF.
            Столбцы по порядку: `screened_at` (когда завершился повторный
            скрининг), `outcome` (`NO_CHANGE`, `CHANGED` или `FAILED`),
            `provider` (непрозрачный идентификатор источника AML-данных; не
            стройте логику ветвления на его основе), `aml_status`, `aml_score`,
            `total_hits`, `datasets_captured_at`,
            `datasets_sanctions_last_updated_at`,
            `datasets_pep_last_updated_at`, `datasets_warnings_last_updated_at`,
            `datasets_adverse_media_last_updated_at`,
            `datasets_catalog_version`, `run_id` (запуск мониторинга),
            `entities_screened` (`1` или `0` для неуспешного запуска) и
            `new_hits` (пусто, если неизвестно). Даты указаны в формате ISO 8601
            со смещением UTC. Сессия без повторных скринингов возвращает только
            строку заголовка.
          headers:
            Content-Disposition:
              description: >-
                `attachment; filename="aml-screening-history-{sessionId}.csv"`
                или `aml-screening-history-{sessionId}-{month}.csv`, если
                передан параметр `month`.
              schema:
                type: string
                example: >-
                  attachment;
                  filename="aml-screening-history-11111111-2222-3333-4444-555555555555.csv"
          content:
            text/csv:
              schema:
                type: string
                format: binary
              example: "screened_at,outcome,provider,aml_status,aml_score,total_hits,datasets_captured_at,datasets_sanctions_last_updated_at,datasets_pep_last_updated_at,datasets_warnings_last_updated_at,datasets_adverse_media_last_updated_at,datasets_catalog_version,run_id,entities_screened,new_hits\r\n2026-09-14T04:12:33.481207+00:00,NO_CHANGE,aml_data_source,Approved,0.0,0,2026-09-14T03:58:02.114820+00:00,2026-09-13T21:10:00+00:00,2026-09-13T08:00:00+00:00,2026-09-12T18:45:00+00:00,,2026-09-13,aaaaaaaa-1111-2222-3333-444444444444,1,0\r\n2026-09-13T04:11:58.020914+00:00,FAILED,aml_data_source,Approved,0.0,0,,,,,,,bbbbbbbb-1111-2222-3333-444444444444,0,\r\n"
        '400':
          description: '`month` не является календарным месяцем в формате `YYYY-MM`.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  month:
                    type: array
                    items:
                      type: string
              examples:
                Malformed month:
                  summary: month=2026-13
                  value:
                    month:
                      - Not a calendar month. Use YYYY-MM.
        '401':
          description: >-
            Срок действия API-ключа с ограниченной областью действия истёк. Это
            единственный случай, возвращающий `401`: отсутствующий,
            недействительный или отозванный ключ возвращает `403`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Понятное сообщение об ошибке.
              examples:
                Expired key:
                  summary: Срок действия ключа истёк
                  value:
                    detail: This API key has expired.
        '403':
          description: >-
            Ошибка аутентификации или авторизации. Отсутствующий ключ возвращает
            `403`, как и ключ другого приложения, ключ с ограниченной областью
            действия без необходимого для этого endpoint разрешения, а также
            запрос не из разрешённого списка IP-адресов ключа; неверный,
            отозванный или истекший ключ возвращает `401`. Различайте их по полю
            `detail`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Понятное сообщение об ошибке.
              examples:
                Missing or invalid credentials:
                  summary: >-
                    Заголовок x-api-key отсутствует, либо ключ не прошёл
                    валидацию
                  value:
                    detail: >-
                      Authentication credentials were not provided or are
                      invalid.
                Other application:
                  summary: >-
                    Действительный ключ, принадлежащий приложению, отличному от
                    приложения сессии
                  value:
                    detail: You do not have permission to perform this action.
                Scoped key without decisions read:
                  summary: >-
                    У ключа с ограниченной областью действия отсутствует
                    разрешение decisions: read
                  value:
                    detail: This API key has no read access to decisions.
                Scoped key without media read:
                  summary: >-
                    У ключа с ограниченной областью действия отсутствует
                    разрешение media: read (ответ представляет собой файл)
                  value:
                    detail: This API key has no read access to media.
                IP not allowed:
                  summary: Запрос с IP-адреса вне списка разрешённых IP ключа
                  value:
                    detail: This API key can't be used from this IP address.
        '404':
          description: >-
            Сессия не существует, была удалена или находится за пределами
            ограничений ключа с ограниченным доступом, либо не содержит
            AML-проверки (для указанного `node_id`). Поиск сессии выполняется до
            проверки учетных данных, поэтому неизвестный `sessionId` возвращает
            `404` даже без действительного ключа.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Понятное сообщение об ошибке.
              examples:
                Unknown session:
                  summary: Сессия с этим ID не существует или была удалена
                  value:
                    detail: Not found.
                Outside key limits:
                  summary: >-
                    Сессия находится за пределами ограничений ключа с
                    ограниченным доступом (также возвращается для сессии,
                    удаленной только что)
                  value:
                    detail: Session not found.
                No AML check:
                  summary: В сессии никогда не выполнялся шаг AML
                  value:
                    detail: The session does not have an AML check.
                No AML check for node:
                  summary: node_id не соответствует AML-проверке этой сессии
                  value:
                    detail: >-
                      The session does not have an AML check for node
                      'feature_aml_2'.
        '429':
          description: >-
            Лимит запросов превышен: 600 GET-запросов в минуту на один API-ключ.
            Подождите `Retry-After` секунд перед повторной попыткой; заголовки
            `X-RateLimit-*` показывают доступный лимит.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Понятное сообщение об ошибке.
              examples:
                Rate limited:
                  summary: Бюджет на текущую минуту исчерпан
                  value:
                    detail: >-
                      GET request rate limit exceeded. You can make up to 600
                      requests per minute.
          headers:
            Retry-After:
              description: Количество секунд ожидания перед повторной попыткой.
              schema:
                type: integer
                minimum: 1
                example: 30
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X GET
            'https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/aml-screening-history/export/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -o aml-screening-history.csv
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            content = client.sessions.export_aml_screening_history(
                "11111111-2222-3333-4444-555555555555",
            )
            with open("download.csv", "wb") as file:
                file.write(content)
        - lang: javascript
          label: Node.js
          source: >-
            import { writeFile } from "node:fs/promises";

            import Didit from "@didit-protocol/sdk-node";


            // Reads DIDIT_API_KEY.

            const didit = new Didit();


            const content = await
            didit.sessions.exportAmlScreeningHistory("11111111-2222-3333-4444-555555555555");

            await writeFile("download.csv", Buffer.from(await
            content.arrayBuffer()));
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresp, err := client.Sessions.ExportAMLScreeningHistory(ctx, \"11111111-2222-3333-4444-555555555555\", didit.SessionsExportAMLScreeningHistoryParams{})\nif err != nil {\n\tlog.Fatal(err)\n}\ndefer resp.Body.Close()\nfile, err := os.Create(\"download.csv\")\nif err != nil {\n\tlog.Fatal(err)\n}\ndefer file.Close()\nif _, err := io.Copy(file, resp.Body); err != nil {\n\tlog.Fatal(err)\n}"
        - lang: java
          label: Java
          source: >-
            import java.nio.file.Path;

            import me.didit.Didit;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            client.sessions().exportAmlScreeningHistory("11111111-2222-3333-4444-555555555555")
                    .writeTo(Path.of("download.csv"));
        - lang: php
          label: PHP
          source: >-
            <?php


            require 'vendor/autoload.php';


            use Didit\DiditClient;


            // Reads DIDIT_API_KEY.

            $didit = new DiditClient();


            $content =
            $didit->sessions->exportAmlScreeningHistory('11111111-2222-3333-4444-555555555555');

            $content->saveTo('download.csv');
        - lang: ruby
          label: Ruby
          source: >-
            require "didit"


            # Reads DIDIT_API_KEY.

            didit = Didit::Client.new


            content =
            didit.sessions.export_aml_screening_history("11111111-2222-3333-4444-555555555555")

            File.binwrite("download.csv", content)
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            var content = await
            client.Sessions.ExportAmlScreeningHistoryAsync("11111111-2222-3333-4444-555555555555");

            await content.SaveToAsync("download.csv");
components:
  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.