> ## 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.

# ユーザー履歴PDF API：ユーザーの全セッション

> Diditのユーザー履歴PDF APIでは、vendor_dataで特定したユーザーのレポート対象となる全認証セッションを1つのPDFにまとめてダウンロードできます。監査、SAR、定期的なコンプライアンスエクスポートに利用できます。



ユーザー履歴PDFのプロンプト
        プロンプトをクリップボードにコピー



      
      

\<pre>

\`Goal: download one audit-ready PDF containing the full verification history of a Didit user.

Endpoint: GET https://verification.didit.me/v3/users/{vendor_data}/generate-pdf/
Auth header: x-api-key: YOUR_API_KEY

Path param:
\- vendor_data (string, REQUIRED) - your own identifier for the user, the same value you pass when creating sessions. Free-form string, NOT a UUID. URL-encode it; it cannot contain "/".

curl - save the PDF to disk:
curl --fail 'https://verification.didit.me/v3/users/user-abc-123/generate-pdf/' \
-H 'x-api-key: YOUR_API_KEY' \
\--output user-history.pdf

Response:
\- Body is binary (application/pdf). DO NOT parse as JSON.
\- Content-Disposition: attachment; filename=user_{didit_internal_id}.pdf
\- Content: a cover page (profile summary, feature status, session index) followed by the standard report of every included session, oldest first. Each session report is the same document GET /v3/session/{session_id}/generate-pdf/ returns.
\- Only sessions in "Approved", "Declined", "In Review" or "Kyc Expired" are included, capped at the 20 most recent. The cover states when older sessions were left out.
\- Identical to the Console export at User detail → Actions → Download PDF. White-label logo and privacy-policy URL apply when enabled.
\- Rendering is synchronous and takes a few seconds per session: use a read timeout of at least 120s and stream the body to disk.

Failure modes (envelope {"detail": "..."}):
\- 401 - no credentials supplied.
\- 403 - missing API key (a wrong, revoked or expired key gets 401), a Console user token instead of an API key, OR the user exists but has no session in a reportable status ("This user has no sessions in review, declined, approved or kyc expired to report.").
\- 404 - {"detail": "User not found."} - no user with that vendor_data in the application behind the API key. A key can never export a user of another application.
\- 429 - shares the PDF rate limit with the per-session endpoint (50 requests per minute per credential). Wait Retry-After seconds.

Trailing slash: the canonical route ends with "/". Call it as written above.

When to call:
\- Periodic compliance exports of a customer's whole KYC history.
\- SAR / regulator attachments that must cover every verification of one person.
\- Pulling a user's history into your own back office without a Console login.

Related: GET /v3/session/{session_id}/generate-pdf/ for a single session; GET /v3/sessions/?vendor_data=... for the JSON list of sessions.

For end-to-end Didit integration, paste in the full prompt at /integration/integration-prompt.`

\</pre>



      
      

貼り付け先

