{
  "openapi": "3.1.2",
  "info": {
    "title": "メールアドレス検証API",
    "version": "1.0.0",
    "description": "許諾を得たメールアドレスの検証に使う、連携サービス向けAPIです。本番ではサービスに発行されたBearerキーを使います。一括検証には個別の利用権限が必要です。"
  },
  "servers": [
    {
      "url": "https://email-check.techguide.jp",
      "description": "本番API"
    },
    {
      "url": "https://email-check.techguide.jp/sandbox",
      "description": "モックAPI。試験用キーと定められた入力で固定結果を返します。入力例とシナリオは /developers/sandbox で確認できます。"
    }
  ],
  "externalDocs": {
    "description": "開発者向けリファレンス",
    "url": "https://email-check.techguide.jp/developers/reference"
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "単件検証",
      "description": "メールアドレスを1件検証する操作です。"
    },
    {
      "name": "一括検証",
      "description": "非同期ジョブを受け付けて結果を参照する操作です。"
    }
  ],
  "paths": {
    "/api/v1/email/verify": {
      "post": {
        "tags": [
          "単件検証"
        ],
        "operationId": "verifyEmail",
        "summary": "メールアドレスを1件検証する",
        "description": "アドレス1件をapplication/jsonで受け付けます。JSON本文の上限は2,048バイト（2 KiB）です。HTTP 200のunknownは判定保留を表します。実際の配送や本人の所有を確かめる場合は確認メールを使ってください。",
        "requestBody": {
          "description": "検証するメールアドレスを指定します。",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyRequest"
              },
              "examples": {
                "email": {
                  "summary": "単件検証の入力",
                  "value": {
                    "email": "accepted@example.test"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "検証結果を返します。statusに対応するreasonとキャッシュの有無を含みます。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "accepted": {
                    "summary": "宛先を受付",
                    "value": {
                      "status": "accepted",
                      "reason": "rcpt_accepted",
                      "cached": false
                    }
                  },
                  "likelyInvalid": {
                    "summary": "宛先が見つからない",
                    "value": {
                      "status": "likely_invalid",
                      "reason": "recipient_not_found",
                      "cached": false
                    }
                  },
                  "nullMx": {
                    "summary": "ドメインの受信設定がない",
                    "value": {
                      "status": "likely_invalid",
                      "reason": "null_mx",
                      "cached": false
                    }
                  },
                  "unknown": {
                    "summary": "応答待ちがタイムアウト",
                    "value": {
                      "status": "unknown",
                      "reason": "timeout",
                      "cached": false
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "JSONが不正、指定した項目がemailのみでない、またはメールアドレスの書式が不正です。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "invalid_request"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "invalid_request",
                    "value": {
                      "error": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "認証に失敗しました。発行済みの有効なキーをAuthorizationヘッダーに指定してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "unauthorized"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "unauthorized",
                    "value": {
                      "error": "unauthorized"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "JSONの本文が2,048バイト（2 KiB）を超えています。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "body_too_large"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "body_too_large",
                    "value": {
                      "error": "body_too_large"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Content-Typeにapplication/jsonを指定してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "unsupported_media_type"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "unsupported_media_type",
                    "value": {
                      "error": "unsupported_media_type"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "リクエストの受付上限に達しました。Retry-Afterに示された秒数が経過してから再試行してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "rate_limited"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "rate_limited",
                    "value": {
                      "error": "rate_limited"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "現在、検証サービスを利用できません。Retry-Afterに示された秒数が経過してから再試行してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "unavailable"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "unavailable",
                    "value": {
                      "error": "unavailable"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/email/batches": {
      "post": {
        "tags": [
          "一括検証"
        ],
        "operationId": "createEmailBatch",
        "summary": "一括検証ジョブを受け付ける",
        "description": "1〜50件の文字列を受け付けます。JSON本文の上限は32,768バイト（32 KiB）です。アドレスの書式が不正な文字列は、結果の該当位置にinvalid_emailを返します。受付後はLocationで示すURLから進捗を確認できます。本番では有効期間内に同じサービス・キー・正規化後の入力内容と順序で再送すると、同じジョブを返します。結果は本番の受付から24時間参照できます。",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "一括処理ごとに一意なキーを指定します。同じ処理を再試行するときは、このキーと入力内容・順序をそろえてください。",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 80,
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{7,79}$"
            },
            "example": "batch-example-001"
          }
        ],
        "requestBody": {
          "description": "入力順に復元できるよう、元の配列を保持してください。",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              },
              "examples": {
                "emails": {
                  "summary": "個別の入力不備を含む一括検証",
                  "value": {
                    "emails": [
                      "accepted@example.test",
                      "not-an-address"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "ジョブの現在の状態を返します。結果取得先はLocationで確認してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Location": {
                "$ref": "#/components/headers/BatchLocation"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchSummary"
                },
                "examples": {
                  "pending": {
                    "summary": "受付時のジョブ概要",
                    "value": {
                      "jobId": "4c2dd4ee-ff90-47ef-88a8-a412f9639ed7",
                      "status": "pending",
                      "total": 2,
                      "processed": 1,
                      "expiresAt": "2030-01-01T00:00:00.000Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "JSONの構造、配列の件数や要素型、またはIdempotency-Keyが不正です。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "invalid_request"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "invalid_request",
                    "value": {
                      "error": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "認証に失敗しました。発行済みの有効なキーをAuthorizationヘッダーに指定してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "unauthorized"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "unauthorized",
                    "value": {
                      "error": "unauthorized"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "このサービスには一括検証の利用権限が付与されていません。サービスの権限を確認してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "forbidden"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "forbidden",
                    "value": {
                      "error": "forbidden"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "同じサービスで使用済みのIdempotency-Keyに、以前と異なる入力が指定されました。同じジョブの再試行は元の内容とキーを使い、新しいジョブには新しいキーを使ってください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "idempotency_conflict"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "idempotency_conflict",
                    "value": {
                      "error": "idempotency_conflict"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "JSONの本文が32,768バイト（32 KiB）を超えています。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "body_too_large"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "body_too_large",
                    "value": {
                      "error": "body_too_large"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Content-Typeにapplication/jsonを指定してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "unsupported_media_type"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "unsupported_media_type",
                    "value": {
                      "error": "unsupported_media_type"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "リクエストの受付上限に達しました。Retry-Afterに示された秒数が経過してから再試行してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "rate_limited"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "rate_limited",
                    "value": {
                      "error": "rate_limited"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "現在、検証サービスを利用できません。Retry-Afterに示された秒数が経過してから再試行してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "unavailable"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "unavailable",
                    "value": {
                      "error": "unavailable"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/email/batches/{jobId}": {
      "get": {
        "tags": [
          "一括検証"
        ],
        "operationId": "getEmailBatch",
        "summary": "一括検証の進捗と結果を取得する",
        "description": "受付時のLocationで示したURLを、同じサービスに発行された有効なキーで取得します。resultsは入力と同じ順番で、未処理の項目はnullです。pendingの間はRetry-Afterに従って再取得します。本番では受付から24時間後に参照できなくなります。",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "description": "一括受付で返ったジョブIDです。",
            "schema": {
              "$ref": "#/components/schemas/BatchId"
            },
            "example": "4c2dd4ee-ff90-47ef-88a8-a412f9639ed7"
          }
        ],
        "responses": {
          "200": {
            "description": "ジョブの進捗と入力順の個別結果を返します。処理中はRetry-After: 3を返します。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/BatchPollAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchDetails"
                },
                "examples": {
                  "pending": {
                    "summary": "処理中の結果",
                    "value": {
                      "jobId": "4c2dd4ee-ff90-47ef-88a8-a412f9639ed7",
                      "status": "pending",
                      "total": 2,
                      "processed": 1,
                      "expiresAt": "2030-01-01T00:00:00.000Z",
                      "results": [
                        null,
                        {
                          "error": "invalid_email"
                        }
                      ]
                    }
                  },
                  "completed": {
                    "summary": "完了時の結果",
                    "value": {
                      "jobId": "4c2dd4ee-ff90-47ef-88a8-a412f9639ed7",
                      "status": "completed",
                      "total": 2,
                      "processed": 2,
                      "expiresAt": "2030-01-01T00:00:00.000Z",
                      "results": [
                        {
                          "result": {
                            "status": "accepted",
                            "reason": "rcpt_accepted",
                            "cached": false
                          }
                        },
                        {
                          "error": "invalid_email"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "jobIdの形式が不正です。受付時に発行された小文字のUUID v4を指定してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "invalid_request"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "invalid_request",
                    "value": {
                      "error": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "認証に失敗しました。発行済みの有効なキーをAuthorizationヘッダーに指定してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "unauthorized"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "unauthorized",
                    "value": {
                      "error": "unauthorized"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "このサービスには一括検証の利用権限が付与されていません。サービスの権限を確認してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "forbidden"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "forbidden",
                    "value": {
                      "error": "forbidden"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "このサービスで参照できるジョブが見つからないか、結果の参照期限が切れています。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "not_found"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "not_found",
                    "value": {
                      "error": "not_found"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "リクエストの受付上限に達しました。Retry-Afterに示された秒数が経過してから再試行してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "rate_limited"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "rate_limited",
                    "value": {
                      "error": "rate_limited"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "現在、検証サービスを利用できません。Retry-Afterに示された秒数が経過してから再試行してください。",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Error"
                    },
                    {
                      "properties": {
                        "error": {
                          "const": "unavailable"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "error": {
                    "summary": "unavailable",
                    "value": {
                      "error": "unavailable"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer <APIキー> を指定します。モックAPIではモック専用の試験用キーを使います。"
      }
    },
    "headers": {
      "CacheControl": {
        "description": "結果はHTTPキャッシュに保存しないよう指定します。",
        "required": true,
        "schema": {
          "type": "string",
          "const": "no-store"
        },
        "example": "no-store"
      },
      "RetryAfter": {
        "description": "再試行までの待ち時間を整数秒で返します。",
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 1
        },
        "example": 30
      },
      "BatchPollAfter": {
        "description": "ジョブがpendingの間だけ返します。次の取得まで3秒待ちます。",
        "schema": {
          "type": "integer",
          "const": 3
        },
        "example": 3
      },
      "BatchLocation": {
        "description": "結果取得先の相対参照です。受付リクエストと同じオリジンに対して解決し、GETします。",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uri-reference"
        },
        "example": "/api/v1/email/batches/4c2dd4ee-ff90-47ef-88a8-a412f9639ed7"
      }
    },
    "schemas": {
      "VerifyRequest": {
        "type": "object",
        "required": [
          "email"
        ],
        "additionalProperties": false,
        "properties": {
          "email": {
            "type": "string",
            "description": "例として name@example.test のように指定します。ローカル部はASCIIの最大64文字、正規化後のアドレスは全体で最大254バイトです。空白や表示名を含む書式は受け付けません。ドメインはIDNA ASCIIに変換します。"
          }
        }
      },
      "Verification": {
        "description": "HTTP 200で返る検証結果です。statusに応じてreasonが決まります。",
        "oneOf": [
          {
            "$ref": "#/components/schemas/AcceptedVerification"
          },
          {
            "$ref": "#/components/schemas/LikelyInvalidVerification"
          },
          {
            "$ref": "#/components/schemas/UnknownVerification"
          }
        ]
      },
      "AcceptedVerification": {
        "type": "object",
        "description": "受信側がSMTPの宛先指定を受け付けました。",
        "required": [
          "status",
          "reason",
          "cached"
        ],
        "additionalProperties": false,
        "properties": {
          "status": {
            "type": "string",
            "const": "accepted"
          },
          "reason": {
            "type": "string",
            "enum": [
              "rcpt_accepted"
            ],
            "description": "- `rcpt_accepted` SMTPの宛先指定を受信側が受け付けました。"
          },
          "cached": {
            "type": "boolean",
            "description": "以前の検証結果をキャッシュから返した場合はtrueです。"
          }
        }
      },
      "LikelyInvalidVerification": {
        "type": "object",
        "description": "宛先が無効である可能性があります。確実な到達確認が必要な場合は入力を見直し、確認メールを使ってください。",
        "required": [
          "status",
          "reason",
          "cached"
        ],
        "additionalProperties": false,
        "properties": {
          "status": {
            "type": "string",
            "const": "likely_invalid"
          },
          "reason": {
            "type": "string",
            "enum": [
              "recipient_not_found",
              "null_mx"
            ],
            "description": "- `recipient_not_found` 受信側から宛先が見つからないという応答がありました。\n- `null_mx` ドメインがメールを受け取らないことをMXレコードで明示しています。"
          },
          "cached": {
            "type": "boolean",
            "description": "以前の検証結果をキャッシュから返した場合はtrueです。"
          }
        }
      },
      "UnknownVerification": {
        "type": "object",
        "description": "受信側への照会結果から、受理または無効を判定できませんでした。",
        "required": [
          "status",
          "reason",
          "cached"
        ],
        "additionalProperties": false,
        "properties": {
          "status": {
            "type": "string",
            "const": "unknown"
          },
          "reason": {
            "type": "string",
            "enum": [
              "smtp_temporary",
              "smtp_policy",
              "smtp_unexpected",
              "tls_failed",
              "timeout",
              "connect_failed",
              "dns_error",
              "no_safe_target"
            ],
            "description": "- `smtp_temporary` 受信サーバーから一時エラーが返りました。\n- `smtp_policy` 受信側の制限やポリシーにより判定できませんでした。\n- `smtp_unexpected` 想定外のSMTP応答が返りました。\n- `tls_failed` 暗号化通信を確立できませんでした。\n- `timeout` 検証時間の上限に達しました。\n- `connect_failed` 受信サーバーに接続できませんでした。\n- `dns_error` 宛先ドメインのDNS情報を取得できませんでした。\n- `no_safe_target` 照会先として利用できるメールサーバーが見つかりませんでした。"
          },
          "cached": {
            "type": "boolean",
            "description": "以前の検証結果をキャッシュから返した場合はtrueです。"
          }
        }
      },
      "BatchRequest": {
        "type": "object",
        "required": [
          "emails"
        ],
        "additionalProperties": false,
        "properties": {
          "emails": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "description": "書式不正な宛先も文字列なら受付し、その位置にinvalid_emailを返します。",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "BatchId": {
        "type": "string",
        "format": "uuid",
        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
        "description": "受付時に返る小文字のUUID v4です。"
      },
      "BatchSummary": {
        "type": "object",
        "required": [
          "jobId",
          "status",
          "total",
          "processed",
          "expiresAt"
        ],
        "properties": {
          "jobId": {
            "$ref": "#/components/schemas/BatchId"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "completed"
            ],
            "description": "未処理の項目がある間はpendingです。全項目が判定または個別エラーで確定するとcompletedになります。"
          },
          "total": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "description": "受け付けた項目の総数です。"
          },
          "processed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 50,
            "description": "個別エラーを含む処理済み項目数です。total以下です。"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$",
            "description": "結果の参照期限です。UTCで小数部3桁の形式を使います。本番は受付から24時間です。"
          }
        }
      },
      "BatchDetails": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BatchSummary"
          },
          {
            "type": "object",
            "required": [
              "results"
            ],
            "properties": {
              "results": {
                "type": "array",
                "minItems": 1,
                "maxItems": 50,
                "description": "入力順の配列です。配列の長さはtotal、null以外の項目数はprocessedと一致します。",
                "items": {
                  "$ref": "#/components/schemas/BatchItem"
                }
              }
            }
          }
        ]
      },
      "BatchItem": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/BatchItemResult"
          },
          {
            "$ref": "#/components/schemas/BatchItemError"
          },
          {
            "type": "null",
            "description": "未処理の項目です。"
          }
        ]
      },
      "BatchItemResult": {
        "type": "object",
        "required": [
          "result"
        ],
        "additionalProperties": false,
        "properties": {
          "result": {
            "$ref": "#/components/schemas/Verification"
          }
        }
      },
      "BatchItemError": {
        "type": "object",
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "invalid_email",
              "unavailable",
              "processing_expired"
            ],
            "description": "- `invalid_email` アドレスの書式が不正です。\n- `unavailable` 項目を処理できませんでした。\n- `processing_expired` 受付から30分の処理期限に達しました。"
          }
        }
      },
      "Error": {
        "description": "HTTPリクエスト全体のエラーです。",
        "type": "object",
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "invalid_request",
              "unauthorized",
              "forbidden",
              "not_found",
              "idempotency_conflict",
              "body_too_large",
              "unsupported_media_type",
              "rate_limited",
              "unavailable"
            ]
          }
        }
      }
    }
  }
}
