For Node.js applications, it is recommended to use the official
@antryk/sdk. The SDK simplifies
OTP delivery by handling authentication, validation, retries, and error
handling internally.Authentication is handled via headers (
x-access-key, x-secret-key). The
request body should only include OTP-related fields such as recipient number
and service ID.New OTP Sending Approach (Recommended)
This is the recommended and modern approach for sending OTPs:- Authentication is passed via headers instead of the request body.
- Request body contains only OTP-related parameters.
- Improved security by isolating credentials from payload.
- Cleaner and more maintainable API integration.
⚠️ The older approach (passing
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
Your Antryk access key used to authenticate API requests.
Your Antryk secret key used to securely authorize the request.
Recipient phone number in E.164 format (e.g.
+1XXXXXXXXXX). Only one number
is supported per request.Unique identifier (UUID v4) of your configured SMS verification service.
Examples
Example: YOUR_ACCESS_KEY
Example: YOUR_SECRET_KEY
Example: +919876543210
Example: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
Additional Notes
- Supports secure OTP delivery for login, signup, and transaction verification.
- Each OTP is time-bound and automatically expires after a defined duration.
- Avoid exposing API keys in client-side applications.
- Use server-side integrations or the SDK for better security and reliability.
Successful Response
Returns a JSON object confirming that the OTP has been successfully sent.410 otp_expired.
Error Scenarios
- 401 invalid_credentials – Incorrect x-access-key or x-secret-key
- 400 invalid_recipient – Missing or improperly formatted phone number
- 409 otp_pending – A previously sent OTP is still active
- 429 rate_limited – Too many OTP requests in a short time
- 401 invalid_request – Invalid or missing serviceId
- 500 provider_unavailable – Temporary SMS gateway failure