## 概要`vendor_data`をキーとして、[ユーザーエンティティ](https://docs.didit.me/ja/entities/users/overview.md)の検証履歴全体を1つのPDFにまとめて返します。
Consoleの**User detail → Actions → Download PDF**で生成されるものと同じ書類です。コンプライアンスチームはユーザーごとにクリックする代わりに、エクスポートを自動化できます。レポートには次の内容が含まれます。- **表紙**：プロフィールの概要(氏名、生年月日、発行州、承認済みのメールアドレスと電話番号)、各機能の最新ステータス、セッション数、収録セッションの索引。
- **収録セッションごとの完全なセッションレポート**：時系列順(古い順)に並びます。各レポートは、そのセッション単体に対して[PDFを生成](https://docs.didit.me/ja/sessions-api/generate-pdf.md)が返すレポートと同じです。## 対象となるセッションと上限収録されるのは、ステータスが`Approved`、`Declined`、`In Review`、`Kyc Expired`のユーザー認証(KYC)セッションのみです。その他のステータス(`Not Started`、`In Progress`、`Abandoned`、`Expired`など)のセッションは除外されます。レポートに含められるのは、レポート対象セッションのうち**新しい順に20件**までです。ユーザーにそれ以上のセッションがある場合は最新の20件が収録され、除外された古いセッションの件数が表紙に記載されます。完全な一覧をJSONで取得する必要がある場合は、`vendor_data`でフィルターした[セッション一覧の取得](https://docs.didit.me/ja/sessions-api/list-sessions.md)を使用してください。## レスポンス本文はPDFそのもの(`application/pdf`)であり、JSONのラッパーやダウンロードURLではありません。`Content-Disposition`ヘッダーは`attachment; filename=user_<didit_internal_id>.pdf`で、`didit_internal_id`はユーザーごとに固定のDidit識別子です。## ホワイトラベルアプリケーションでホワイトラベルのカスタマイズが有効になっている場合、表紙と各セッションレポートには、Diditのブランディングの代わりに貴社のロゴとプライバシーポリシーのURLが表示されます。これはセッション単位のエンドポイントとまったく同じです。設定は**Console → Customization**で行います。## キャッシュとレイテンシキャッシュは一切行われません。呼び出しのたびに現在のデータからレポートが再生成されるため、手動レビューの後にリクエストしたレポートにはレビュアーの判定が反映されます。2回の呼び出しでバイト単位で異なるファイルが生成されることがあるため、変更不可のコピーが必要な場合はダウンロードしたファイルをアーカイブしてください。生成は同期的に行われ、収録される各セッションに保存されたすべての画像をダウンロードするため、メディアの多いセッションを多数持つユーザーでは数十秒かかることがあります。クライアントの読み取りタイムアウトには十分な余裕を持たせ(120秒を推奨)、レスポンス本文はストリーミングでディスクに書き込んでください。生成はクライアント側のタイムアウトまで実行され続けるのではなく、サーバー側の時間予算に達した時点で停止します。その予算に達した場合でも、レポートは最新のセッションを含む有効なPDFとして返され、省略されたセッションの件数が表紙に記載されます。## 末尾のスラッシュ正規のルートは末尾がスラッシュで終わります(`…/generate-pdf/`)。スラッシュのないリクエストもそのまま処理され、同じレスポンスが返されます。`301`リダイレクトは発生しないため、クライアントがリダイレクトを追従する必要はなく、`curl`に`-L`も不要です。サンプルと同様にスラッシュ付きのURLを使用してください。OpenAPI仕様やログに表示されるのもこの形式です。## エラー| ステータス | 発生条件 | `detail` |
| - | - | - |
| `401` | `x-api-key`ヘッダーがない(`Authorization: Bearer`トークンもない)。 | `You must be authenticated with a valid access token to access this endpoint.` |
| `403` | APIキーが無効または取り消されている、またはAPIキーの代わりにConsoleのユーザートークンが使われている。 | `You do not have permission to perform this action.` |
| `403` | ユーザーは存在するが、レポート対象のステータスにあるセッションが1件もない。 | `This user has no sessions in review, declined, approved or kyc expired to report.` |
| `404` | APIキーに紐づくアプリケーションに、この`vendor_data`を持つユーザーが存在しない(別のアプリケーションに属するユーザーを含む)。 | `User not found.` |
| `429` | 同じ認証情報から1分あたり50回を超えるPDF生成が行われた。この上限は[PDFを生成](https://docs.didit.me/ja/sessions-api/generate-pdf.md)と共有されます。`Retry-After`秒待機してください。 | `Session PDF generation rate limit exceeded. You can make up to 50 requests per minute.` |## 例> [tab] curl
>
> ```bash theme={null}
> curl --fail 'https://verification.didit.me/v3/users/user-abc-123/generate-pdf/' \
>   -H 'x-api-key: YOUR_API_KEY' \
>   --output user-history.pdf
> ```> [tab] Python
>
> ```python theme={null}
> import requests
>
> response = requests.get(
>     "https://verification.didit.me/v3/users/user-abc-123/generate-pdf/",
>     headers={"x-api-key": "YOUR_API_KEY"},
>     stream=True,
>     timeout=120,
> )
> response.raise_for_status()
> with open("user-history.pdf", "wb") as fh:
>     for chunk in response.iter_content(chunk_size=8192):
>         fh.write(chunk)
> ```> [tab] JavaScript
>
> ```javascript theme={null}
> import { writeFile } from 'node:fs/promises';
>
> const vendorData = encodeURIComponent('user-abc-123');
> const response = await fetch(
>   `https://verification.didit.me/v3/users/${vendorData}/generate-pdf/`,
>   { headers: { 'x-api-key': process.env.DIDIT_API_KEY } },
> );
> if (!response.ok) throw new Error(`PDF generation failed: HTTP ${response.status}`);
> await writeFile('user-history.pdf', Buffer.from(await response.arrayBuffer()));
> ```## 権限アプリケーションの有効なAPIキーであれば、どれでもこのエンドポイントを呼び出せます。DiditのAPIキーは
**役割単位ではなくアプリケーション単位**です。Consoleの[役割と権限](https://docs.didit.me/ja/console/roles-permissions.md)
(`read:users`など)は*人*がConsoleで行える操作を決めるものであり、Management APIのトラフィックに対しては
評価されません。キーがエクスポートできるのは、そのキーに紐づくアプリケーションのユーザーのみです。## 関連情報- [PDFを生成](https://docs.didit.me/ja/sessions-api/generate-pdf.md)：単一セッションを対象とした同じレポート
- [ユーザーのKYC履歴](https://docs.didit.me/ja/entities/users/kyc-history.md)：ユーザーのセッションをJSONで一覧・確認する
- [PDFとCSVのエクスポート](https://docs.didit.me/ja/console/export-pdf-csv.md)：両方のエクスポートをConsoleで行う方法
- [ユーザーの取得](https://docs.didit.me/ja/management-api/users/get.md)：ユーザーのプロフィールと機能マップをJSONで取得する


## OpenAPI

````yaml ja/openapi-25.json GET /v3/users/{vendor_data}/generate-pdf/
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/users/{vendor_data}/generate-pdf/:
    get:
      tags:
        - Users
      summary: ユーザー履歴全体のPDFレポートをダウンロード
      description: >-
        `vendor_data`で識別されるユーザーの検証履歴全体を含む、コンプライアンス対応のPDFを1つ生成してダウンロードします。これはConsoleの**User
        detail → Actions → Download
        PDF**から作成されるものと同じ書類です。そのため、定期的なコンプライアンス用エクスポートのために担当者がConsoleで操作する必要はなくなります。


        **レポートの内容。**
        表紙には、プロフィール概要（氏名、生年月日、発行国、承認済みのメールアドレスと電話番号）、各機能の最新ステータス、セッション数、含まれるセッションの索引が記載されます。その後に、含まれる各セッションの標準レポートが時系列順（古い順）で続きます。各セッションレポートは、そのセッションに対して`GET
        /v3/session/{sessionId}/generate-pdf/`が返す書類と同じです。


        **対象となるセッション。** ユーザー認証（KYC）セッションのうち、ステータスが`Approved`、`Declined`、`In
        Review`、`Kyc
        Expired`のもののみが含まれ、その他のステータスのセッションはスキップされます。これらのステータスのセッションがユーザーに1件もない場合、エンドポイントは`403`を返します（後述）。


        **上限。**
        レポートに含まれるのは、レポート対象となるセッションのうち**最新の20件**までです。ユーザーのセッションがそれより多い場合は最新の20件が含まれ、除外された古いセッションの件数が表紙に記載されます。完全な一覧をJSONで取得するには`GET
        /v3/sessions/?vendor_data=…`を使用してください。


        **ブランディング。**
        アプリケーションにホワイトラベルのカスタマイズが設定されている場合、表紙と各セッションレポートはお客様のロゴとプライバシーポリシーのURLを使って生成されます。設定されていない場合はDiditのブランディングになります。レポートは英語で生成され、言語パラメーターはありません。


        **キャッシュなし。**
        呼び出しのたびに現在のデータからPDFが再生成されるため、手動レビュー後に生成したレポートにはレビュアーの判定が反映されます。同じユーザーに対する2回の呼び出しで、バイト単位で異なるファイルが生成されることがあります。変更されないコピーが必要な場合は、ダウンロードしたファイルを保管してください。


        **レイテンシ。**
        生成は同期的に行われ、含まれる各セッションに保存されたすべての画像をダウンロードします。そのため、メディアの多いセッションを多数持つユーザーでは数十秒かかることがあります。クライアントの読み取りタイムアウトには十分な値（推奨は120秒）を設定し、ボディはディスクにストリーミングしてください。生成はクライアントが待機をやめるまで続くのではなく、サーバー側の時間制限に達した時点で停止します。この制限に達した場合でも、レスポンスは最新のセッションを含む有効なPDFであり、省略されたセッションの件数が表紙に記載されます。


        **スコープ。**
        ユーザーは、APIキーを所有するアプリケーション内で特定されます。キーで別のアプリケーションのユーザーをエクスポートすることは決してできません。そのようなユーザーはそのキーからは存在しないものとして扱われ、エンドポイントは`404`を返します。


        **末尾のスラッシュ。**
        正規のルートは末尾がスラッシュで終わります（`…/generate-pdf/`）。スラッシュなしのリクエストにも、そのまま同じレスポンスが返されます。`301`リダイレクトは発生しないため、クライアントがリダイレクトを追跡する必要はなく、`curl`に`-L`を付ける必要もありません。サンプルのとおり、スラッシュ付きのURLを使用してください。
      operationId: get_user_generate_pdf
      parameters:
        - name: vendor_data
          in: path
          required: true
          schema:
            type: string
          description: >-
            ユーザーに対するお客様独自の識別子です。自由形式の文字列（UUIDではありません）です。ユーザーのセッション作成時に`vendor_data`として渡した値と同じで、送信されたとおりに完全一致で照合されます。URLエンコードしてください。`/`を含む値はこのルートでは指定できません。
          example: user-abc-123
      responses:
        '200':
          description: >-
            レンダリングされたPDF書類。バイナリの`application/pdf`として直接返されます。JSONラッパーやダウンロードURLを介した間接参照はありません。本文は`%PDF`のマジックバイトで始まります。`.pdf`ファイルに保存するか、呼び出し元にそのままストリーミングしてください。
          headers:
            Content-Disposition:
              description: >-
                `attachment;
                filename=user_{didit_internal_id}.pdf`。ファイル名は`vendor_data`ではなく、ユーザーの不変のDidit識別子（`GET
                /v3/users/{vendor_data}/`の`didit_internal_id`）に基づきます。
              schema:
                type: string
                example: >-
                  attachment;
                  filename=user_f4e5e1f2-94a9-4f86-8c16-2b7d9b4db418.pdf
            Content-Length:
              description: PDFの合計サイズ（バイト単位）。ボディはチャンク分割されません。
              schema:
                type: integer
                example: 148213
          content:
            application/pdf:
              schema:
                type: string
                format: binary
        '401':
          description: >-
            認証情報が指定されていません。`x-api-key`ヘッダー（または`Authorization:
            Bearer`トークン）なしの`/v3/users/*`パスへのリクエストは、APIに到達する前に認証ミドルウェアによって拒否されます。
          content:
            application/json:
              examples:
                Missing credentials:
                  value:
                    detail: >-
                      You must be authenticated with a valid access token to
                      access this endpoint.
        '403':
          description: >-
            認可エラーまたは対象外エラーです。両者は`detail`文字列で区別します。


            - `"You do not have permission to perform this
            action."`：APIキーが無効または失効しているか、リクエストにアプリケーションのAPIキーではなくConsoleユーザートークンが含まれています。

            - `"This user has no sessions in review, declined, approved or kyc
            expired to
            report."`：ユーザーはアプリケーションに存在しますが、レポート可能なステータスのセッションがまだありません（例：すべてのセッションがまだ`In
            Progress`である、またはユーザーが`POST
            /v3/users/create/`で作成され、一度も認証を行っていない）。レポートをリクエストする前に`status.updated`のWebhookを待ってください。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: >-
                      This user has no sessions in review, declined, approved or
                      kyc expired to report.
              examples:
                Invalid credentials:
                  summary: 取り消し済みまたは無効なAPIキー、あるいはConsoleのユーザートークン
                  value:
                    detail: You do not have permission to perform this action.
                No reportable sessions:
                  summary: ユーザーは存在しますが、承認済み、却下、レビュー中、KYC期限切れのいずれのセッションもありません
                  value:
                    detail: >-
                      This user has no sessions in review, declined, approved or
                      kyc expired to report.
        '404':
          description: >-
            指定された`vendor_data`のユーザーが、APIキーに紐づくアプリケーションに存在しません。他のアプリケーションのユーザーはこのキーからは参照できず、同じ`404`が返されます。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: User not found.
              examples:
                Unknown user:
                  summary: vendor_dataがこのアプリケーションのどのユーザーとも一致しません
                  value:
                    detail: User not found.
        '429':
          description: >-
            レート制限を超過しました。PDF生成には、GET全体に適用される1分あたり600件の制限に加えて、このエンドポイントと`GET
            /v3/session/{sessionId}/generate-pdf/`で共有される**認証情報ごとに1分あたり50件**（APIキー、Bearerトークン、または未認証の場合は送信元IP）という専用の制限があります。`Retry-After`秒（`X-RateLimit-*`ヘッダーにも反映されます）待ってから再試行してください。レポートはサーバー側でキャッシュされないため、各レポートは1回だけダウンロードしてファイルを保存し、再取得しないでください。
          headers:
            Retry-After:
              description: リクエストを再試行するまでに待機する秒数。
              schema:
                type: integer
                minimum: 1
                example: 30
            X-RateLimit-Limit:
              description: 現在のウィンドウで許可されるPDF生成の最大回数（50）です。
              schema:
                type: integer
                example: 50
            X-RateLimit-Remaining:
              description: 現在のウィンドウの残りリクエスト数。
              schema:
                type: integer
                example: 0
            X-RateLimit-Reset:
              description: 現在のウィンドウがリセットされるUnixタイムスタンプ(秒)。
              schema:
                type: integer
                example: 1750000000
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: レート制限超過を人が読める形で説明したもの。
                    example: >-
                      Session PDF generation rate limit exceeded. You can make
                      up to 50 requests per minute.
              examples:
                Throttled:
                  summary: 同じ認証情報から1分間に50件を超えるPDF生成
                  value:
                    detail: >-
                      Session PDF generation rate limit exceeded. You can make
                      up to 50 requests per minute.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl --fail \
              'https://verification.didit.me/v3/users/user-abc-123/generate-pdf/' \
              -H 'x-api-key: YOUR_API_KEY' \
              --output user-history.pdf
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            content = client.users.generate_pdf(
                "user-abc-123",
            )
            with open("download.pdf", "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.users.generatePdf("user-abc-123");

            await writeFile("download.pdf", 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.Users.GeneratePDF(ctx, \"user-abc-123\")\nif err != nil {\n\tlog.Fatal(err)\n}\ndefer resp.Body.Close()\nfile, err := os.Create(\"download.pdf\")\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.users().generatePdf("user-abc-123")
                    .writeTo(Path.of("download.pdf"));
        - lang: php
          label: PHP
          source: |-
            <?php

            require 'vendor/autoload.php';

            use Didit\DiditClient;

            // Reads DIDIT_API_KEY.
            $didit = new DiditClient();

            $content = $didit->users->generatePdf('user-abc-123');
            $content->saveTo('download.pdf');
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            content = didit.users.generate_pdf("user-abc-123")
            File.binwrite("download.pdf", content)
        - lang: csharp
          label: .NET
          source: |-
            using System;
            using Didit;

            // Reads DIDIT_API_KEY.
            using var client = new DiditClient();

            var content = await client.Users.GeneratePdfAsync("user-abc-123");
            await content.SaveToAsync("download.pdf");
components:
  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.