Verify code

Request

POST https://api.cm.com/otp/v2/otp/{id}/verify

HTTP headers

HeaderDescription
X-CM-ProductTokenYour product token. Retrieve from Messaging Gateway app.
Content-Typeapplication/json

Request body

{
    "code": "12345"
}

URL parameter

ParameterTypeDescription
idstringThe identifier for the OTP, returned in the response after creating the OTP.

Parameter

ParameterTypeDescription
codestringThe code received via the specified channel.

Response

{
    "id": "1e12cb10-d14a-4cd6-8d86-e5263cf122ee",
    "channel": "sms",
    "verified": true,
    "createdAt": "2022-01-01T13:00:00+0000",
    "expiresAt": "2022-01-01T13:01:00+0000"
}

๐Ÿ“˜

Once a code has been successfully validated, it cannot be validated again.

Parameters

ParameterDescription
idThe identifier of the OTP.
channelThe channel used to send the code.
verifiedIndicates if the code was valid.
createdAtThe date the OTP was created.
expiresAtThe date the OTP will expire.

Response codes

HTTP statusDescription
200Successful request.
400Invalid request, see message in the response.
404The OTP was not found.
500Unknown error occurred.