Skip to main content

Create Your First Student

1

Get Your Token

Login to get your JWT token:
curl -X POST https://api.chessplay.io/api/token/ \
  -H "Content-Type: application/json" \
  -d '{"username": "admin_user", "password": "your_password"}'
Save the access token.
2

Create a Student

Use your token:
curl -X POST https://api.chessplay.io/api/v1/students/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "FastMalamute",
    "email": "student@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "password": "secure_password"
  }'
3

Success!

You’ll get the created student:
{
  "id": 123,
  "username": "FastMalamute",
  "email": "student@example.com",
  "first_name": "John",
  "last_name": "Doe"
}

Complete Example

import requests

BASE_URL = "https://api.chessplay.io/api"

# Login
response = requests.post(f"{BASE_URL}/token/", json={
    "username": "admin_user",
    "password": "your_password"
})
token = response.json()["access"]

# Create student
headers = {"Authorization": f"Bearer {token}"}
student = requests.post(
    f"{BASE_URL}/v1/students/",
    headers=headers,
    json={
        "username": "FastMalamute",
        "email": "student@example.com",
        "first_name": "John",
        "last_name": "Doe",
        "password": "secure_password"
    }
).json()

print(f"Created: {student['username']}")

Next Steps