Skip to content
Create an account

OTP: verify a code

OTP: verify a code #

POST /v1/otp/verify
POST /otp/verify

Check the code your user typed in.

Parameters

Parameter Type Required Description
otp_id string Yes The OTP ID you got back when sending the code (UUID)
code string Yes The code your user typed in (4-16 characters)

Example request

// Vérifier un code OTP
const credentials = btoa('ACCESS_KEY:ACCESS_SECRET');
const res = await fetch('https://api.callistosignal.com/v1/otp/verify', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Basic ' + credentials
    },
    body: JSON.stringify({
        otp_id: '550e8400-e29b-41d4-a716-446655440000',
        code: '123456'
    })
});
// Vérifier un code OTP
$ch = curl_init('https://api.callistosignal.com/v1/otp/verify');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_USERPWD        => 'ACCESS_KEY:ACCESS_SECRET',
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'otp_id' => '550e8400-e29b-41d4-a716-446655440000',
        'code'   => '123456',
    ]),
]);
$response = curl_exec($ch);
curl -u 'ACCESS_KEY:ACCESS_SECRET' \
  -X POST https://api.callistosignal.com/v1/otp/verify \
  -H 'Content-Type: application/json' \
  -d '{
    "otp_id": "550e8400-e29b-41d4-a716-446655440000",
    "code": "123456"
  }'

Response (success)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "verified",
  "verified": true,
  "verified_at": "2026-04-07T10:32:15Z"
}

Response (failure)

{
  "message": "Invalid OTP code. 2 attempts remaining"
}

OTP error codes

Code Description
400 Wrong code. The message tells how many attempts are left.
400 Code expired
400 Three wrong codes already entered: the OTP is locked
404 OTP not found: the otp_id does not exist, belongs to another organization or is not a UUID. The message is the same in all three cases.