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

# SDK取引トークン発行API：クライアントサイドKYT

> 有効期間の短いスコープ付きトークンを発行し、Didit SDKがアプリから直接モニタリング対象の取引を送信できるようにします。サブジェクトの紐付けはサーバー側で強制されます。



SDKトランザクショントークン発行APIのプロンプト
        プロンプトをクリップボードにコピー



      
      

\<pre>

\`Mint a short-lived scoped token that lets the Didit SDKs submit monitored transactions directly from an end-user's device.

Endpoint:
POST https://verification.didit.me/v3/transactions/sdk-token/

Authentication:
Use the x-api-key header with my Didit API key. This call runs on YOUR BACKEND only - the API key must never ship in an app. Only the returned sdk_token travels to the device.

Goal:
\- Get an sdk_token scoped to one end user (vendor_data). The app passes it to the SDK's submitTransaction method (or directly to POST /v1/transactions/ via the X-Transaction-Token header).
\- The token binds the subject identity server-side: every transaction submitted with it has its subject forced to the token's vendor_data, so a tampered client cannot submit on behalf of another user.

Request body (application/json):
\{
"vendor_data": "user-042",   // required - your internal id for the end user
"ttl_seconds": 900,          // optional - default 900 (15 min), max 86400 (24 h)
"max_uses": 3                // optional - max successful submissions; omit for unlimited within the TTL
}
camelCase aliases (vendorData, ttlSeconds, maxUses) are also accepted.

Example call:
curl -X POST "https://verification.didit.me/v3/transactions/sdk-token/" \
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"vendor_data":"user-042","ttl_seconds":900,"max_uses":3}'

What to read from the response:
\- sdk_token - hand this to your app; it authenticates POST /v1/transactions/ via the X-Transaction-Token header.
\- expires_at - ISO-8601 expiry; mint a fresh token per user session rather than reusing long-lived ones.

Failure modes:
\- 400 - missing vendor_data or invalid ttl_seconds/max_uses.
\- 401 - missing or malformed x-api-key.

Best practice:
\- Mint per user session, keep max_uses tight when the number of expected submissions is known.
\- A 401 from POST /v1/transactions/ whose detail contains the word "expired" means the token aged out - mint a new one and retry.

For the full client-side submission guide, see /transaction-monitoring/sdk-transaction-submission.`

\</pre>



      
      

貼り付け先



## OpenAPI

````yaml ja/openapi-25.json POST /v3/transactions/sdk-token/
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/transactions/sdk-token/:
    post:
      tags:
        - Transactions
      summary: SDK取引トークンの発行
      description: >-
        アプリがDidit SDKに渡す短期間有効なスコープ付きトークンを発行し、SDKがエンドユーザーのデバイスから`POST
        /v1/transactions/`経由で取引を直接送信できるようにします。トークンは1つの`vendor_data`（お客様のユーザーID）に紐づけられます。このトークンで送信されたすべての取引は、その紐づけに基づいてサーバー側でサブジェクトの本人性が強制されるため、改ざんされたクライアントが別のユーザーになりすまして送信することはできません。トークンはバックエンドから発行してください。APIキー自体を絶対にアプリに含めないでください。camelCaseのエイリアス（`vendorData`、`ttlSeconds`、`maxUses`）も使用できます。
      operationId: createTransactionSdkToken
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                vendor_data:
                  type: string
                  description: >-
                    このトークンの対象となるエンドユーザーに対するお客様の内部識別子です。このトークンで送信されるすべての取引の主体として強制的に適用されます。
                  example: user-042
                ttl_seconds:
                  type: integer
                  default: 900
                  maximum: 86400
                  description: トークンの有効期間(秒)。デフォルトは900(15分)、最大は86400(24時間)です。
                max_uses:
                  type: integer
                  nullable: true
                  description: このトークンで許可される送信成功の最大回数です。省略するかnullにすると、TTL内で無制限に使用できます。
              required:
                - vendor_data
            example:
              vendor_data: user-042
              ttl_seconds: 900
              max_uses: 3
      responses:
        '201':
          description: >-
            発行されたトークンです。`sdk_token`をアプリに渡してください。このトークンは`expires_at`まで、`X-Transaction-Token`ヘッダーを介してデバイス向けの`/v1/transactions/`エンドポイントを認証します。
          content:
            application/json:
              schema:
                type: object
                properties:
                  sdk_token:
                    type: string
                    description: SDKに渡すスコープ付きの取引トークンです。
                  expires_at:
                    type: string
                    format: date-time
                    description: トークンが受け付けられなくなる日時。
              example:
                sdk_token: q7Zt...urlsafe
                expires_at: '2026-07-07T12:15:00Z'
        '400':
          description: バリデーションに失敗しました。`vendor_data`がない、または`ttl_seconds`が許容範囲外です。
          content:
            application/json:
              examples:
                Missing vendor_data:
                  value:
                    vendor_data:
                      - This field is required.
        '403':
          description: APIキーがない、無効、または失効しています。
          content:
            application/json:
              examples:
                Invalid API Key:
                  value:
                    detail: Invalid API Key.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X POST
            https://verification.didit.me/v3/transactions/sdk-token/ \
              -H 'x-api-key: YOUR_API_KEY' -H 'Content-Type: application/json' \
              -d '{"vendor_data": "user-042", "ttl_seconds": 900, "max_uses": 3}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.transactions.create_sdk_token(
                vendor_data="user-042",
                ttl_seconds=900,
                max_uses=3,
            )
            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.transactions.createSdkToken({
              vendor_data: "user-042",
              ttl_seconds: 900,
              max_uses: 3,
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Transactions.CreateSDKToken(ctx, didit.TransactionsCreateSDKTokenParams{\n\tVendorData: \"user-042\",\n\tTTLSeconds: didit.Int(900),\n\tMaxUses:    didit.Int(3),\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.TransactionsCreateSdkTokenParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.transactions().createSdkToken(TransactionsCreateSdkTokenParams.builder()
                    .vendorData("user-042")
                    .ttlSeconds(900L)
                    .maxUses(3L)
                    .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->transactions->createSdkToken([
                'vendor_data' => 'user-042',
                'ttl_seconds' => 900,
                'max_uses' => 3,
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            result = didit.transactions.create_sdk_token(
              vendor_data: "user-042",
              ttl_seconds: 900,
              max_uses: 3
            )
            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.Transactions.CreateSdkTokenAsync(new
            TransactionsCreateSdkTokenParams

            {
                VendorData = "user-042",
                TtlSeconds = 900,
                MaxUses = 3,
            });

            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.