์ง„๋ณด JINBO API Documentation

World-Class Coaching Platform API โ€ข Version 2.2.0

๐Ÿš€ API KEY QUICKSTART - FOR ANY COMPANY/AI AGENT

Generic API Usage - Works for any company, AI agent, or automation system


๐ŸŽฏ WHAT YOU NEED

  1. Login credentials (email + password from Legacy Integration)
  2. Brand/Company created in JINBO system
  3. API key (we'll generate this)

โšก 3-STEP SETUP

STEP 1: Get JWT Token

# Login to get token
curl -X POST https://legacy-integration.cloud/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@legacy-integration.cloud",
    "password": "your_password"
  }'

# Response:
{
  "token": "eyJhbGc..."
}

Save this token โ†’ Use it in Step 2


STEP 2: Generate API Key

curl -X POST https://jinbo.life/api/auth/api-key \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Company Production Key",
    "scopes": ["*"]
  }'

# Response:
{
  "success": true,
  "message": "โš ๏ธ SAVE THIS KEY! It will not be shown again.",
  "api_key": "jinbo_live_1234567890abcdef",
  "scopes": ["*"],
  "usage_example": {
    "curl": "curl -X GET https://jinbo.life/api/classes -H \"X-API-Key: jinbo_live_1234567890abcdef\"",
    "javascript": "...",
    "python": "..."
  }
}

โš ๏ธ CRITICAL: Save the api_key value! You can't retrieve it later.


STEP 3: Use API Key

# Now you can use the API key forever (no more JWT needed!)

# Example: Create a class
curl -X POST https://jinbo.life/api/classes \
  -H "X-API-Key: jinbo_live_1234567890abcdef" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Morning Yoga",
    "level": "beginner",
    "max_students": 15
  }'

That's it! ๐ŸŽ‰


๐Ÿค– FOR AI AGENTS

Give your AI agent this information:

// Configuration for AI Agent
const JINBO_CONFIG = {
  api_base: 'https://jinbo.life/api',
  api_key: 'jinbo_live_1234567890abcdef',
  
  // Headers to include in every request
  headers: {
    'X-API-Key': 'jinbo_live_1234567890abcdef',
    'Content-Type': 'application/json'
  }
};

// Example: AI creates a class
async function createClass(name, level) {
  const response = await fetch(`${JINBO_CONFIG.api_base}/classes`, {
    method: 'POST',
    headers: JINBO_CONFIG.headers,
    body: JSON.stringify({
      name: name,
      level: level,
      max_students: 15,
      duration_minutes: 60
    })
  });
  
  return await response.json();
}

// Example: AI assigns coach to class
async function assignCoach(classId, coachId) {
  const response = await fetch(
    `${JINBO_CONFIG.api_base}/classes/${classId}/assign-coach`,
    {
      method: 'POST',
      headers: JINBO_CONFIG.headers,
      body: JSON.stringify({ coach_id: coachId })
    }
  );
  
  return await response.json();
}

๐Ÿ“‹ AVAILABLE API ENDPOINTS

Classes

API Key Management


๐Ÿ” PERMISSIONS (SCOPES)

When generating API key, you can limit permissions:

{
  "scopes": ["classes:write", "students:read"]
}

Available scopes:


๐Ÿงช TEST YOUR API KEY

# Test 1: List classes
curl -X GET https://jinbo.life/api/classes \
  -H "X-API-Key: YOUR_API_KEY"

# Test 2: Create a class
curl -X POST https://jinbo.life/api/classes \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Test Class","level":"beginner"}'

# Test 3: Get class details
curl -X GET https://jinbo.life/api/classes/CLASS_ID \
  -H "X-API-Key: YOUR_API_KEY"

Expected response: HTTP 200 with JSON data


๐Ÿ›ก๏ธ SECURITY BEST PRACTICES

โœ… DO:

โŒ DON'T:


๐Ÿ”„ MANAGE YOUR KEYS

List all keys

curl -X GET https://jinbo.life/api/auth/api-keys \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Revoke a key

curl -X DELETE https://jinbo.life/api/auth/api-keys/KEY_ID \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

View usage stats

curl -X GET https://jinbo.life/api/auth/api-keys/KEY_ID/stats \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

๐Ÿ†˜ TROUBLESHOOTING

Error: "Invalid API key"

Error: "Insufficient permissions"

Error: "Authentication required"


๐Ÿ’ก EXAMPLE USE CASES

1. Automated Class Creation (AI Agent)

import requests
import os

API_KEY = os.getenv('JINBO_API_KEY')
headers = {'X-API-Key': API_KEY, 'Content-Type': 'application/json'}

# AI creates classes based on demand
classes_to_create = [
    {'name': 'Morning Yoga', 'level': 'beginner'},
    {'name': 'Advanced Pilates', 'level': 'advanced'},
    {'name': 'Kids Martial Arts', 'level': 'beginner'}
]

for class_data in classes_to_create:
    response = requests.post(
        'https://jinbo.life/api/classes',
        headers=headers,
        json=class_data
    )
    print(f"Created: {response.json()}")

2. Sync from External System

// Sync classes from your existing system
async function syncClasses(externalClasses) {
  const API_KEY = process.env.JINBO_API_KEY;
  
  for (const external of externalClasses) {
    await fetch('https://jinbo.life/api/classes', {
      method: 'POST',
      headers: {
        'X-API-Key': API_KEY,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: external.title,
        description: external.description,
        max_students: external.capacity
      })
    });
  }
}

3. Reporting Dashboard Integration

# Get all classes for your dashboard
curl -X GET 'https://jinbo.life/api/classes' \
  -H "X-API-Key: $JINBO_API_KEY" | jq '.classes'

๐Ÿ“ž SUPPORT

Need help?


โœจ SUMMARY

For any company/AI agent:

  1. โœ… Login โ†’ Get JWT token
  2. โœ… Generate API key (one-time)
  3. โœ… Use API key forever (in X-API-Key header)
  4. โœ… Create classes, assign coaches, enroll students

That's all you need! ๐Ÿš€


Last Updated: October 2, 2025 - 02:28 UTC