Skip to main content

Verify (OTP check)

API for creating and verifying one-time passwords (OTP) via SMS, Email and other channels.

Endpoint: <ApiUrl/>/api/verify.php

POST requests must include the header Content-Type: application/json. Code verification (verify) also supports the GET method.


Create code (verify/create)

Creates a verification code and sends it via SMS or Email.
The request is accepted into the queue for processing; in response you immediately receive success and request_id.

HTTP method: POST

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,
"request_id": "cf-ray-1234567890-ABC"
}

HTTP errors: 400 (invalid format/JSON), 401 (invalid auth), 413 (request body too large), 503 (queue unavailable).


Verify code (verify)

This request checks the code entered by the user and returns the verification status.

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:

statusDescription
approvedCode is correct, verification successful
pendingCode is incorrect, but attempts are still available
expiredCode has expired
blockedAttempt limit exceeded

HTTP error codes:

  • 400 — invalid request format or JSON
  • 401 — missing or invalid auth
  • 413 — request body too large

Call examples (curl)

verify/create (SMS):

curl -X POST https://portal.interconnect.solutions/api/verify.php \
-H "Content-Type: application/json" \
-d '{
"auth": "your-api-key",
"command": "verify/create",
"phone": "441501234567",
"type": "sms",
"sender_name": "MyBrand",
"lang": "en",
"code_length": 6
}'

verify/create (Email):

curl -X POST https://portal.interconnect.solutions/api/verify.php \
-H "Content-Type: application/json" \
-d '{
"auth": "your-api-key",
"command": "verify/create",
"email": "[email protected]",
"type": "email",
"lang": "en",
"code_length": 8
}'

verify (code check), GET:

curl "https://portal.interconnect.solutions/api/verify.php?auth=your-api-key&command=verify&phone=441501234567&code=123456&verify_id=14fb5f3d-20be-41ef-b31a-b9f5e499bc7a"

verify (code check), POST:

curl -X POST https://portal.interconnect.solutions/api/verify.php \
-H "Content-Type: application/json" \
-d '{
"auth": "your-api-key",
"command": "verify",
"phone": "441501234567",
"code": "123456",
"verify_id": "14fb5f3d-20be-41ef-b31a-b9f5e499bc7a"
}'

Limits

  • Code lifetime: by default 300 seconds (5 minutes), range 60–3600 seconds.
  • Maximum attempts: by default 5.