API Reference v1.0

NextEdu OTP Gateway

High-performance, secure OTP delivery and verification service for applications, portals, and student verification.

Home User Portal → Admin Console Quickstart

1. Overview & Base URL

All API endpoints require authentication via an API Key provided in the X-API-Key request header. All requests must use HTTPS and submit JSON-encoded payloads.

Base URLs

Production & Development Gateway Endpoints
Production API Base:  https://api.nextedu.live/v1
Local API Base:       https://api.nextedu.live/v1

2. Authentication

Authenticate requests by passing your live API key in the X-API-Key HTTP header.

Header Example
X-API-Key: NE_live_8f72a394bc881940ef9012cd
Content-Type: application/json

* Bearer token format is also accepted: Authorization: Bearer NE_live_...

3. Send OTP

Dispatches a 6-digit numeric verification code to an Indian 10-digit mobile number.

POST /v1/otp/send

Request Headers

Header Type Required Description
X-API-Key string Yes Your assigned NE_live_... key
Content-Type string Yes application/json

Request Body

JSON Payload
{
    "phone": "9876543210"
}

Success Response (HTTP 200)

{
    "success": true,
    "message": "OTP sent successfully"
}

Rate Limited / Cooldown Response (HTTP 429)

{
    "success": false,
    "error": "Please wait before requesting another OTP.",
    "retry_after": 42
}

4. Verify OTP

Validates a 6-digit verification code entered by the user.

POST /v1/otp/verify

Request Body

JSON Payload
{
    "phone": "9876543210",
    "otp": "123456"
}

Success Response (HTTP 200)

{
    "success": true,
    "message": "OTP verified successfully"
}

Invalid Code Response (HTTP 400)

{
    "success": false,
    "error": "Invalid or expired OTP."
}

5. Rate Limits & Error Codes

To prevent abuse, the gateway enforces multi-layer protection:

HTTP Status Meaning Explanation
200 OK Success Operation completed successfully.
400 Bad Request Invalid Request Invalid phone number, invalid 6-digit OTP format, or expired code.
401 Unauthorized Invalid API Key API key is missing or invalid.
402 Payment Required Insufficient Balance Client wallet balance is below ₹0.10. Recharge required to continue dispatching OTPs.
403 Forbidden Access Denied / Pending Client account or key is disabled, expired, or pending Admin approval.
429 Too Many Requests Rate Limited Cooldown in effect or rate limit quota exceeded. Includes retry_after.
502 Bad Gateway Upstream Failure Upstream provider telecommunication error.

6. Pricing & Dual-Server High Availability

NextEdu Gateway operates on a transparent, pay-as-you-go micro-billing model:

7. Code Examples & SDKs

Python 3 (Requests)

python_example.py
import requests

API_KEY = "NE_live_xxxxxxxxxxxxxxxxxxxxxxxx"
BASE_URL = "https://api.nextedu.live/v1"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json"
}

# 1. Send OTP
send_res = requests.post(
    f"{BASE_URL}/otp/send",
    headers=headers,
    json={"phone": "9876543210"}
)
print("Send Response:", send_res.json())

# 2. Verify OTP
verify_res = requests.post(
    f"{BASE_URL}/otp/verify",
    headers=headers,
    json={"phone": "9876543210", "otp": "123456"}
)
print("Verify Response:", verify_res.json())

PHP (cURL)

php_example.php
<?php
$apiKey = 'NE_live_xxxxxxxxxxxxxxxxxxxxxxxx';
$baseUrl = 'https://api.nextedu.live/v1';

function callGateway($url, $payload, $apiKey) {
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Content-Type: application/json',
        'X-API-Key: ' . $apiKey
    ]);
    $res = curl_exec($ch);
    curl_close($ch);
    return json_decode($res, true);
}

// Send OTP
$sendResult = callGateway("$baseUrl/otp/send", ['phone' => '9876543210'], $apiKey);
print_r($sendResult);

// Verify OTP
$verifyResult = callGateway("$baseUrl/otp/verify", ['phone' => '9876543210', 'otp' => '123456'], $apiKey);
print_r($verifyResult);

JavaScript (Fetch API)

javascript_example.js
const API_KEY = "NE_live_xxxxxxxxxxxxxxxxxxxxxxxx";
const BASE_URL = "https://api.nextedu.live/v1";

// 1. Send OTP
async function sendOtp(phone) {
    const res = await fetch(`${BASE_URL}/otp/send`, {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
            "X-API-Key": API_KEY
        },
        body: JSON.stringify({ phone })
    });
    return await res.json();
}

// 2. Verify OTP
async function verifyOtp(phone, otp) {
    const res = await fetch(`${BASE_URL}/otp/verify`, {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
            "X-API-Key": API_KEY
        },
        body: JSON.stringify({ phone, otp })
    });
    return await res.json();
}