> ## 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 認証API

> DiditのGET /session/は、アクセストークンを現在のセッションと照合します。失効、アイドルタイムアウト、ブロック、リフレッシュの後は即座に失敗します。

> [!WARNING]
>
> Authenticationは新しい機能です。これらのエンドポイントは`https://<name>.auth.didit.me`のようなアプリケーションのissuerによって提供され、Didit APIキーを受け付けることはありません。

これは即時の失効チェックです。IPアドレスごとに1分あたり30リクエスト、1時間あたり300リクエストまで利用できるため、トークンはリクエストのたびにオフラインで検証し、このエンドポイントを機密性の高いアクションの前に呼び出してください。詳しくは[セッションを確認する](https://docs.didit.me/ja/authentication/tokens-and-jwks.md#セッションを確認する)を参照してください。


## OpenAPI

````yaml ja/openapi-authentication.json GET /session/
openapi: 3.0.3
info:
  title: Didit Authentication API
  version: 1.0.0
  description: >-
    Didit Authenticationのサーバー向けエンドポイントです。Didit
    Authenticationは、アプリケーションのエンドユーザー向けのサインイン製品です。Authenticationは**新しい**製品で、2026-11-01リリースで本番環境に提供されます。


    ## ベースURL


    各アプリケーションはそれぞれ独自のOpenID
    Connect発行者（issuer）であり、以下のすべてのエンドポイントはその発行者のルートで提供されます。


    -
    本番環境のアプリケーションでは`https://<name>.auth.didit.me`、サンドボックスのアプリケーションでは`https://<name>.sandbox.auth.didit.me`。

    -
    有効化された独自のカスタムドメイン。有効化されると、デフォルトのホストに代わってこのドメインが発行者になります。新しいトークンの`iss`にはこのドメインが記載され、ディスカバリーはこのドメインを指し、公開可能キー（publishable
    key）が変わります。デフォルトのホストで発行されたアクセストークンは、更新されるまで`/session/`、`/step-up/`、`/monitoring-token/`で失敗します。


    本番環境とサンドボックスは別々のアプリケーションであるため、それぞれ別の発行者となり、キーも別です。公開可能キーは、`pk_live_`（本番環境）または`pk_test_`（サンドボックス）の後に、末尾のスラッシュを除いた発行者をパディングなしのbase64urlでエンコードした文字列が続く形式です。デコードすると発行者がわかります。これは公開識別子であり、認証情報ではありません。


    同じJSONエンドポイントは`https://apx.didit.me/auth/v2/authentication/{application_id}/`でも提供されます。どのアドレスから発行されたかにかかわらず、トークンには常に上記の発行者が記載されます。


    ## 認証情報


    これらのエンドポイントは、DiditのAPIキーやコンソールトークンを受け付けることはありません。


    - ディスカバリー、JWKS、`POST
    /token/`には認証情報は不要です。クライアントはパブリッククライアントです。クライアントシークレットはなく、認可コードはそのPKCE検証子（`S256`）に紐付けられます。`client_id`はアプリケーションIDです。

    -
    `/session/`、`/step-up/`、`/monitoring-token/`には本人のアクセストークンを渡します（`Authorization:
    Bearer
    <access_token>`）。呼び出しが成功するたびにセッションのアクティビティとしてカウントされるため、セッションのアイドルタイムアウトがリセットされます。


    ## リクエストボディ


    ボディを受け取るすべてのエンドポイントは、JSON、フォームエンコード、マルチパートのボディを受け付けます。このドキュメントではJSONを記載し、`POST
    /token/`についてはOAuthクライアントが送信する形式であるフォームエンコードも記載します。エンドポイントが受け付けないフィールドには`400
    {"<field>": "unknown_field"}`が返されます。


    ## トークン


    - **アクセストークン**：ヘッダーが`typ: at+jwt`のES256
    JWTで、有効期間は最大5分であり、セッションの有効期間を超えることはありません。クレーム：`AccessTokenClaims`。

    - **IDトークン**：ヘッダーが`typ: JWT`のES256
    JWTです。クレーム：`IDTokenClaims`。アクセストークンとして受け付けられることはありません。

    -
    **リフレッシュトークン**：使用するたびにローテーションされるランダムな文字列です。使用済みのリフレッシュトークンを再度送信すると、セッションが取り消されます。


    トークンは`GET
    /.well-known/jwks.json`のキーで検証してください。アルゴリズムは`ES256`でなければならず、`typ`はトークンの種類と、`iss`は設定した発行者と、`aud`はアプリケーションIDと一致しなければなりません。オフライン検証では、取り消されたセッションはそのアクセストークンの有効期限が切れた時点で初めて検出されます。即時に確認するには`GET
    /session/`を使用します。


    ## エラー


    | ボディ | 発生条件 |

    | --- | --- |

    | `{"error": "<code>"}` | `POST /token/`のエラーで、すべてステータス`400`、[RFC 6749
    第5.2節](https://www.rfc-editor.org/rfc/rfc6749#section-5.2)のボディ形式です：`invalid_grant`、`invalid_client`、Didit独自の`mfa_required`。サービスエラー：`temporarily_unavailable`、`monitoring_unavailable`、`monitoring_disabled`。
    |

    | `{"<field>": ["<message>"]}`または`{"<field>": "<code>"}` |
    リクエストフィールドの検証に失敗しました。`non_field_errors`は複数のフィールドにまたがるルールを、`unknown_field`はエンドポイントが受け付けないフィールドを示します。
    |

    | `{"detail": "<message>"}` |
    `401`（`invalid_token`）、`403`（`origin_not_allowed`）、`404`（不明なアプリケーションまたはステップアップ）、`429`（レート制限）。また、解析できないボディには`400`（`JSON
    parse error -
    ...`）、エンドポイントが提供していないメソッドには`405`、サポートされていない`Content-Type`には`415`が返されます。 |


    `401`には`WWW-Authenticate: Bearer`も含まれ、`429`には秒単位の`Retry-After`が含まれます。


    JSON以外で返される拒否が2つあります。発行者ではないアドレスは、これらのエンドポイントに到達する前に拒否されます。たとえば、使用されていない`*.auth.didit.me`の名前には空の`404`が返されます。UUIDではない`step_up_id`には`404`ページが返されます。


    ## レート制限


    リクエストは2つのレイヤーを通過する必要があります。


    **エンドポイントの制限**：クライアントのIPアドレスごと、アプリケーションごと、エンドポイントごとにカウントされます。


    - ディスカバリーとJWKS：1分あたり1,200リクエスト、1時間あたり12,000リクエスト。

    - その他すべてのエンドポイント：1分あたり30リクエスト、1時間あたり300リクエスト。`GET`と`DELETE
    /session/`は1つのカウントを共有します。


    制限を超えた場合：`429 {"detail": "Too many requests from this IP address. Please
    wait before trying again. Expected available in 60
    seconds."}`が返されます。1時間あたりの制限では`3600 seconds`になります。


    **ボット対策**：すべての`POST`と`DELETE`に適用されます。そのバケットは、ホスト型のサインインステップを含むアプリケーションのすべての`POST`および`DELETE`リクエストで共有され、継続的に補充されます。


    - クライアントのIPアドレスごとに1分あたり60リクエスト。

    - デバイスを識別するリクエスト（ブラウザSDKやネイティブSDKが送信するもの）について、デバイスごとに1分あたり30リクエスト。

    - アプリケーション全体で、すべてのIPアドレスを合わせて1分あたり1,000リクエスト。


    バケットを超えた場合：`429 {"detail": "rate_limited Expected available in N
    seconds."}`が返されます（Nが1の場合は`1
    second.`）。IPごとのバケットはエンドポイントをまたいで適用されるため、トークン、ステップアップ、サインアウトの呼び出しを混在させる1つのアドレスは、いずれかのエンドポイントの制限に達する前にバケットを使い切る可能性があります。アプリケーションのバケットは、ブラウザを含むアプリケーションのすべてのクライアントをカウントします。


    どちらのレイヤーもエンドポイントが実行される前に応答するため、`429`を受け取ったリクエストは実行されていません。`Retry-After`の経過後に再試行してください。リフレッシュも同様です。


    ## ブラウザからのリクエスト


    `Origin`ヘッダーを含むリクエストは、アプリケーション自身のオリジンまたは許可されたオリジンのいずれかから送信されたものでなければならず、そうでない場合は`403
    origin_not_allowed`が返されます。サーバー間のリクエストは`Origin`を送信しません。


    ## このドキュメントの対象外


    これらのルートは、ホスト型ページ、ブラウザSDKとネイティブSDK、AIエージェントのためのものです。サーバー向けの仕様には含まれず、サーバーSDKはこれらを呼び出しません。


    - サインインステップ：`POST /authorize/`、`POST
    /password/`、`/email/*`、`/phone/*`、`/password-reset/*`、`/passkeys/*`、`/mfa/*`、`/social/*`、`/protection/complete/`。

    -
    ホスト型ページとコールバック：`/sign-in`、`/magic`、`/invite`、`/reset`、`/verify/`、`/sso/*`、`/wallet/callback/`、`/logo/`、および`/.well-known/`配下のネイティブアプリ関連付けファイル。

    - エージェントアクセス：`/agents/*`と`/grants/`。AIエージェントのアクセストークンをリアルタイムで確認する`GET
    /agents/session/`も含みます。エージェントアクセスは、このバージョンの仕様には含まれません。

    - Authenticationのコンソール管理API。コンソールセッションを使用します。


    AuthenticationのイベントはまだWebhookとして配信されないため、このドキュメントではWebhookを定義していません。
servers:
  - url: https://{issuer}
    description: お客様のアプリケーションの発行者で、そのサインインオリジンです。
    variables:
      issuer:
        default: your-app.auth.didit.me
        description: >-
          発行者のホストです。`<name>.auth.didit.me`(本番環境)、`<name>.sandbox.auth.didit.me`(サンドボックス)、または有効なカスタムドメインです。
security: []
tags:
  - name: Issuer
    description: トークンを検証するためのディスカバリー情報と署名鍵です。
  - name: Tokens
    description: 認可コードグラントとリフレッシュグラント。
  - name: Sessions
    description: アクセストークンに紐づくセッションを確認して終了します。
  - name: Step-ups
    description: 機密性の高いアクションの前に行う認証。
  - name: Monitoring
    description: トランザクションモニタリングイベント用のデバイス認証情報です。
paths:
  /session/:
    get:
      tags:
        - Sessions
      summary: セッションを取得
      description: >-
        アクセストークンを有効なセッションと照合し、その内容を返します。JWTを自分で検証するよりも厳密で、次の場合にも即座に失敗します:
        セッションが取り消された、アイドル状態になった、または有効期間を過ぎた場合、本人がブロックされた、またはメールアドレスが認証済みでなくなった場合、セッションがMFAポリシーを満たさなくなった場合（例:
        本人が認証アプリを追加した後や組織の管理者になった後）、またはトークンがリフレッシュによって置き換えられた場合。支払いなど、機密性の高いアクションの前に使用してください。チェックが成功するとアクティビティとして扱われるため、セッションのアイドルタイムアウトがリセットされます。
      operationId: authentication_get_session
      responses:
        '200':
          description: セッションは本番環境のセッションです。
          headers:
            Cache-Control:
              description: 常に`no-store`です。このレスポンスは決してキャッシュしないでください。
              schema:
                type: string
                example: no-store
            Pragma:
              description: 常に`no-cache`です。
              schema:
                type: string
                example: no-cache
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
              examples:
                Session:
                  summary: パスワードセッション
                  value:
                    sub: 1c9d8b88-1bff-43d1-ad7a-88b2bc0024e9
                    sid: c9abf6cc-2d64-4bf2-b31e-a4d09a070ab1
                    application_id: 7b0a6c2e-3f41-4c9a-8d55-1e2f3a4b5c6d
                    vendor_data: user-42
                    amr:
                      - password
                    mfa_verified: false
                    email: person@example.com
                    email_verified: true
                    phone: null
                    verified_identity: null
                    verified: null
                    expires_at: '2026-11-16T10:41:14.347557Z'
                    post_logout_redirect_uri: ''
                    organizations: []
                VerifiedMember:
                  summary: 認証済みの組織メンバー
                  value:
                    sub: 1c9d8b88-1bff-43d1-ad7a-88b2bc0024e9
                    sid: c9abf6cc-2d64-4bf2-b31e-a4d09a070ab1
                    application_id: 7b0a6c2e-3f41-4c9a-8d55-1e2f3a4b5c6d
                    vendor_data: user-42
                    amr:
                      - passkey
                    mfa_verified: true
                    email: person@example.com
                    email_verified: true
                    phone: '+34600000000'
                    verified_identity: null
                    verified:
                      level: full_id
                      over_18: true
                      given_name: Alex
                      country: ES
                    expires_at: '2026-11-16T10:41:14.347557Z'
                    post_logout_redirect_uri: https://app.example.com/
                    organizations:
                      - organization_id: 3e9a1f0b-5c2d-4e7f-8a6b-9c0d1e2f3a4b
                        organization__name: Northwind
                        role: admin
                        custom_role: null
        '401':
          $ref: '#/components/responses/InvalidToken'
        '403':
          $ref: '#/components/responses/OriginNotAllowed'
        '404':
          $ref: '#/components/responses/ApplicationNotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/TemporarilyUnavailable'
      security:
        - AccessToken: []
components:
  schemas:
    Session:
      type: object
      description: アクセストークンの背後にあるライブセッションです。
      required:
        - sub
        - sid
        - application_id
        - vendor_data
        - amr
        - mfa_verified
        - email
        - email_verified
        - phone
        - verified_identity
        - verified
        - expires_at
        - post_logout_redirect_uri
        - organizations
      properties:
        sub:
          type: string
          format: uuid
          description: アイデンティティIDです。
          example: 1c9d8b88-1bff-43d1-ad7a-88b2bc0024e9
        sid:
          type: string
          format: uuid
          description: セッションID。
          example: c9abf6cc-2d64-4bf2-b31e-a4d09a070ab1
        application_id:
          type: string
          format: uuid
          example: 7b0a6c2e-3f41-4c9a-8d55-1e2f3a4b5c6d
        vendor_data:
          type: string
          description: Didit製品全体で共通するこの人物の参照値で、トークン内の値と同じです。
          example: user-42
        amr:
          $ref: '#/components/schemas/AuthenticationMethods'
        mfa_verified:
          type: boolean
          description: セッションが第2要素を通過したかどうか。パスキーによるサインインでは常に`true`です。
          example: false
        email:
          type: string
          format: email
          nullable: true
          example: person@example.com
        email_verified:
          type: boolean
          example: true
        phone:
          type: string
          nullable: true
          description: E.164形式の電話番号、または`null`。
          example: null
        verified_identity:
          $ref: '#/components/schemas/WalletVerification'
        verified:
          type: object
          nullable: true
          description: >-
            認証レベルと選択されたクレームで、トークンが`verified`として保持するものと同じオブジェクトです。存在しない場合は`null`です。本人が本人確認を完了したかどうかを知るには、`email_verified`ではなくこちらを参照してください。
          properties:
            level:
              type: string
              enum:
                - liveness
                - liveness_face_match
                - full_id
              description: 合格した最も高いレベルです。弱い順に`liveness`、`liveness_face_match`、`full_id`です。
              example: full_id
            over_18:
              type: boolean
              example: true
            over_21:
              type: boolean
              example: true
            given_name:
              type: string
              example: Alex
            family_name:
              type: string
              example: Doe
            birthdate:
              type: string
              description: 書類記載の生年月日（`YYYY-MM-DD`）。
              example: '1990-04-12'
            nationality:
              type: string
              description: ISO 3166-1 alpha-2国コード。
              example: ES
            country:
              type: string
              description: 書類の国を示すISO 3166-1 alpha-2コード。
              example: ES
            document_verified:
              type: boolean
              example: true
            liveness:
              type: boolean
              example: true
        expires_at:
          type: string
          format: date-time
          description: セッションが遅くとも終了する日時。アイドルタイムアウトにより、それより早く終了する場合があります。
          example: '2026-11-16T10:41:14.347557Z'
        post_logout_redirect_uri:
          type: string
          description: サインアウト後にアプリケーションがユーザーを送る先です。未設定の場合は空文字列です。
          example: https://app.example.com/
        organizations:
          type: array
          description: 組織機能が有効な場合、その人物が所属するすべての顧客組織です。それ以外の場合は空です。
          items:
            $ref: '#/components/schemas/SessionOrganization'
    AuthenticationMethods:
      type: array
      description: >-
        セッションのサインイン方法を1つの値で表します。例：`password`、`code`（メールコード）、`magic`（マジックリンク）、`passkey`、`phone`、`sso`、`wallet`（Didit
        ID Wallet）、またはソーシャルサインイン方法の名前。エージェントトークンの場合は空です。
      items:
        type: string
      example:
        - password
    WalletVerification:
      type: object
      description: サインイン時にDidit ID Walletが共有した内容です。本人が別の方法でサインインした場合は`null`です。
      nullable: true
      required:
        - issuer
        - subject
      properties:
        issuer:
          type: string
          description: ウォレットの発行者。
          example: https://apx.didit.me/auth/idv
        subject:
          type: string
          description: ウォレットにおけるこの人物のIDです。
          example: 8b7f5c1e-2d3a-4b5c-9e8f-7a6b5c4d3e2f
        shared_session:
          type: object
          description: 本人が共有することを選んだ認証。自身のAPIキーで引き換えます。
          properties:
            share_token:
              type: string
            session_id:
              type: string
            from_application_id:
              type: string
        claims:
          type: object
          description: 本人が共有に同意した検証済みの情報。アプリケーションが要求した内容に限られます。
          additionalProperties:
            oneOf:
              - type: boolean
              - type: string
          example:
            over_18: true
            given_name: Alex
    SessionOrganization:
      type: object
      required:
        - organization_id
        - organization__name
        - role
        - custom_role
      properties:
        organization_id:
          type: string
          format: uuid
          example: 3e9a1f0b-5c2d-4e7f-8a6b-9c0d1e2f3a4b
        organization__name:
          type: string
          description: 組織の名前。
          example: Northwind
        role:
          type: string
          enum:
            - admin
            - member
            - billing
          example: admin
        custom_role:
          type: object
          nullable: true
          description: メンバーに割り当てられたカスタム役割、または`null`。
          required:
            - key
            - permissions
          properties:
            key:
              type: string
              example: approver
            permissions:
              type: array
              items:
                type: string
              example:
                - payouts.approve
    Detail:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          example: invalid_token
    OAuthError:
      title: OAuth error
      type: object
      description: OAuthエラー（RFC 6749セクション5.2）またはサービスエラー。
      required:
        - error
      properties:
        error:
          type: string
          example: invalid_grant
  responses:
    InvalidToken:
      description: >-
        アクセストークンがない、形式が不正、期限切れ、別の発行者やキーで署名されている、IDトークンやエージェントトークンである、またはリフレッシュによって置き換えられています。あるいは、そのセッションが失効した、アイドル状態でタイムアウトした、有効期間を過ぎた、MFAポリシーを満たさなくなった、またはその人物がブロックされたかメールアドレスが未認証になっています。もう一度サインインを行ってもらってください。
      headers:
        WWW-Authenticate:
          description: '`Bearer`です。'
          schema:
            type: string
            example: Bearer
        Cache-Control:
          description: 常に`no-store`です。このレスポンスは決してキャッシュしないでください。
          schema:
            type: string
            example: no-store
        Pragma:
          description: 常に`no-cache`です。
          schema:
            type: string
            example: no-cache
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Detail'
          examples:
            InvalidToken:
              summary: 拒否されたアクセストークン
              value:
                detail: invalid_token
    OriginNotAllowed:
      description: >-
        リクエストに、アプリケーション自身のものでも許可されたオリジンに含まれるものでもない`Origin`が含まれていました。サーバーからのリクエストは`Origin`を送信しません。
      headers:
        Cache-Control:
          description: 常に`no-store`です。このレスポンスは決してキャッシュしないでください。
          schema:
            type: string
            example: no-store
        Pragma:
          description: 常に`no-cache`です。
          schema:
            type: string
            example: no-cache
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Detail'
          examples:
            OriginNotAllowed:
              summary: 許可されていないオリジンです
              value:
                detail: origin_not_allowed
    ApplicationNotFound:
      description: >-
        このアドレスはアプリケーションに属していますが、そのアプリケーションでAuthenticationが有効になっていません。`apx.didit.me`のアドレスでは、アプリケーションIDが不明です。どのアプリケーションにも属さないアドレスはエンドポイントに到達する前に拒否され、そのレスポンスはJSONではありません。
      headers:
        Cache-Control:
          description: 常に`no-store`です。このレスポンスは決してキャッシュしないでください。
          schema:
            type: string
            example: no-store
        Pragma:
          description: 常に`no-cache`です。
          schema:
            type: string
            example: no-cache
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Detail'
          examples:
            ApplicationNotFound:
              summary: 不明なアプリケーション
              value:
                detail: No Configuration matches the given query.
    RateLimited:
      description: >-
        このエンドポイントに対するこのIPアドレスからのリクエストが多すぎるか、`POST`または`DELETE`でボット対策のバケットが空になっています。処理は何も実行されていません。`Retry-After`秒待ってから再試行してください。
      headers:
        Retry-After:
          description: 再試行までに待機する秒数。
          schema:
            type: integer
            example: 60
        Cache-Control:
          description: 常に`no-store`です。このレスポンスは決してキャッシュしないでください。
          schema:
            type: string
            example: no-store
        Pragma:
          description: 常に`no-cache`です。
          schema:
            type: string
            example: no-cache
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Detail'
          examples:
            RateLimited:
              summary: エンドポイントの制限
              value:
                detail: >-
                  Too many requests from this IP address. Please wait before
                  trying again. Expected available in 60 seconds.
            BotProtection:
              summary: ボット対策の制限（POSTおよびDELETE）
              value:
                detail: rate_limited Expected available in 2 seconds.
    TemporarilyUnavailable:
      description: リクエストが依存しているサービスが一時的に利用できません。バックオフを入れて再試行してください。
      headers:
        Cache-Control:
          description: 常に`no-store`です。このレスポンスは決してキャッシュしないでください。
          schema:
            type: string
            example: no-store
        Pragma:
          description: 常に`no-cache`です。
          schema:
            type: string
            example: no-cache
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OAuthError'
          examples:
            TemporarilyUnavailable:
              summary: 後で再試行
              value:
                error: temporarily_unavailable
  securitySchemes:
    AccessToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        `POST /token/`から取得したこの人物のアクセストークンです。ヘッダーが`typ: at+jwt`のES256
        JWTで、有効期間は最長5分です。DiditのAPIキーではありません。

````

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