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

# Auth API: プログラムによる登録

> Didit Auth APIで組織をプログラムから作成できます。ブラウザ不要のエージェントネイティブ設計で、サブアカウント型のKYC基盤を構築可能。従量課金で契約は不要です。



プログラムによる登録用プロンプト
        プロンプトをクリップボードにコピー



      
      

\<pre>

\``Programmatically create a pending Didit account — step 1 of the two-step onboarding (no browser, no console).

Endpoint:
POST https://apx.didit.me/auth/v2/programmatic/register/

Authentication:
None. This is a public endpoint. (Don't confuse the Auth API host `apx.didit.me/auth/v2` with the verification host `verification.didit.me/v3`.)

Request body:
\- email (string, required) — Any real, deliverable email (personal, work, alias). The verification code is mailed synchronously, so reserved test domains (`@example.com`, `@example.org`, `@*.test`, `@*.example`, `@*.invalid`) get rejected by mail delivery and the call returns `500` — substitute the placeholder with an inbox you can read.
\- password (string, required) — Must satisfy ALL of: minimum 8 characters, ≥1 uppercase letter (A-Z), ≥1 lowercase letter (a-z), ≥1 digit (0-9), ≥1 special character from !@#$%^&*()_+-=[]{}|;:,.<>?. Rules are validated one at a time and the first failure short-circuits.

curl example (replace `you@yourdomain.com` with a real inbox):
curl -X POST https://apx.didit.me/auth/v2/programmatic/register/ \
-H "Content-Type: application/json" \
-d '{
"email": "you@yourdomain.com",
"password": "MyStr0ng!Pass"
}'

Response (201 Created):
\- message (string) — "Registration successful. Check your email for the verification code."
\- email (string) — echoed back.

What happens server-side:
\- A pending account is created (NOT usable yet).
\- A 6-character alphanumeric code (e.g. "A3K9F2") is emailed to the supplied address.
\- The code is valid for 15 minutes. After expiry the registration must be redone.

Failure modes (all 400 unless noted):
\- Field-level: { "email": ["Enter a valid email address."] } or { "password": ["Ensure this field has at least 8 characters."] }.
\- Password-strength failures CURRENTLY return as a BARE ARRAY (no field key), one rule at a time: ["Password must contain at least one uppercase letter."] / lowercase / digit / special character. Known server-side inconsistency — treat as { "password": [...] } client-side.
\- Duplicate email: { "detail": "An account with this email already exists." }
\- 429 — { "detail": "Too many registration attempts. Please try again later.", "wait": <seconds> } when more than 5 registrations from the same IP within an hour.
\- 500 — returned (with an HTML body, not JSON) when mail delivery to the supplied address fails synchronously. Most commonly triggered by reserved test domains; use a real inbox.

Rate limits:
5 registrations per IP per hour.

Next step:
After receiving the email, call POST https://apx.didit.me/auth/v2/programmatic/verify-email/ with { "email", "code" } to get your access_token and api_key — see /auth-api/verify-email.

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

\</pre>



      
      

貼り付け先



## OpenAPI

