P
ProTutors API
v1.0 Headless SaaS
📦 Starter Template Get Started ⚡

ProTutors Headless LMS REST API

Build your custom academy website, branded storefront, e-learning courses, digital shop, and seamless Razorpay checkout using our scalable backend engine.

Production Base URL https://api.betutor.in

⚡ 5-Minute Quickstart

How any creator or agency can launch a fully customized website powered by ProTutors.

1

Register on ProTutors

Sign up in the platform portal. You will receive your unique Academy Slug (e.g. nodestudio).

2

Upload Courses & Shop Items

Publish video courses and digital products. Enter your Razorpay API Key ID & Secret in Payment Settings.

3

Clone Starter & Deploy

Use our Next.js white-label starter kit. Set 3 environment variables and deploy to Vercel or Cloudflare.

.env.local for Your Custom Website
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.

GET /api/storefront/nodestudio/config
Public

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"
Live response from ProTutors Backend

          

📚 Course Catalog

Fetch published courses with pagination and category filtering.

GET /api/storefront/nodestudio/courses
Public

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.

GET /api/storefront/nodestudio/courses/:courseId
Public

Returns full course metadata and section syllabus outline. Lesson video URLs are protected and omitted from this public response.

🛍️ LMS Shop (Digital Assets & Downloads)

Sell downloadable eBooks, software, templates, and boilerplates.

GET /api/assets/public
Headers: X-Org-Slug

List digital products available for sale in this academy's shop.

Request with Tenant Header
curl -X GET "https://api.betutor.in/api/assets/public" \
  -H "X-Org-Slug: nodestudio"

          

🔐 Student Authentication (Passwordless OTP)

Frictionless login and signup for students via email OTP.

POST /api/auth/send-otp
Headers: X-Org-Slug

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" }
POST /api/auth/verify-otp
Headers: X-Org-Slug

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"
  }
}

💳 Payments & Razorpay Checkout

Create orders and cryptographically verify payments server-side.

POST /api/payments/create-order
Bearer Token Required

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"
}

// Response:
{
  "orderId": "order_NXK201aLp831Q",
  "amount": 1499,
  "discount": 500,
  "key": "rzp_live_abc123"
}
POST /api/payments/verify
Bearer Token Required

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:

const order = await paymentApi.createOrder(courseId);

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,
  name: "My Academy",
  handler: async (response) => {
    await paymentApi.verifyPayment(response);
    window.location.href = "/learn/" + courseId;
  }
});
rzp.open();

🎓 Student Library & Protected Lesson Streaming

Stream lesson video content and access purchased digital assets.

GET /api/lessons/:courseId
Bearer Token Required

Returns lesson content with video streaming URLs. Important: If the student is not enrolled, all video URLs are stripped and isLocked: true is returned.

GET /api/assets/:assetId/download
Bearer Token Required

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
}