🥋 Dojo Jutsu Docs docs.dojojutsu.com
← dojojutsu.com Launch Portal →

# Dojo Jutsu: Headless Student Portal API Specification

Version: 1.0.0
Protocol: REST over HTTPS / TLS 1.3
Authentication: Supabase Auth JWT (Bearer <access_token>) OR Tenant API Key (x-dojo-key)

# 1. Overview & Threat Model

The Headless Student Portal API allows martial arts academies to embed an authenticated member portal directly into their website (e.g. https://wakatakekan.com/portal or https://myacademy.com/members).

# Radical Shoulder-Surfing Privacy Armor (Pillar F)

Under traditional web platforms, student portals frequently expose global pricing tables or leak other members' rates in network request payloads.

In Dojo Jutsu, Row Level Security (RLS) and verified RPCs ensure that:

  • Students can strictly query only their own record (auth.uid() = auth_user_id).
  • The API never returns a master table of pricing tiers or grandfathered discount amounts.
  • Private Sensei voice notes marked is_visible_to_student = false are filtered at the database level.
  • Legacy client SDKs can call the underlying PostgreSQL RPCs get_student_portal_overview and get_rank_curriculum_progress, or dispatch the create-checkout-session Edge Function for Stripe/Square payments.

# 2. API Endpoints

# GET /functions/v1/headless-student-portal/overview

Retrieves the authenticated student's personalized overview.

# Headers

HTTP
Authorization: Bearer <supabase_student_jwt>
Content-Type: application/json

# Response (200 OK)

JSON
{
  "student": {
    "id": "c1f7b0a8-4e12-4a9f-9c32-111111111111",
    "fullName": "Dan Sensei",
    "role": "student",
    "avatarUrl": "https://cdn.dojojutsu.com/avatars/dan.png",
    "qrToken": "DJ-QR-WAKATAKE-001"
  },
  "rank": {
    "id": "rank-shodan-uuid",
    "name": "1st Dan - Black Belt (Shodan)",
    "displayOrder": 10,
    "beltColorHex": "#000000",
    "stripeCount": 0,
    "minClassesRequired": 120
  },
  "totalAttendance": 142,
  "curriculumProgress": [
    {
      "curriculum_item_id": "cur-seisan-uuid",
      "mastery_score": 3,
      "is_test_ready": true
    }
  ],
  "membership": {
    "status": "GREEN",
    "planType": "recurring_monthly",
    "paidUntilDate": "2026-11-15T00:00:00Z",
    "creditsRemaining": null,
    "renewalPlanName": "Monthly Unlimited",
    "selfRechargeUrl": "https://dojojutsu.com/pay/wakatake?member=c1f7b0a8&sub=sub-123"
  },
  "recentSenseiFeedback": [
    {
      "id": "note-1",
      "note_text": "Strong hip engagement on Bassai Dai opening sequence. Excellent posture.",
      "created_at": "2026-10-17T06:45:00Z"
    }
  ]
}

# GET /functions/v1/public-embed-gateway/schedules

Public endpoint returning the dojo's class schedules for embeddable components.

# Headers

HTTP
x-dojo-key: dj_pub_wakatake_live_9f81a7b2c3d4e5f6
Origin: https://wakatakekan.com

# Response (200 OK)

JSON
{
  "schedules": [
    {
      "id": "sched-sat-0530",
      "title": "Saturday Early Morning Keiko",
      "dayOfWeek": 6,
      "dayName": "Saturday",
      "startTime": "05:30",
      "durationMinutes": 90,
      "locationName": "Main Tatami"
    },
    {
      "id": "sched-tue-1830",
      "title": "Tuesday Kihon & Kata",
      "dayOfWeek": 2,
      "dayName": "Tuesday",
      "startTime": "18:30",
      "durationMinutes": 90,
      "locationName": "Main Tatami"
    }
  ]
}

# POST /functions/v1/public-embed-gateway/waiver

Public electronic liability waiver and trial signup.

# Request Body

JSON
{
  "fullName": "Akira Yuki",
  "email": "akira@example.com",
  "phone": "(555) 012-3456",
  "waiverAgreed": true
}

# Response (201 Created)

JSON
{
  "success": true,
  "message": "Liability waiver accepted and trial registration recorded.",
  "prospectId": "c4d3e2f1-0000-0000-0000-000000000001"
}