````yaml ja/openapi-auth.json POST /programmatic/register/
openapi: 3.0.0
info:
  version: 1.0.0
  title: Didit Auth API
  description: >-
    開発者とAIエージェント向けの、プログラムによる登録・認証APIです。2回のAPI呼び出しで登録でき、ブラウザは不要です。最もエージェントに適した本人確認プラットフォームです。


    ## ベースURL


    この仕様のすべてのエンドポイントは`https://apx.didit.me/auth/v2`でホストされています。これは検証API（`https://verification.didit.me/v3`）とは別のホストです。両者を混同しないでください。この認証ホストは**JWTアクセストークン**を発行し、**組織**と**アプリケーション**の一覧表示と管理を行えます。検証ホストはセッション、ワークフロー、AMLなどを呼び出す先であり、このAPIが返す**`api_key`**で認証します。


    ## 認証フローの仕組み


    1. `POST /programmatic/register/`：メールアドレスとパスワードを送信します。

    2. 6文字の英数字のコードをメールで受け取ります。

    3. `POST
    /programmatic/verify-email/`：コードを送信します。JWTの`access_token`、`refresh_token`、組織、および`client_id`と`api_key`を持つデフォルトのアプリケーションが返されます。

    4.
    `api_key`を保存します。`https://verification.didit.me/v3/...`へのすべての呼び出しで`x-api-key`として使用します。

    5. 今後は任意のマシンから、`POST /programmatic/login/`でメールアドレスとパスワードを新しいJWTと交換し、続けて`GET
    /organizations/me/`とアプリケーションのエンドポイントを呼び出して、認証情報を復元またはローテーションできます。


    JWTが必要なのは、この仕様の**アカウント管理**エンドポイントだけです。検証APIのトラフィックにはJWTではなく、長期間有効な`api_key`を使用します。


    ## 規約


    - すべてのリクエストボディとレスポンスボディはJSON（`Content-Type: application/json`）です。

    - **`POST /programmatic/register/`をテストする際は、実在する配信可能なメールアドレスを使用してください。**
    このエンドポイントは認証コードを同期的に送信するため、予約済みのテスト用ドメイン（`@example.com`、`@example.org`、`@*.test`、`@*.example`、`@*.invalid`）のアドレスはメール配信で拒否され、リクエストは`500`を返します。サンプル内のプレースホルダー`you@yourdomain.com`は、実際に読める受信箱に置き換えてください。

    - バリデーションエラーはHTTP `400`で、2種類のエンベロープのいずれかを返します。フィールド単位の問題には`{"field":
    ["message", ...]}`、ビジネスルールのエラーには`{"detail":
    "message"}`です。一部のバリデーター（登録時のパスワード強度、verify-emailでのコードの有効期限）は現在、フィールドをキーとする形式ではなく、単純な配列`["message"]`で応答します。これはサーバー側の既知の不整合のため、クライアントコードは両方の形式を受け入れる必要があります。

    - 認証エラーは、HTTP
    `401`（無効なBearerトークン）または`403`（Bearerトークンがない、または権限不足）とともに`{"detail":
    "..."}`として返されます。

    - レート制限のレスポンスには、クールダウン時間を秒単位で示す`wait`フィールドが含まれます。
servers:
  - url: https://apx.didit.me/auth/v2
    description: 本番環境の認証サーバー
security: []
tags:
  - name: Programmatic Auth
    description: >-
      メールアドレスとパスワードによるアカウントのライフサイクル：登録、認証、ログイン。Account
      Managementエンドポイントで使用するJWTの`access_token`を返します。また、認証時には最初のアプリケーションの`client_id`と`api_key`も返します。
  - name: Account Management
    description: >-
      組織の一覧取得と、アプリケーションの作成・取得・更新を行う認証付きエンドポイント（JWT
      Bearer）です。検証API呼び出しの認証に使用する`api_key`の再取得やローテーションに利用します。
