⚡ 5-Minute Quickstart
How any creator or agency can launch a fully customized website powered by BeTutor.
Register on BeTutor
Sign up in the platform portal. You will receive your unique Academy Slug (e.g. nodestudio).
Upload Courses & Shop Items
Publish video courses and digital products. Enter your Razorpay API Key ID & Secret in Payment Settings.
Clone Starter & Deploy
Use our Next.js white-label starter kit. Set 3 environment variables and deploy to Vercel or Cloudflare.
NEXT_PUBLIC_ORG_SLUG=nodestudio NEXT_PUBLIC_API_URL=https://api.betutor.in NEXT_PUBLIC_RAZORPAY_KEY_ID=rzp_live_yourRazorpayKeyId
🛡️ Tenant Isolation & Security
How your content is protected and scoped automatically.
🔒 Multi-Tenant Scoping: All requests are strictly scoped by orgId. Queries for courses, digital assets, and transactions only execute within the boundary of your academy. Another academy cannot see or modify your data.
🛡️ Two-Tier Content Gating: Public visitors can view syllabus outlines, descriptions, and thumbnails. Full video streaming URLs and Cloudflare R2 download tokens are only issued to students who have verified enrollments or payments.
💳 Direct Payouts: When payments occur, the backend loads the academy's own Razorpay keys server-side. Funds flow directly to the creator's account.
🎨 Academy Branding & Theme
Retrieve your academy logo, name, and brand color palette dynamically.
Returns public whitelisted branding details. Call this during SSR or app initialization to theme your website.
curl -X GET "https://api.betutor.in/api/storefront/nodestudio/config"
📚 Course Catalog
Fetch published courses with pagination and category filtering.
Supports query parameters: ?page=1&limit=12&category=Design&tag=Figma.
const res = await fetch(`https://api.betutor.in/api/storefront/${ORG_SLUG}/courses?limit=12`);
const { courses, pagination } = await res.json();
📖 Course Details & Curriculum Outline
Get course syllabus outline with module and lesson counts.
Returns full course metadata and nested published curriculum (sections with ordered lectures, descriptions, actual durations in seconds, duration coverage, and preview availability). Protected full-video URLs and stream IDs are strictly omitted.
const res = await fetch(`https://api.betutor.in/api/storefront/${ORG_SLUG}/courses/course_uuid`);
const course = await res.json();
// course.curriculum -> [{ id, title, order, lessonCount, lectureCount, totalDuration, durationCoverage, lectures: [{ id, title, description, contentType, order, duration, isFreePreview, previewAvailable, previewEndpoint }] }]
Resolves a short-lived signed preview playback URL on demand when a visitor clicks Preview on a previewAvailable: true lecture. Returns 403 for non-preview or locked lessons.
const res = await fetch(`https://api.betutor.in/api/storefront/${ORG_SLUG}/courses/${courseId}/lessons/${lessonId}/preview`);
const { url, thumbnail, contentType, duration } = await res.json();
📦 Course Bundles (Multi-Course Packages)
Sell multi-course bundles with discounted package pricing and calculated student savings.
Returns all active published course bundles for this academy. Each bundle includes effective price, regular sum price, calculated savings amount/percentage, instructor details, and included course metadata.
const res = await fetch(`https://api.betutor.in/api/storefront/${ORG_SLUG}/bundles?limit=12`);
const { bundles, pagination } = await res.json();
Returns full details of a specific course bundle by its ID or URL slug, including all included courses, section counts, and lesson counts.
const res = await fetch(`https://api.betutor.in/api/storefront/${ORG_SLUG}/bundles/video-editing-pack`);
const { bundle } = await res.json();
Creates a Razorpay checkout order for a course bundle purchase. After payment, verify via /api/payments/bundle/verify to enroll student in all bundled courses automatically.
POST /api/payments/bundle/create-order
Authorization: Bearer <student_token>
X-Org-Slug: nodestudio
{
"bundleId": "bundle_uuid_here",
"couponCode": "COMBO10", // optional
"phone": "9876543210" // required if the student has no saved mobile number
}
// Response:
{
"orderId": "order_Rz91X0aB8c",
"amount": 2999,
"currency": "INR",
"keyId": "rzp_live_yourRazorpayKey",
"purchaseId": "…",
"customerId": "cust_PQ81aZ0bT3",
"prefill": { "name": "Ravi Kumar", "email": "ravi@gmail.com", "contact": "9876543210" }
}
🛍️ LMS Shop (Digital Assets & Downloads)
Sell downloadable eBooks, software, templates, and boilerplates.
List digital products available for sale in this academy's shop.
curl -X GET "https://api.betutor.in/api/assets/public" \
-H "X-Org-Slug: nodestudio"
🔐 Student Authentication (Email OTP & Google)
Students sign in with a one-time code sent to their email, or with their Google account. Both methods use the same account when the email matches.
Sends a 6-digit OTP code to the student's email address.
POST /api/auth/send-otp
Content-Type: application/json
X-Org-Slug: nodestudio
{ "email": "student@example.com" }
Verifies the OTP code and returns the JWT Bearer access token.
POST /api/auth/verify-otp
Content-Type: application/json
X-Org-Slug: nodestudio
{
"email": "student@example.com",
"otp": "123456"
}
// Response:
{
"token": "eyJhbGciOiJIUzI1NiIs...",
"user": {
"id": "usr_9981",
"email": "student@example.com",
"role": "student"
}
}
Starts "Continue with Google". Send the browser to this URL; after consent, BeTutor redirects back to
{origin}/oauth-callback?token=…&refreshToken=…. The origin must be a BeTutor subdomain or one of the academy's ACTIVE custom domains.
For Google One Tap, POST the ID token to /api/auth/google/verify instead.
// Redirect flow GET /api/auth/google?orgId=nodestudio&origin=https://learn.myacademy.com&redirect=/dashboard // One Tap / Credential Manager POST /api/auth/google/verify Content-Type: application/json { "credential": "<google_id_token>", "orgId": "nodestudio" } // Response: { "success": true, "accessToken": "eyJhbGciOiJIUzI1NiIs...", "refreshToken": "c1f0…", "user": { "id": "…", "email": "student@gmail.com", "name": "Ravi Kumar", "avatar": "https://lh3.googleusercontent.com/…", "role": "student", "orgId": "nodestudio" } }
Account linking rules
- One account per email. A student who registers with email OTP and later uses "Continue with Google" with the same Gmail gets the same account (same enrollments, purchases and progress). The reverse is also true.
- Name & profile photo. On first Google sign-in the account takes the Google name and photo. Later Google sign-ins only fill these if they are empty; a name or photo the student changed is never overwritten. Email-OTP sign-ups start without a photo until the student adds one or signs in with Google.
- Mobile number. Neither login method asks for a mobile number. It is collected and required at the first paid checkout (see Email + Mobile Rules) and saved to the profile.
💳 Payments & Razorpay Checkout
Create orders and cryptographically verify payments server-side.
Email + mobile number are mandatory on every paid checkout
- The email always comes from the logged-in student's account. Guest product checkout must send
email. - Send
phonein the create-order body when the student has no saved number. Accepted: 10-digit Indian mobile (starts 6–9), with or without+91; international numbers need a+prefix. It is saved to the profile and must be unique within the academy. - The response includes
customerIdandprefill. Pass both to Razorpay Checkout so Razorpay records the real email and mobile (otherwise it can store a placeholder such asvoid@razorpay.com). - Free courses and 100% coupons do not require a mobile number.
// Error responses (HTTP 400): show a mobile-number field and retry
{ "code": "PHONE_REQUIRED", "message": "Mobile number is required to complete your purchase." }
{ "code": "PHONE_INVALID", "message": "Please enter a valid 10-digit mobile number." }
{ "code": "PHONE_IN_USE", "message": "This mobile number is already used by another student in this academy." }
{ "code": "EMAIL_REQUIRED", "message": "Please enter a valid email address." }
Creates a Razorpay order using the academy's own credentials. If the course is free or has a 100% coupon, the user is automatically enrolled immediately without opening payment.
POST /api/payments/create-order
Authorization: Bearer <student_token>
X-Org-Slug: nodestudio
{
"courseId": "course_uuid",
"couponCode": "WELCOME50",
"phone": "9876543210" // required if the student has no saved mobile number
}
// Response:
{
"orderId": "order_NXK201aLp831Q",
"amount": 1499,
"discount": 500,
"key": "rzp_live_abc123",
"customerId": "cust_PQ81aZ0bT3", // may be null; pass to Razorpay as customer_id
"prefill": { "name": "Ravi Kumar", "email": "ravi@gmail.com", "contact": "9876543210" }
}
Verifies the HMAC-SHA256 signature returned by Razorpay. On successful verification, the student is automatically enrolled and instructor earnings are recorded.
POST /api/payments/verify
Authorization: Bearer <student_token>
X-Org-Slug: nodestudio
{
"razorpay_order_id": "order_NXK201aLp831Q",
"razorpay_payment_id": "pay_NXK309bMa923R",
"razorpay_signature": "signature_hash"
}
// Response:
{ "message": "Payment verified successfully" }
Client-Side Razorpay Integration Snippet
Include <script src="https://checkout.razorpay.com/v1/checkout.js"></script> in your website:
let order;
try {
order = await paymentApi.createOrder({ courseId, phone: savedOrEnteredMobile });
} catch (err) {
const code = err.response?.data?.code;
if (code === "PHONE_REQUIRED" || code === "PHONE_INVALID" || code === "PHONE_IN_USE") {
return askForMobileNumberThenRetry(err.response.data.message);
}
throw err;
}
if (order.isFree) {
alert("Enrolled successfully!");
return;
}
const rzp = new window.Razorpay({
key: order.key,
amount: order.amount * 100,
currency: "INR",
order_id: order.orderId,
customer_id: order.customerId || undefined, // real email + mobile in Razorpay
prefill: order.prefill, // { name, email, contact }
name: "My Academy",
handler: async (response) => {
await paymentApi.verifyPayment(response);
window.location.href = "/learn/" + courseId;
}
});
rzp.open();
🎓 Student Course Enrollment & Progress
Check if the authenticated student has purchased or enrolled in a course, and retrieve completed lessons.
Returns enrollment record, enrollment date, and list of completed lesson IDs for the authenticated student.
const res = await fetch(`https://api.betutor.in/api/enrollments/course/${courseId}`, {
headers: {
Authorization: `Bearer ${studentToken}`,
"X-Org-Slug": ORG_SLUG
}
});
const { isEnrolled, completedLessons } = await res.json();
🎓 Student Library & Protected Lesson Streaming
Stream lesson video content and access purchased digital assets.
Returns lesson content with video streaming URLs. Important: If the student is not enrolled, all video URLs are stripped and isLocked: true is returned.
Generates a secure 15-minute temporary presigned download URL from Cloudflare R2 for verified buyers.
// Response:
{
"success": true,
"deliveryType": "hosted",
"downloadUrl": "https://r2.storage.cloudflare.com/...",
"fileName": "SourceCode.zip",
"expiresIn": 900
}