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

# KYB書類アップロードAPI

> DiditのAPIで、自社サーバーから企業確認セッションに法人書類をアップロードできます。ホスト型パイプラインと同じOCRとチェックが適用されます。



## OpenAPI

````yaml ja/openapi-25.json POST /v3/session/{sessionId}/kyb/documents/
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}/kyb/documents/:
    post:
      tags:
        - Sessions
      summary: セッションにKYB書類をアップロード
      description: >-
        1つ以上の法人書類(定款、株主名簿、設立証明書など)を、ホスト型ページではなく自社サーバーから、法人確認セッションのKYB書類ステップにアップロードします。Diditはホスト型と同じパイプライン(圧縮、OCR、改ざんチェックと書類間の照合チェック、書類のグループ化)を実行し、必要な書類グループがそろった時点でセッションを先に進めます。このステップは、送信するファイル数にかかわらず一律の料金がかかります。セッションが開いていてKYB書類ステップにあり、かつ法人登記ステップで選択された企業が存在している必要があります。書類に記載された人物は`GET
        /v3/session/{sessionId}/kyb/extracted-parties/`で取得できます。`write:businesses`が必要です。
      operationId: post_v3_session_kyb_documents
      parameters:
        - name: sessionId
          in: path
          required: true
          description: 法人確認 (KYB) セッションのUUIDです。APIキーのアプリケーションに属している必要があります。
          schema:
            type: string
            format: uuid
            example: 33333333-4444-5555-6666-777777777777
        - name: node_id
          in: query
          required: false
          description: >-
            KYBステップのワークフローノード。ワークフローに複数のKYBノードがある場合にのみ必要です。デフォルトでは、Diditはセッション自身のノードを使用します。
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - documents
              properties:
                documents:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: >-
                    アップロードするファイル:JPG、JPEG、PNG、TIFF、WEBP、PDF、またはそれらのZIPアーカイブ。PDFは50MBまで、写真は圧縮前で6MBまでです。
                document_passwords:
                  type: array
                  items:
                    type: string
                  description: >-
                    `documents`内のファイルごとに同じ順序で1エントリー。保護されたPDFのパスワードを指定し、それ以外のファイルの場合は空にします。
                document_group:
                  type: string
                  enum:
                    - LEGAL_PRESENCE
                    - COMPANY_DETAILS
                    - OWNERSHIP_STRUCTURE
                    - REPRESENTATIVES_AUTHORIZATION
                  description: このアップロードが対応する必須書類グループ。
                locale:
                  type: string
                  maxLength: 10
                  description: 次のステップのレスポンスを翻訳するために使用するロケール。
      responses:
        '200':
          description: >-
            書類を処理しました。必須グループがすべて満たされるとセッションが次に進み、`next_step`が次のステップを示します。満たされていない場合は「書類」ステップにとどまり、`document_groups`と`document_answer`で不足しているものが示されます。
          content:
            application/json:
              schema:
                type: object
                properties:
                  valid:
                    type: boolean
                  next_step:
                    type: string
                    nullable: true
                    description: アップロード後のセッションの現在のステップ。
                  kyb_status:
                    type: string
                    description: 企業チェックのステータス。
                  document_answer:
                    type: object
                    additionalProperties: true
                    description: アップロードされた書類ごとの結果と、残りのアップロード回数。
                additionalProperties: true
              example:
                valid: true
                next_step: KYB_KEY_PEOPLE
                kyb_status: In Progress
        '400':
          description: >-
            書類が却下された(改ざん、判読不能、または非対応)か、セッションにまだKYBの会社がありません。試行回数が残っている間は、別のファイルで再試行してください。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 人が読めるエラーメッセージ。
              example:
                message: No KYB company found. Submit company data first.
        '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.
        '402':
          description: 書類ステップに使用できるクレジットが組織に残っていません。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 人が読めるエラーメッセージ。
              example:
                detail: Insufficient credits.
        '403':
          description: >-
            認証または認可に失敗しました。キーがない場合、別のアプリケーションのキーの場合、このエンドポイントに必要な権限を持たないスコープ付きキーの場合、キーのIP許可リスト外からのリクエストの場合は`403`を返し、誤った、失効した、または期限切れのキーの場合は`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 write:
                  summary: 'スコープ付きキーにdecisions: write権限がない'
                  value:
                    detail: This API key has no write access to decisions.
                IP not allowed:
                  summary: キーのIP許可リスト外からのリクエスト
                  value:
                    detail: This API key can't be used from this IP address.
        '404':
          description: >-
            セッションが存在しない、削除されている、別のアプリケーションに属している、またはスコープ付きキーの制限外です。これらを区別する詳細は返されません。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 人が読めるエラーメッセージ。
              example:
                detail: Session not found.
        '409':
          description: >-
            セッションが終了している（`kyb_session_not_writable`）か、KYB書類ステップにありません（`kyb_step_mismatch`。`next_step`に現在のステップ名が示されます）。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 人が読めるエラーメッセージ。
                  code:
                    type: string
                  next_step:
                    type: string
              example:
                detail: The session is not on the step this operation completes.
                code: kyb_step_mismatch
                next_step: KYB_REGISTRY
        '429':
          description: >-
            レート制限を超過しました。書き込み（POST、PATCH、DELETE）リクエストはAPIキーごとに1分あたり300件までです。`Retry-After`秒待ってから再試行してください。`X-RateLimit-*`ヘッダーで利用枠を確認できます。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 人が読めるエラーメッセージ。
              examples:
                Rate limited:
                  summary: 現在の1分間の上限を使い切りました
                  value:
                    detail: >-
                      Write request rate limit exceeded. You can make up to 300
                      requests per minute.
          headers:
            Retry-After:
              description: 再試行までに待機する秒数。
              schema:
                type: integer
                minimum: 1
                example: 30
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.sessions.upload_kyb_documents(
                "33333333-4444-5555-6666-777777777777",
                documents=[open("document.pdf", "rb")],
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: >-
            import Didit, { fileFromPath } from "@didit-protocol/sdk-node";


            // Reads DIDIT_API_KEY.

            const didit = new Didit();


            const result = await
            didit.sessions.uploadKybDocuments("33333333-4444-5555-6666-777777777777",
            {
              documents: [await fileFromPath("document.pdf")],
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Sessions.UploadKYBDocuments(ctx, \"33333333-4444-5555-6666-777777777777\", didit.SessionsUploadKYBDocumentsParams{\n\tDocuments: []didit.File{didit.FileFromPath(\"document.pdf\")},\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import java.nio.file.Path;

            import java.util.List;

            import me.didit.Didit;

            import me.didit.types.SessionsUploadKybDocumentsParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.sessions().uploadKybDocuments("33333333-4444-5555-6666-777777777777",
            SessionsUploadKybDocumentsParams.builder()
                    .documents(List.of(Path.of("document.pdf")))
                    .build());
            System.out.println(result);
        - lang: php
          label: PHP
          source: >-
            <?php


            require 'vendor/autoload.php';


            use Didit\DiditClient;

            use Didit\File;


            // Reads DIDIT_API_KEY.

            $didit = new DiditClient();


            $result =
            $didit->sessions->uploadKybDocuments('33333333-4444-5555-6666-777777777777',
            [
                'documents' => [File::fromPath('document.pdf')],
            ]);

            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            result = didit.sessions.upload_kyb_documents(
              "33333333-4444-5555-6666-777777777777",
              documents: [Pathname("document.pdf")]
            )
            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.Sessions.UploadKybDocumentsAsync("33333333-4444-5555-6666-777777777777",
            new SessionsUploadKybDocumentsParams

            {
                Documents = new FileUpload[] { FileUpload.FromPath("document.pdf") },
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
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.