Skip to main content

邮件 OTP

邮件 OTP 发送一次性验证码。实际方法是 POST https://api.verifik.co/v2/communication/email,不是 GET。正文必须有 project、validationMethod(manual 或 verificationCode)、email 和 type(validation、login、onboarding 或 oneTimeLink)。可选字段包括 expiresAt、redirectUrl、webhookUrl、identityUrl、requires2FA、ipAddress 和 language。

调用返回的内容​

  • email 与 status
  • type 与 validationMethod

使用场景​

  • 向邮箱发送登录验证码。
  • 开始通过邮件继续的准入。
  • 附上投递状态的 webhook。

API 参考​

Endpoint​

POST https://api.verifik.co/v2/communication/email

发送成功会返回状态为 sent 的邮件验证。用项目已有的邮件验证接口确认验证码。

Headers​

名称值说明
Content-Typeapplication/json请求格式
Acceptapplication/json响应格式
AuthorizationBearer <token>客户端 JWT

Parameters​

名称类型必填示例说明
projectstring是project_id拥有邮件 OTP 的项目 id。
validationMethodstring是verificationCodemanual 或 verificationCode。
emailstring是person@example.com接收验证码的邮箱。地址无效时为 409。
typestring是validationvalidation、login、onboarding 或 oneTimeLink。

Request​

import axios from "axios";

const options = {
method: "POST",
url: "https://api.verifik.co/v2/communication/email",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: "Bearer <your_token>",
},
data: {
"project": "project_id",
"validationMethod": "verificationCode",
"email": "person@example.com",
"type": "validation"
},
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error.response ? error.response.data : error.message);
}

Response​

{
"data": {
"email": "person@example.com",
"status": "sent",
"type": "validation",
"validationMethod": "verificationCode"
},
"signature": {
"dateTime": "November 27, 2026 12:00 PM",
"message": "Certified by Verifik.co"
}
}

说明​

  • 本路由是 POST,不是 GET。
  • project、validationMethod、email 和 type 必填。
  • 不是邮箱的地址为 409。
  • 在 Authorization 头中发送 Bearer JWT。
  • JSON 示例只说明字段形状。实际调用返回你所发送数值对应的记录。
  • 不要发送绕过缓存的标志。本页只记录客户端参数。

沙盒​

场景参数结果
数据源有记录the example body验证码发出时为 200。
缺少必填值Omit project409 MissingParameter。
未知的值email: "not-an-email"邮箱格式无效时为 409。

401 when the bearer token is missing or rejected.