Upgrade guide
Upgrade from v1 to v2
Create code
Request
- The URL has changed from
https://api.cm.com/v1.0/otp/generate
tohttps://api.cm.com/otp/v2/otp
. recipient
has been renamed toto
and now requires a phone number in E.164 format or a valid email address when channel is set toemail
.sender
has been renamed tofrom
and now requires a phone number in E.164 format when channel is voice. For channelsms
andpush
it also accepts an alphanumeric string between 3 and 11 characters.length
has been renamed todigits
.allowPush
is no longer used and is replaced by channelpush
appKey
has been renamed topushAppKey
and is only used and required when channel is set topush
.allowVoice
is no longer used and is replaced by channelvoice
voiceLanguage
has been renamed tolocale
and now requires a locale code instead of a language code.
Response
expireAt
has been renamed toexpiresAt
Verify code
Request
- The URL has changed from
https://api.cm.com/v1.0/otp/verify
tohttps://api.cm.com/otp/v2/otp/{id}/verify
, where {id} is the placeholder for the code identifier. - The OTP id is now provided in the URL instead of the request body.
- When the OTP cannot be found a 404 error is returned.
- When the OTP is expired, already verified or has too many verification attempts a 400 error is returned.
Response
valid
has been renamed toverified
.id
,channel
,createdAt
andexiresAt
are also returned
Updated 5 months ago