Verify (OTP check)
API for creating and verifying one-time passwords (OTP) via SMS, Email and other channels.
POST requests must include the header Content-Type: application/json. Code verification (verify) also supports the GET method.
Create code — synchronous
Creates a verification code and sends it via SMS or Email. The gateway processes the request immediately and returns verify_id.
URI: /api/verify.php
HTTP method: POST
Request parameters
Request example
{
"auth": "API_KEY",
"command": "verify/create",
"phone": "441501234567",
"type": "sms",
"sender_name": "MyBrand",
"lang": "en",
"code_length": 6,
"code_type": "numeric",
"service_id": 1,
"custom_id": "abcdef1234567",
"hook": "https://example.com/webhook"
}
Example response:
{
"success": true,
"verify_id": "14fb5f3d-20be-41ef-b31a-b9f5e499bc7a"
}
HTTP errors: 400 (invalid format/JSON), 401 (invalid auth), 413 (request body too large).
Verify code
URI: /api/verify.php
This request checks the code entered by the user and returns the verification status (only the sync API).
Request parameters
Request example (GET)
/api/verify.php?auth=API_KEY&command=verify&phone=380501234567&code=123456&verify_id=14fb5f3d-20be-41ef-b31a-b9f5e499bc7a
Request example (POST, JSON)
{
"auth": "API_KEY",
"command": "verify",
"phone": "380501234567",
"code": "123456",
"verify_id": "14fb5f3d-20be-41ef-b31a-b9f5e499bc7a"
}
Example of a successful response:
{
"success": true,
"verify_id": "14fb5f3d-20be-41ef-b31a-b9f5e499bc7a",
"phone": "441501234567",
"type": "sms",
"status": "approved",
"service_id": 1
}
Possible values of status:
| status | Description |
|---|---|
approved | Code is correct, verification successful |
pending | Code is incorrect, but attempts are still available |
expired | Code has expired |
blocked | Attempt limit exceeded |
HTTP error codes:
400— invalid request format or JSON401— missing or invalid auth413— request body too large
Limits
- Code lifetime: by default 300 seconds (5 minutes), range 60–3600 seconds.
- Maximum attempts: by default 5.