paths:
  /programmatic/register/:
    post:
      tags:
        - Programmatic Auth
      summary: アカウントの登録
      description: >-
        プログラムによるオンボーディングのステップ1。保留中のアカウントを作成し、6文字のコード（有効期間10分）をメールで送信します。アカウントを作成する前にメールアドレスが確認され、コードを受信できないアドレスの場合は400`email_undeliverable`が返されます。レート制限:
        IPごとに1時間あたり5回、さらにネットワーク単位（IPv4は/24、IPv6は/64）で共有される1時間あたりの上限があります。
      operationId: programmatic_register
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterRequest'
            examples:
              Gmail:
                summary: 個人のGmailで登録する
                value:
                  email: you@yourdomain.com
                  password: MyStr0ng!Pass
              Work:
                summary: 勤務先のメールアドレスで登録する
                value:
                  email: you@yourcompany.com
                  password: C0mplex#Pass1
      responses:
        '201':
          description: >-
            登録に成功しました。6文字の英数字の認証コード（例:
            `A3K9F2`）が指定されたアドレスにメールで送信されました。コードの有効期間は10分間です。次に`POST
            /programmatic/verify-email/`を呼び出してください。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegisterResponse'
              examples:
                Success:
                  value:
                    message: >-
                      Registration successful. Check your email for the
                      verification code.
                    email: you@yourdomain.com
        '400':
          description: >-
            バリデーションエラー。想定されるエンベロープは、フィールド単位のエラーでは`{"field":
            ["..."]}`、ビジネスルールのエラー（例: メールアドレスの重複）では`{"detail":
            "..."}`です。パスワード強度のルールは現在、ルールを1つずつ、素の配列`["..."]`で返します。これはサーバー側の既知の不整合です。修正されるまでは`{"password":
            ["..."]}`として扱ってください。アドレスがコードを受信できない場合（使い捨て、予約済みまたはテスト用のドメイン、メールサーバーが存在しない、入力ミスの可能性が高い、または以前にバウンスしたアドレス）、ボディは`code:
            "email_undeliverable"`を含む`EmailUndeliverableError`となり、アカウントは作成も変更もされません。
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ValidationError'
                  - $ref: '#/components/schemas/EmailUndeliverableError'
              examples:
                MissingFields:
                  summary: 空のボディ
                  value:
                    email:
                      - This field is required.
                    password:
                      - This field is required.
                InvalidEmail:
                  summary: メールの形式が不正です
                  value:
                    email:
                      - Enter a valid email address.
                PasswordTooShort:
                  summary: パスワードが8文字未満
                  value:
                    password:
                      - Ensure this field has at least 8 characters.
                PasswordMissingUppercase:
                  summary: パスワードに大文字が含まれていない
                  value:
                    - Password must contain at least one uppercase letter.
                PasswordMissingLowercase:
                  summary: パスワードに小文字が含まれていない
                  value:
                    - Password must contain at least one lowercase letter.
                PasswordMissingDigit:
                  summary: パスワードに数字が含まれていない
                  value:
                    - Password must contain at least one digit.
                PasswordMissingSpecial:
                  summary: パスワードに特殊文字が含まれていない
                  value:
                    - >-
                      Password must contain at least one special character
                      (!@#$%^&*()_+-=[]{}|;:,.<>?).
                Duplicate:
                  summary: このメールアドレスのアカウントは既に存在します
                  value:
                    detail: An account with this email already exists.
                EmailUndeliverable:
                  summary: このアドレスはメールを受信できません（使い捨てドメイン）
                  value:
                    detail: >-
                      This email can't receive messages. Please use a different
                      email address.
                    code: email_undeliverable
                    reason: disposable_domain
                EmailLikelyTypo:
                  summary: ドメインに誤字がある可能性があります
                  value:
                    detail: >-
                      This email can't receive messages. Please use a different
                      email address.
                    code: email_undeliverable
                    reason: possible_typo
                    suggestion: gmail.com
        '429':
          description: >-
            レート制限中です。次のいずれかの場合に返されます。過去1時間に同じIPからの登録試行が5回を超えた場合、または呼び出し元のネットワーク（IPv4は/24、IPv6は/64。登録とコードの再送信で共有）の1時間あたりの上限を使い切った場合です。いずれも`Retry-After:
            3600`が付きます。また、サービスが同時に確認できる上限数のパスワードまたはコードを一時的に確認している場合にも、`Retry-After:
            5`ヘッダー付きで返されます。指定された秒数が経過してから再試行してください。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
              examples:
                RateLimited:
                  value:
                    detail: Too many registration attempts. Please try again later.
                PasswordChecksBusy:
                  summary: 進行中のパスワードチェックが多すぎます
                  value:
                    detail: >-
                      Too many sign-in attempts are being processed right now.
                      Please try again in a few seconds.
      security:
        - {}
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl -X POST https://apx.didit.me/auth/v2/programmatic/register/ \
              -H "Content-Type: application/json" \
              -d '{
                "email": "you@yourdomain.com",
                "password": "MyStr0ng!Pass"
              }'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # This call needs no API key.
            client = Didit()

            result = client.account.register(
                email="you@yourdomain.com",
                password="MyStr0ng!Pass",
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: |-
            import Didit from "@didit-protocol/sdk-node";

            // This call needs no API key.
            const didit = new Didit();

            const result = await didit.account.register({
              email: "you@yourdomain.com",
              password: "MyStr0ng!Pass",
            });
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// This call needs no API key.\nclient := didit.NewClient()\n\nresult, err := client.Account.Register(ctx, didit.RegisterRequest{\n\tEmail:    \"you@yourdomain.com\",\n\tPassword: \"MyStr0ng!Pass\",\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.RegisterRequest;

            // This call needs no API key.
            Didit client = new Didit();

            var result = client.account().register(RegisterRequest.builder()
                    .email("you@yourdomain.com")
                    .password("MyStr0ng!Pass")
                    .build());
            System.out.println(result);
        - lang: php
          label: PHP
          source: |-
            <?php

            require 'vendor/autoload.php';

            use Didit\DiditClient;

            // This call needs no API key.
            $didit = new DiditClient();

            $result = $didit->account->register([
                'email' => 'you@yourdomain.com',
                'password' => 'MyStr0ng!Pass',
            ]);
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

            # This call needs no API key.
            didit = Didit::Client.new

            result = didit.account.register(
              email: "you@yourdomain.com",
              password: "MyStr0ng!Pass"
            )
            puts result.to_h
        - lang: csharp
          label: .NET
          source: |-
            using System;
            using System.Text.Json;
            using Didit;

            // This call needs no API key.
            using var client = new DiditClient();

            var result = await client.Account.RegisterAsync(new RegisterRequest
            {
                Email = "you@yourdomain.com",
                Password = "MyStr0ng!Pass",
            });
            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    RegisterRequest:
      type: object
      required:
        - email
        - password
      properties:
        email:
          type: string
          format: email
          description: 任意の有効なメールアドレス（個人用、仕事用、エイリアス）。一意のアカウント識別子として使用されます。
          example: you@yourdomain.com
        password:
          type: string
          minLength: 8
          description: >-
            8文字以上。大文字（`A-Z`）、小文字（`a-z`）、数字（`0-9`）、および`!@#$%^&*()_+-=[]{}|;:,.<>?`のうちの特殊文字を、それぞれ1文字以上含める必要があります。検証では、満たしていないルールが一度に1つずつ報告されます。
          example: MyStr0ng!Pass
    RegisterResponse:
      type: object
      properties:
        message:
          type: string
          description: 認証コードが送信されたことを示す、人が読める確認メッセージ。
          example: Registration successful. Check your email for the verification code.
        email:
          type: string
          format: email
          description: 認証コードの送信先メールアドレスです。
          example: you@yourdomain.com
    ValidationError:
      description: >-
        検証エラーのボディ。想定されるエンベロープは、フィールドレベルのエラーには`{field: ["message",
        ...]}`マップ、ビジネスルールのエラーには単一キーの`{detail:
        "..."}`エンベロープです。一部のバリデーター（登録時のパスワード強度、verify-emailでのコードの有効性）は現在、素の配列`["message"]`で応答します。これはサーバー側の既知の不整合です。以下のスキーマでは、この仕様から生成されたクライアントコードが現在のレスポンスをデシリアライズできるよう、この素の配列の分岐を残していますが、新しいクライアントコードでは該当するフィールドキー形式（`{password:
        [...]}`または`{code: [...]}`）として扱ってください。サーバーの仕様は最終的にその形式に統一されます。
      oneOf:
        - type: object
          additionalProperties:
            type: array
            items:
              type: string
          example:
            email:
              - Enter a valid email address.
        - type: object
          properties:
            detail:
              type: string
          example:
            detail: An account with this email already exists.
        - type: array
          items:
            type: string
          example:
            - Invalid or expired verification code.
    EmailUndeliverableError:
      type: object
      description: >-
        宛先が認証コードを受信できない場合に、`POST
        /programmatic/register/`から返されます。このチェックはアカウントの作成や変更の前に実行されるため、何も残りません。
      required:
        - detail
        - code
        - reason
      properties:
        detail:
          type: string
          description: 人が読めるメッセージ。
          example: >-
            This email can't receive messages. Please use a different email
            address.
        code:
          type: string
          enum:
            - email_undeliverable
          description: 常に`email_undeliverable`です。
        reason:
          type: string
          enum:
            - invalid_address
            - reserved_domain
            - no_mail_records
            - disposable_domain
            - possible_typo
            - suppressed
          description: >-
            アドレスが拒否された理由：`invalid_address`（有効なアドレスではない）、`reserved_domain`（`example.com`などの予約済みまたはテスト用ドメイン）、`no_mail_records`（ドメインにメールサーバーがない）、`disposable_domain`（使い捨てメールボックスのプロバイダー）、`possible_typo`（一般的なプロバイダーのスペルミスの可能性が高い。`suggestion`を参照）、`suppressed`（このアドレスで過去にバウンスまたは苦情が発生した）。
        suggestion:
          type: string
          description: >-
            意図されたと思われるドメインで、ドメインがタイプミスと思われる場合にのみ存在します(例：`gmial.com`に対する`gmail.com`)。APIは確認を受け付けないため、修正したメールアドレスで再度登録してください。
          example: gmail.com
    RateLimitError:
      type: object
      description: レート制限または段階的ロックアウトのレスポンスです。`wait`はクールダウン時間（秒）です。
      properties:
        detail:
          type: string
          example: >-
            Too many login attempts from this IP address. Please wait before
            trying again.

````

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