> ## 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：共有トークンの発行

> DiditのPOST /v3/session/{id}/share/で、再利用可能なKYC・KYB向けに有効期限付きの共有トークンを発行。JWT署名付きでパートナー連携に対応。従量課金で契約は不要です。



セッション共有プロンプト
        プロンプトをクリップボードにコピー



      
      

\<pre>

\`Mint a short-lived share token so another Didit application can import this finished verification session (Reusable KYC / KYB).

Endpoint:
POST https://verification.didit.me/v3/session/{session_id}/share/

Authentication:
Use the x-api-key header with your Didit API key. Privilege: write:sessions.

Path parameter:
\- session_id (UUID) — works for both User Verification (KYC) and Business Verification (KYB).

Request body:
\- for_application_id (string, UUID, required) — UUID of the receiving Didit application. Must exist, must not be deleted, and must be different from the calling application.
\- ttl_in_seconds (integer, optional, default 3600) — Lifetime of the share token. Min 60, max 86400 (24 hours).

Prerequisites:
\- Session status must be one of "Approved", "Declined", "In Review". Any other status returns 400 ("Only finished sessions ... can be shared.").

curl example:
curl -X POST https://verification.didit.me/v3/session/<SESSION_ID>/share/ \
-H "x-api-key: <API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"for_application_id": "<PARTNER_APP_UUID>",
"ttl_in_seconds": 3600
}'

Response:
\- share_token (string) — HS256-signed JWT with payload { session_id, session_kind, from_application_id, for_application_id, iat, exp }.
\- for_application_id (UUID) — echoed back.
\- session_kind ("user" | "business") — embedded so the receiver clones the right kind.

Token characteristics:
\- Bound to for_application_id — only that application can redeem it via POST /v3/session/import-shared/.
\- Cannot be revoked via API — it simply expires after ttl_in_seconds.
\- You can mint multiple tokens for the same session (e.g. one per partner). Each call returns a fresh JWT with a new iat.

Failure modes:
\- 400 — { "detail": "Only finished sessions ... can be shared." } when the session isn't Approved/Declined/In Review.
\- 400 — { "for_application_id": ["..."] } for unknown or self application UUIDs.
\- 401 — invalid API key.
\- 403 — { "detail": "You do not have permission to perform this action." } when the key lacks write:sessions.
\- 404 — { "detail": "Not found." } when the session_id is not visible to this application.

Send the share_token to the receiving partner through your own secure channel (HTTPS API call, webhook, signed email link, etc.).

Next step:
The receiving application calls POST https://verification.didit.me/v3/session/import-shared/ with the share_token to clone the session — see /sessions-api/share-session/import.

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

\</pre>



      
      

貼り付け先

## KYCとKYBのサポート**本人確認（KYC）**と**法人確認 (KYB)**のどちらのセッションにも対応しています。Didit は`session_id`に対応するセッションを両方のセッション種別から特定し、次の内容を含むJWT共有トークンを生成します。```json theme={null}
{
  "session_id": "...",
  "session_kind": "user" | "business",
  "from_application_id": "...",
  "for_application_id": "...",
  "iat": ...,
  "exp": ...
}
```受け取り側のパートナーがトークンをインポートすると、Didit は該当する種別のセッション（KYCまたはKYB）を関連データとともに複製します。## 要件- セッションが**完了**ステータス（`APPROVED`、`DECLINED`、`IN_REVIEW`）である必要があります。
- `write:sessions`権限が必要です。
- `for_application_id`は有効なDiditアプリケーション（通常はパートナーのアプリケーション）である必要があります。## 例> [tab] 本人確認（KYC）セッションを共有する
>
> ```bash theme={null}
> curl -X POST https://verification.didit.me/v3/session/4c5c7f3a-.../share/ \
>   -H "x-api-key: YOUR_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "for_application_id": "partner-app-uuid",
>     "ttl_in_seconds": 3600
>   }'
> ```
>
> **レスポンス:**
>
> ```json theme={null}
> {
>   "share_token": "eyJhbGciOiJIUzI1NiJ9...",
>   "for_application_id": "partner-app-uuid",
>   "session_kind": "user"
> }
> ```> [tab] 法人確認（KYB）セッションを共有する
>
> ```bash theme={null}
> curl -X POST https://verification.didit.me/v3/session/bs-01HJX1.../share/ \
>   -H "x-api-key: YOUR_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "for_application_id": "partner-app-uuid",
>     "ttl_in_seconds": 7200
>   }'
> ```
>
> **レスポンス:**
>
> ```json theme={null}
> {
>   "share_token": "eyJhbGciOiJIUzI1NiJ9...",
>   "for_application_id": "partner-app-uuid",
>   "session_kind": "business"
> }
> ```## TTLの範囲| パラメーター | 最小 | 最大 | デフォルト |
| - | - | - | - |
| `ttl_in_seconds` | 60 | 86400 | 3600 |## 関連情報- [共有セッションのインポート](https://docs.didit.me/ja/sessions-api/share-session/import.md)
- [再利用可能なKYCガイド](https://docs.didit.me/ja/core-technology/reusable-kyc/share-kyc-via-api.md)
- [セッションの概要](https://docs.didit.me/ja/sessions-api/overview.md)


## OpenAPI

````yaml ja/openapi-25.json POST /v3/session/{sessionId}/share/
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}/share/:
    post:
      tags:
        - Sessions
      summary: 完了した認証セッションの共有トークンを発行
      description: >-
        特定のDiditアプリケーションがこの完了済みセッションをインポートできるようにする、有効期間の短いJWTを発行します。`POST
        /v3/session/import-shared/`と組み合わせて使用します。
      operationId: post_v3_session_share
      parameters:
        - in: path
          name: sessionId
          required: true
          description: トークンを発行する元の検証セッションのUUID。
          schema:
            type: string
            format: uuid
            example: 11111111-2222-3333-4444-555555555555
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - for_application_id
              properties:
                for_application_id:
                  type: string
                  format: uuid
                  description: >-
                    トークンを利用するDiditアプリケーションのUUIDです。存在し、削除されておらず、かつ呼び出し元アプリケーションとは異なる必要があります。Business
                    Consoleの**Settings → Application**で確認できます。
                  example: a5f3bca2-46e2-411e-90ef-a580900a57ee
                ttl_in_seconds:
                  type: integer
                  description: トークンの有効期間(秒)。最小は`60`、最大は`86400`(24時間)です。デフォルトは`3600`(1時間)です。
                  minimum: 60
                  maximum: 86400
                  default: 3600
                  example: 3600
            example:
              for_application_id: a5f3bca2-46e2-411e-90ef-a580900a57ee
              ttl_in_seconds: 7200
      responses:
        '200':
          description: 共有トークンが発行されました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  share_token:
                    type: string
                    description: >-
                      HS256で署名されたJWT。対象のアプリケーションで、[`POST
                      /v3/session/import-shared/`](/sessions-api/import-shared-session)に`share_token`としてそのまま渡してください。
                    example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                  for_application_id:
                    type: string
                    format: uuid
                    description: トークンが紐づく対象アプリケーションのUUIDをそのまま返します。
                    example: a5f3bca2-46e2-411e-90ef-a580900a57ee
                  session_kind:
                    type: string
                    enum:
                      - user
                      - business
                    description: 元のセッションがユーザー認証(KYC)セッションか法人確認(KYB)セッションか。
              examples:
                User session:
                  summary: KYCセッションを共有する
                  value:
                    share_token: >-
                      eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uX2lkIjoiMjBiYjNjM2ItNjE0Ni00MzlmLTg0YTQtYmQzMGQwMGFjNmEyIiwiZnJvbV9hcHBsaWNhdGlvbl9pZCI6ImRiZDIwZTM0LTQyZTktNGYyYy1iYTkxLWNmMDc2MjAxNmY2NCIsImZvcl9hcHBsaWNhdGlvbl9pZCI6ImE1ZjNiY2EyLTQ2ZTItNDExZS05MGVmLWE1ODA5MDBhNTdlZSIsImlhdCI6MTc1MzYzMDY2NiwiZXhwIjoxNzUzNjM0MjY2fQ.JJ9pNE_hqZsOtbR0XYZIWw4JzidjdEl279iUrsIkhGE
                    for_application_id: a5f3bca2-46e2-411e-90ef-a580900a57ee
                    session_kind: user
                Business session:
                  summary: KYBセッションを共有する
                  value:
                    share_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                    for_application_id: a5f3bca2-46e2-411e-90ef-a580900a57ee
                    session_kind: business
        '400':
          description: >-
            バリデーションエラー。フィールドエラーはフィールド名をキーとして返されます。未完了エラーは`detail`キーの下に（配列として）返されます。
          content:
            application/json:
              examples:
                Wrong status:
                  summary: ソースセッションが完了していません
                  value:
                    detail:
                      - >-
                        Only finished sessions ("Approved", "Declined", "In
                        Review") can be shared.
                Target missing:
                  summary: 対象のアプリケーションが存在しません
                  value:
                    for_application_id:
                      - Target application does not exist.
                Self-share:
                  summary: 対象が呼び出し元のアプリケーションです
                  value:
                    for_application_id:
                      - Cannot share a session with the same application.
                TTL bounds:
                  summary: ttl_in_secondsが範囲外です
                  value:
                    ttl_in_seconds:
                      - Ensure this value is greater than or equal to 60.
        '401':
          description: >-
            認証情報がないか無効です。ほとんどのv3エンドポイントとは異なり、このエンドポイントは権限デコレーターを通じて認証を行い、有効なトークンまたはキーが提示されない場合は`401`を返します。
          content:
            application/json:
              examples:
                Unauthorized:
                  summary: 未認証
                  value:
                    detail: >-
                      Authentication credentials were not provided or are
                      invalid.
        '403':
          description: 認証情報は有効ですが、このアプリケーションに対する`write:sessions`権限がありません。
          content:
            application/json:
              examples:
                No Permission:
                  summary: 権限がありません
                  value:
                    detail: You do not have permission to perform this action.
        '404':
          description: 指定された`session_id`のセッションがアプリケーション内に存在しません。
          content:
            application/json:
              examples:
                Not Found:
                  summary: セッションが見つかりません
                  value:
                    detail: Not found.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: |-
            curl -X POST \
              https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/share/ \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{
                "for_application_id": "a5f3bca2-46e2-411e-90ef-a580900a57ee",
                "ttl_in_seconds": 7200
              }'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.sessions.share(
                "11111111-2222-3333-4444-555555555555",
                for_application_id="a5f3bca2-46e2-411e-90ef-a580900a57ee",
                ttl_in_seconds=7200,
            )
            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.sessions.share("11111111-2222-3333-4444-555555555555", {
              for_application_id: "a5f3bca2-46e2-411e-90ef-a580900a57ee",
              ttl_in_seconds: 7200,
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Sessions.Share(ctx, \"11111111-2222-3333-4444-555555555555\", didit.SessionsShareParams{\n\tForApplicationID: \"a5f3bca2-46e2-411e-90ef-a580900a57ee\",\n\tTTLInSeconds:     didit.Int(7200),\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import me.didit.Didit;

            import me.didit.types.SessionsShareParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.sessions().share("11111111-2222-3333-4444-555555555555",
            SessionsShareParams.builder()
                    .forApplicationId("a5f3bca2-46e2-411e-90ef-a580900a57ee")
                    .ttlInSeconds(7200L)
                    .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->sessions->share('11111111-2222-3333-4444-555555555555', [
                'for_application_id' => 'a5f3bca2-46e2-411e-90ef-a580900a57ee',
                'ttl_in_seconds' => 7200,
            ]);

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

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

            result = didit.sessions.share(
              "11111111-2222-3333-4444-555555555555",
              for_application_id: "a5f3bca2-46e2-411e-90ef-a580900a57ee",
              ttl_in_seconds: 7200
            )
            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.ShareAsync("11111111-2222-3333-4444-555555555555",
            new SessionsShareParams

            {
                ForApplicationId = "a5f3bca2-46e2-411e-90ef-a580900a57ee",
                TtlInSeconds = 7200,
            });

            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.