POST
/otp/send
application/json
POST /otp/send HTTP/1.1Content-Type: application/jsonAuthorization: Basic VEVOQU5UX0NMSUVOVF9JRDpURU5BTlRfQ0xJRU5UX1NFQ1JFVA==Host: sample.portal.tencentciam.com{"usage" : "login","phone_number" : "13612345678","auth_source_id" : "MOCK_SMS_OTP_AUTH_SOURCE_ID"}
POST /otp/send HTTP/1.1Content-Type: application/jsonAuthorization: Basic Q0xJRU5UXzRfSUQ6Q0xJRU5UXzRfU0VDUkVUHost: sample.portal.tencentciam.com{"usage" : "login","email" : "MOCK_USERNAME@example.com","auth_source_id" : "MOCK_EMAIL_OTP_AUTH_SOURCE_ID"}
POST /otp/send HTTP/1.1Content-Type: application/jsonAuthorization: Basic Q0xJRU5UXzRfSUQ6Q0xJRU5UXzRfU0VDUkVUHost: sample.portal.tencentciam.com{"usage" : "signup","phone_number" : "13612345678"}
POST /otp/send HTTP/1.1Content-Type: application/jsonAuthorization: Basic Q0xJRU5UXzRfSUQ6Q0xJRU5UXzRfU0VDUkVUHost: sample.portal.tencentciam.com{"usage" : "signup","email" : "MOCK_USERNAME@example.com"}
POST /otp/send HTTP/1.1Content-Type: application/jsonAuthorization: Basic Q0xJRU5UXzRfSUQ6Q0xJRU5UXzRfU0VDUkVUHost: sample.portal.tencentciam.com{"usage" : "update_userinfo","phone_number" : "13612345678"}
POST /otp/send HTTP/1.1Content-Type: application/jsonAuthorization: Basic Q0xJRU5UXzRfSUQ6Q0xJRU5UXzRfU0VDUkVUHost: sample.portal.tencentciam.com{"usage" : "reset_password","email" : "MOCK_USERNAME@example.com"}
Parameter | Description |
Authorization | HTTP Basic authentication request header. The format is Basic <credentials> , where Basic is a fixed string and <credentials> is calculated by base64(url_encode(client_id) + ":" + url_encode( client_secret)) . Basic and <credentials> are separated by a space. |
JSON Path | Data Type | Description |
usage | String | The use case of the OTP verification code. Enter login for OTP login by SMS or email. Enter signup for user sign-up. Enter update_userinfo for updating user information. Enter reset_password for resetting user password. If this parameter is not specified, it defaults to login. |
phone_number | String | The user's mobile number, which should be an 11-digit mobile number of the three major carriers in Chinese mainland. This parameter is required for sending SMS OTP verification code. |
email | String | The user's email address. This parameter is required for sending email OTP verification code. |
auth_source_id | String | The ID of the authentication source for OTP by SMS or email. It can be viewed on the general authentication source list of the console. This parameter is required for OTP login by SMS or email. The length and validity period of the verification code in the authentication source configuration will be used. In other scenarios, this parameter is left empty. A 6-digit verification code will be used by default, which is valid for 60 seconds. |
HTTP/1.1 200 OKContent-Type: application/json{"otp_token" : "MOCK_OTP_TOKEN"}
Parameter | Data Type | Description |
otp_token | String | OTP token, which is used in OTP verification. This is valid for 5 minutes. |
HTTP/1.1 400 Bad RequestContent-Type: application/json;charset=UTF-8{"error" : "malformed_phone_number"}
HTTP/1.1 400 Bad RequestContent-Type: application/json;charset=UTF-8{"error" : "malformed_email"}
HTTP/1.1 400 Bad RequestContent-Type: application/json;charset=UTF-8{"error" : "insufficient_sms_quota"}
HTTP/1.1 400 Bad RequestContent-Type: application/json;charset=UTF-8{"error" : "insufficient_email_quota"}
HTTP/1.1 400 Bad RequestContent-Type: application/json;charset=UTF-8{"error" : "invalid_email"}
HTTP/1.1 503 Service UnavailableContent-Type: application/json;charset=UTF-8{"error" : "temporarily_unavailable","error_description" : "Failed to send OTP. Please try again later."}
HTTP/1.1 400 Bad RequestContent-Type: application/json;charset=UTF-8{"error": "email_is_used"}
HTTP/1.1 400 Bad RequestContent-Type: application/json;charset=UTF-8{"error": "phone_number_is_used"}
HTTP/1.1 400 Bad RequestContent-Type: application/json;charset=UTF-8{"error" : "sms_rate_limit_exceeded","error_description" : "SMS rate limit exceeded for same phone number"}
Was this page helpful?