Upgrade guide

Upgrade from v1 to v2

Create code

Request

  • The URL has changed from https://api.cm.com/v1.0/otp/generate to https://api.cm.com/otp/v2/otp.
  • recipient has been renamed to to and now requires a phone number in E.164 format or a valid email address when channel is set to email.
  • sender has been renamed to from and now requires a phone number in E.164 format when channel is voice. For channel sms and push it also accepts an alphanumeric string between 3 and 11 characters.
  • length has been renamed to digits.
  • allowPush is no longer used and is replaced by channel push
  • appKey has been renamed to pushAppKey and is only used and required when channel is set to push.
  • allowVoice is no longer used and is replaced by channel voice
  • voiceLanguage has been renamed to locale and now requires a locale code instead of a language code.

Response

  • expireAt has been renamed to expiresAt

Verify code

Request

  • The URL has changed from https://api.cm.com/v1.0/otp/verify to https://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 to verified.
  • id, channel, createdAt and exiresAt are also returned