Skip to content

Verify a Code

POST /v1/verify/check

Submit the code that the user entered. Returns whether the code is valid.

Request Body

ParameterTypeRequiredDescription
idstringYesThe verification ID returned by POST /v1/verify/send.
codestringYesThe code the user submitted.
bash
curl -X POST https://sendapi.co/v1/verify/check \
  -H "Authorization: Bearer sk_live_123456789" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "ver_01H9...AB",
    "code": "847291"
  }'
javascript
const result = await client.verify.check({
  id: verificationId,
  code: userEnteredCode
});

if (result.valid) {
  // Log the user in
} else {
  console.log(`${result.attempts_remaining} attempts left`);
}
python
result = client.verify.check(
    id=verification_id,
    code=user_entered_code
)

if result.valid:
    # log the user in
    pass

Success Response

json
{
  "id": "ver_01H9...AB",
  "valid": true,
  "verified_at": "2026-03-09T14:31:00Z"
}

Failed Response (Wrong Code)

json
{
  "id": "ver_01H9...AB",
  "valid": false,
  "attempts_remaining": 2
}

Error Responses

HTTP CodeError CodeReason
404verification_not_foundThe id does not exist
410verification_expiredThe OTP TTL has passed
429max_attempts_exceeded5 failed attempts — verification locked

Security

After 5 failed attempts, the verification session is permanently invalidated. The user must request a new OTP to try again. This prevents brute-force attacks.

Released under the MIT License.