Skip to content

Verify API ​

Verify sends one-time codes by SMS or email and checks the code the person types. MsGine generates the code, sends it, expires it and limits the attempts, so your system never stores a code.

All paths are under https://api.msgine.net/api/v1. Every endpoint needs the VERIFY scope (FULL_ACCESS also works).

MethodPathPurpose
POST/developers/verifySend a code
POST/developers/verify/:id/checkCheck a code against a verification
POST/developers/verify/checkCheck a code against the recipient's latest verification
GET/developers/verify/:idRead a verification
POST/developers/verify/:id/resendSend the same code again
POST/developers/verify/:id/cancelCancel a pending verification

Send a code ​

bash
curl -X POST https://api.msgine.net/api/v1/developers/verify \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+256701234567",
    "channel": "sms",
    "appName": "Acme"
  }'
ParameterTypeRequiredDescription
tostringYesPhone number for sms (+256…, 256… or 07…), email address for email
channelstringYessms or email
appNamestringYesYour app's name in the message, 1 to 30 letters, digits, spaces or . & ' -
codeLengthnumberNo4 to 8 digits. Default 6
expiresInnumberNoSeconds the code is valid, 60 to 1800. Default 600
fromstringNoSMS: your approved sender ID (default MsGine). Email: an address on your verified domain
androidAppHashstringNoYour Android app's 11-character SMS Retriever hash, so the app reads the code itself
idempotencyKeystringNoUp to 100 characters. Retrying with the same key returns the first result

The person receives:

482913 is your Acme verification code. It expires in 10 minutes. Do not share it.

Status Code: 200 OK

json
{
  "id": "1f72f4c5-4646-4940-aca0-8235999e2a31",
  "to": "+2567••••4567",
  "channel": "sms",
  "status": "pending",
  "attemptsLeft": 5,
  "sendsLeft": 2,
  "expiresAt": "2026-12-02T13:51:59.601Z",
  "approvedAt": null,
  "sandbox": false,
  "createdAt": "2026-12-02T13:41:59.601Z"
}

Starting again for a recipient that already has a pending verification sends the same code again and returns that verification, so a double tap on "Send code" never sends two different codes.

Check a code ​

bash
curl -X POST https://api.msgine.net/api/v1/developers/verify/1f72f4c5-4646-4940-aca0-8235999e2a31/check \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "code": "482913" }'
ParameterTypeRequiredDescription
codestringYes4 to 8 digits

Status Code: 200 OK, for a right or a wrong code

json
{
  "id": "1f72f4c5-4646-4940-aca0-8235999e2a31",
  "to": "+2567••••4567",
  "channel": "sms",
  "status": "approved",
  "attemptsLeft": 4,
  "sendsLeft": 2,
  "expiresAt": "2026-12-02T13:51:59.601Z",
  "approvedAt": "2026-12-02T13:42:30.118Z",
  "sandbox": false,
  "createdAt": "2026-12-02T13:41:59.601Z",
  "valid": true
}

valid says whether the code matched. A wrong code returns valid: false with attemptsLeft; after the fifth wrong code status becomes failed. A code is accepted once: checking an approved, failed or cancelled verification returns verification_closed, and an expired one verification_expired.

If you do not keep the verification id, check by recipient instead. It uses the latest verification for that number or address:

bash
curl -X POST https://api.msgine.net/api/v1/developers/verify/check \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": "0701234567", "code": "482913" }'

Resend, read and cancel ​

POST /developers/verify/:id/resend sends the same code again. Each verification can be sent three times, at least 30 seconds apart; sooner returns verify_rate_limited with Retry-After, a fourth send verification_send_limit.

GET /developers/verify/:id returns the verification. POST /developers/verify/:id/cancel cancels a pending one; the code stops working at once.

Statuses ​

StatusMeaning
pendingSent, waiting for the right code
approvedThe right code was entered
failedFive wrong codes
expiredThe time ran out
canceledCancelled with /cancel

Limits ​

LimitValue
Wrong codes per verification5
Sends per verification3, at least 30 seconds apart
Codes per number, per account5 every 10 minutes
Codes per account5,000 an hour (ask support to raise it)
SMS destinationsUganda (+256); other countries on request

A request over a limit returns 429 verify_rate_limited with a Retry-After header. A number in a country that is not enabled returns country_not_allowed before anything is sent or charged.

Webhooks ​

Subscribe a webhook to verification.approved or verification.failed:

json
{
  "event": "verification.approved",
  "channel": "verification",
  "messageId": "1f72f4c5-4646-4940-aca0-8235999e2a31",
  "timestamp": "2026-12-02T13:42:30.118Z",
  "data": {
    "verificationId": "1f72f4c5-4646-4940-aca0-8235999e2a31",
    "to": "+256701234567",
    "channel": "sms",
    "status": "approved",
    "attempts": 1,
    "sends": 1
  }
}

Privacy ​

The code never appears in API responses, webhooks or your message history. Message history shows ****** is your Acme verification code…, and the body of a verification email is blanked once the verification closes.

Price ​

Each code sent is charged at its channel's price (SMS UGX 30, email from your bundle), plus UGX 20 when a code is approved (UGX 10 above 100,000 approved verifications in a month). Nothing is charged for a code refused by a limit.

Testing ​

Sandbox keys send nothing and charge nothing, and accept a code of zeros (000000 for six digits).

SDKs ​

The SDKs wrap these endpoints as verify.start, verify.check, verify.checkRecipient, verify.get, verify.resend and verify.cancel.

Released under the MIT License.