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

# 不正チェックの事前プラン：入力検証と料金見積もり

> Diditで、リクエストを実行する前に入力内容を検証し、選択した不正チェック(Fraud Check)の料金を見積もります。

[Fraud Check](https://docs.didit.me/ja/standalone-apis/fraud-check.md)に使用する予定のボディと同じものを送信してください。
プランの作成では、チェックやセッションは作成されず、エンリッチメントサプライヤーの呼び出しもネットワーク履歴の読み取りも行われず、料金も一切発生しません。

各モジュールでは、`available`と`will_run`が区別されています。
`availability_reason`は、指定された入力でそのモジュールを利用できるかどうかを説明し、`selection_reason`は、そのモジュールが選択されている理由または選択されていない理由を説明します。
利用できないスイッチも非表示にせず、その入力要件を表示してください。

`networks_cross_org`を利用するには、Enterpriseプランと、組織の共有モードを`global`に設定することが必要です。
これらの条件を満たしていない場合、または組織でNetworksが有効になっていない場合、プランでは`available: false`と`availability_reason: "entitlement_required"`が返されます。
このモジュールを選択したチェックでは、同じ理由でスキップされます。
サンドボックスのアプリケーションには、プランや共有モードによる制限はありません。サポートされている識別子を指定すれば、モジュールが実行され、空のサンプル結果が返されます。

`estimated_price`は、返される`currency`で表された10進数の文字列です。
料金がnullの場合は、利用できないか料金が設定されていないことを意味し、無料という意味ではありません。
トップレベルの見積もりは、選択された実行可能なモジュールの合計です。`can_afford`では、該当する請求形態も確認されます。
識別子、コンテキスト、選択内容を変更した後は、プランを再作成してください。
実行時には利用資格と料金が再確認されるため、プランは予約ではなく、外部ソースが応答することを保証するものでもありません。


## OpenAPI

````yaml ja/openapi-25.json POST /v3/fraud/checks/plan/
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/fraud/checks/plan/:
    post:
      tags:
        - Fraud Check
      summary: 不正チェックを計画する
      description: 選択したチェックを実行せずに検証し、料金を見積もります。セッションの作成や請求は行われません。
      operationId: plan_create
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/FraudCheckRequestRequest'
          application/json:
            schema:
              $ref: '#/components/schemas/FraudCheckRequestRequest'
            example:
              client_reference: review-attempt-001
              subject:
                identifiers:
                  - type: email
                    value: applicant@example.com
                attributes:
                  first_name: Alex
                  last_name: Example
              checks:
                include:
                  - networks_same_org
                  - networks_cross_org
                  - email_risk
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/FraudCheckRequestRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FraudCheckPlan'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FraudBadRequestErrorMessage'
          description: ''
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.fraud_checks.plan(
                client_reference="review-attempt-001",
                subject={
                    "identifiers": [{
                        "type": "email",
                        "value": "applicant@example.com",
                    }],
                    "attributes": {
                        "first_name": "Alex",
                        "last_name": "Example",
                    },
                },
                checks={
                    "include": ["networks_same_org", "networks_cross_org", "email_risk"],
                },
            )
            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.fraudChecks.plan({
              client_reference: "review-attempt-001",
              subject: {
                identifiers: [{
                  type: "email",
                  value: "applicant@example.com",
                }],
                attributes: {
                  first_name: "Alex",
                  last_name: "Example",
                },
              },
              checks: {
                include: ["networks_same_org", "networks_cross_org", "email_risk"],
              },
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.FraudChecks.Plan(ctx, didit.FraudCheckRequestRequest{\n\tClientReference: didit.String(\"review-attempt-001\"),\n\tSubject: didit.FraudCheckSubjectRequest{\n\t\tIdentifiers: []didit.FraudCheckIdentifierRequest{{\n\t\t\tType:  didit.FraudTypeEnum(\"email\"),\n\t\t\tValue: \"applicant@example.com\",\n\t\t}},\n\t\tAttributes: didit.Some(didit.FraudCheckAttributesRequest{\n\t\t\tFirstName: didit.String(\"Alex\"),\n\t\t\tLastName:  didit.String(\"Example\"),\n\t\t}),\n\t},\n\tChecks: didit.Some(didit.FraudCheckModuleSelectionRequest{\n\t\tInclude: didit.Some([]didit.FraudExcludeEnum{didit.FraudExcludeEnum(\"networks_same_org\"), didit.FraudExcludeEnum(\"networks_cross_org\"), didit.FraudExcludeEnum(\"email_risk\")}),\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 me.didit.Didit;

            import me.didit.types.FraudCheckAttributesRequest;

            import me.didit.types.FraudCheckIdentifierRequest;

            import me.didit.types.FraudCheckModuleSelectionRequest;

            import me.didit.types.FraudCheckRequestRequest;

            import me.didit.types.FraudCheckSubjectRequest;

            import me.didit.types.FraudExcludeEnum;

            import me.didit.types.FraudTypeEnum;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.fraudChecks().plan(FraudCheckRequestRequest.builder()
                    .clientReference("review-attempt-001")
                    .subject(FraudCheckSubjectRequest.builder()
                            .identifiers(List.of(FraudCheckIdentifierRequest.builder()
                                    .type(FraudTypeEnum.of("email"))
                                    .value("applicant@example.com")
                                    .build()))
                            .attributes(FraudCheckAttributesRequest.builder()
                                    .firstName("Alex")
                                    .lastName("Example")
                                    .build())
                            .build())
                    .checks(FraudCheckModuleSelectionRequest.builder()
                            .include(List.of(FraudExcludeEnum.of("networks_same_org"), FraudExcludeEnum.of("networks_cross_org"), FraudExcludeEnum.of("email_risk")))
                            .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->fraudChecks->plan([
                'client_reference' => 'review-attempt-001',
                'subject' => [
                    'identifiers' => [[
                        'type' => 'email',
                        'value' => 'applicant@example.com',
                    ]],
                    'attributes' => [
                        'first_name' => 'Alex',
                        'last_name' => 'Example',
                    ],
                ],
                'checks' => [
                    'include' => ['networks_same_org', 'networks_cross_org', 'email_risk'],
                ],
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            result = didit.fraud_checks.plan(
              client_reference: "review-attempt-001",
              subject: {
                identifiers: [{
                  type: "email",
                  value: "applicant@example.com",
                }],
                attributes: {
                  first_name: "Alex",
                  last_name: "Example",
                },
              },
              checks: {
                include: ["networks_same_org", "networks_cross_org", "email_risk"],
              }
            )
            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.FraudChecks.PlanAsync(new
            FraudCheckRequestRequest

            {
                ClientReference = "review-attempt-001",
                Subject = new()
                {
                    Identifiers = new FraudCheckIdentifierRequest[]
                    {
                        new()
                        {
                            Type = "email",
                            Value = "applicant@example.com",
                        },
                    },
                    Attributes = new FraudCheckAttributesRequest
                    {
                        FirstName = "Alex",
                        LastName = "Example",
                    },
                },
                Checks = new FraudCheckModuleSelectionRequest
                {
                    Include = new FraudExcludeEnum[] { "networks_same_org", "networks_cross_org", "email_risk" },
                },
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    FraudCheckRequestRequest:
      type: object
      properties:
        client_reference:
          type: string
          minLength: 1
          description: >-
            このチェックに対するお客様独自の参照値です。冪等性キーを兼ねます。同じボディで再利用すると、モジュールを再実行・再請求することなく元のチェックが返されます。異なるボディで再利用すると409が返されます。
          maxLength: 255
        profile:
          type: string
          minLength: 1
          default: standard
          description: オーケストレーションプロファイルIDです。デフォルトはDiditの`standard`プロファイルです。
          maxLength: 64
        profile_version:
          type: string
          minLength: 1
          description: 固定されたプロファイルバージョンを指定します。デフォルトはプロファイルの現在のバージョンです。
          maxLength: 32
        subject:
          $ref: '#/components/schemas/FraudCheckSubjectRequest'
        context:
          $ref: '#/components/schemas/FraudCheckContextRequest'
        checks:
          $ref: '#/components/schemas/FraudCheckModuleSelectionRequest'
        vendor_data:
          type: string
          maxLength: 1000
        metadata: {}
      required:
        - subject
    FraudCheckPlan:
      type: object
      properties:
        profile_id:
          type: string
        profile_version:
          type: string
        modules:
          type: array
          items:
            $ref: '#/components/schemas/FraudCheckPlannedModule'
        estimated_price:
          type: string
          nullable: true
        currency:
          type: string
          nullable: true
        is_sandbox:
          type: boolean
        can_afford:
          type: boolean
      required:
        - can_afford
        - currency
        - estimated_price
        - is_sandbox
        - modules
        - profile_id
        - profile_version
    FraudBadRequestErrorMessage:
      type: object
      properties:
        detail:
          type: string
          default: Bad Request - Invalid request data
    FraudCheckSubjectRequest:
      type: object
      properties:
        selfie:
          type: string
          minLength: 1
          description: Base64エンコードされたJPEG、PNGまたはWebP形式のセルフィーで、最大6MBです。参照画像やURLは使用しません。
          maxLength: 8388672
        identifiers:
          type: array
          items:
            $ref: '#/components/schemas/FraudCheckIdentifierRequest'
          description: 1つ以上の型付き識別子です。1つで十分です。
          maxItems: 10
          minItems: 1
        attributes:
          $ref: '#/components/schemas/FraudCheckAttributesRequest'
      required:
        - identifiers
    FraudCheckContextRequest:
      type: object
      properties:
        ip_address:
          type: string
          minLength: 1
        user_agent:
          type: string
          maxLength: 512
        country:
          type: string
          description: 対象者が所在すると申告している国。参考情報にすぎず、本人であることの証明には決してなりません。
          maxLength: 3
        purpose:
          type: string
          maxLength: 128
        consent_obtained:
          type: boolean
    FraudCheckModuleSelectionRequest:
      type: object
      properties:
        include:
          type: array
          items:
            $ref: '#/components/schemas/FraudExcludeEnum'
        exclude:
          type: array
          items:
            $ref: '#/components/schemas/FraudExcludeEnum'
    FraudCheckPlannedModule:
      type: object
      properties:
        module:
          $ref: '#/components/schemas/FraudExcludeEnum'
        available:
          type: boolean
        availability_reason:
          type: string
          nullable: true
        will_run:
          type: boolean
        selection_reason:
          type: string
          nullable: true
        estimated_price:
          type: string
          nullable: true
      required:
        - availability_reason
        - available
        - estimated_price
        - module
        - selection_reason
        - will_run
    FraudCheckIdentifierRequest:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/FraudTypeEnum'
          description: |-
            識別子の種類。必須となるネームスペースのフィールドを決定します。

            * `email` - メールアドレス
            * `phone` - 電話番号
            * `national_id` - 国民ID
            * `tax_number` - 納税者番号
            * `passport_number` - パスポート番号
            * `driving_licence_number` - 運転免許証番号
            * `residence_permit_number` - 在留許可番号
            * `voter_id` - 有権者ID
            * `external_id` - 外部ID
        value:
          type: string
          minLength: 1
          description: 識別子の値です。一般的に使われる任意の形式で指定できます。
          maxLength: 255
        country:
          type: string
          description: >-
            ISO-3166
            alpha-2またはalpha-3形式の発行国。政府発行の識別子タイプでは必須です。同じ番号でも、国が異なれば別の人物を指すためです。
          maxLength: 3
        issuer:
          type: string
          description: 国だけでは一意に特定できない場合に指定する、任意の発行機関または国より下位の発行者です。
          maxLength: 128
      required:
        - type
        - value
    FraudCheckAttributesRequest:
      type: object
      description: 裏付けとなる属性。すべて任意で、指定するとモジュールの適用範囲が広がります。
      properties:
        first_name:
          type: string
          maxLength: 128
        last_name:
          type: string
          maxLength: 128
        full_name:
          type: string
          maxLength: 256
        date_of_birth:
          type: string
          format: date
        nationality:
          type: string
          maxLength: 3
        gender:
          type: string
          maxLength: 16
        address:
          type: string
          maxLength: 512
        city:
          type: string
          maxLength: 128
        state:
          type: string
          maxLength: 128
        postal_code:
          type: string
          maxLength: 32
    FraudExcludeEnum:
      enum:
        - normalization
        - email_risk
        - email_social
        - phone_social
        - phone_risk
        - ip_risk
        - database_validation
        - networks_same_org
        - networks_cross_org
        - biometric_identity
      type: string
      description: |-
        * `normalization` - 正規化
        * `email_risk` - メールアドレスのリスク
        * `email_social` - メールアドレスのソーシャル情報
        * `phone_social` - 電話番号のソーシャル情報
        * `phone_risk` - 電話番号のリスク
        * `ip_risk` - IPリスク
        * `database_validation` - データベース検証
        * `networks_same_org` - 同一組織内ネットワーク
        * `networks_cross_org` - 組織横断ネットワーク
        * `biometric_identity` - 生体情報による本人確認
    FraudTypeEnum:
      enum:
        - email
        - phone
        - national_id
        - tax_number
        - passport_number
        - driving_licence_number
        - residence_permit_number
        - voter_id
        - external_id
      type: string
      description: |-
        * `email` - メールアドレス
        * `phone` - 電話番号
        * `national_id` - 国民ID番号
        * `tax_number` - 納税者番号
        * `passport_number` - パスポート番号
        * `driving_licence_number` - 運転免許証番号
        * `residence_permit_number` - 在留許可番号
        * `voter_id` - 有権者ID
        * `external_id` - 外部ID
  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
    BearerAuth:
      type: http
      scheme: bearer
      description: アプリケーションのクライアントクレデンシャルのアクセストークン。

````

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