For Node.js applications, it is recommended to use the official
@antryk/sdk. The SDK simplifies
OTP verification by handling authentication, validation, and error handling
internally.Authentication is handled via headers (
x-access-key, x-secret-key). The
request body should only include OTP verification data such as phone number,
service ID, and the OTP code.New OTP Verification Approach (Recommended)
This is the recommended and modern approach for verifying OTPs:- Authentication is passed via headers instead of request body.
- Request body contains only verification-related fields.
- Improved security and cleaner API design.
- Easier integration across backend services.
⚠️ The older approach (sending
accessKey and secretKey in the request
body) may still work for backward compatibility, but it is strongly
recommended to migrate to header-based authentication.Request Parameters
string
required
Your Antryk access key used for authentication.
string
required
Your Antryk secret key used to authorize the request securely.
string
required
The phone number (in E.164 format, e.g.
+919876543210) that received the
OTP.string
required
UUID v4 identifier of your configured SMS verification service.
string
required
The OTP code entered by the user. Must be a 4–10 digit numeric value.
Examples
string
required
Example: YOUR_ACCESS_KEY
string
required
Example: YOUR_SECRET_KEY
string
required
Example: +919876543210
string
required
Example: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
string
required
Example: 482193
Additional Notes
- OTP verification is a critical step in authentication workflows.
- Ensure that verification is performed securely on the backend.
- Avoid exposing sensitive validation logic on the frontend.
- Use retry limits and session-based controls to enhance security.
- SDK usage is recommended for simplified integration and consistent error handling.
Response
Returns a JSON object indicating whether the OTP is valid and verifiedError Scenarios
- 400 otp_invalid – Incorrect or invalid OTP entered
- 404 otp_not_found – No pending OTP found for the given number and service
- 401 invalid_credentials – Invalid x-access-key or x-secret-key
- 410 otp_expired – OTP exists but has expired
- 429 rate_limited – Too many verification attempts in a short time

