Students API

Comprehensive API for managing student data, enrollment, and academic records.

API Endpoints

GET

/students

Retrieve a list of all students with optional filtering and pagination

Parameters

page(integer)

Page number for pagination (default: 1)

limit(integer)

Number of students per page (default: 20, max: 100)

class_id(integer)

Filter by class ID

status(string)

Filter by status (active, inactive, graduated)

search(string)

Search by name, email, or student ID

Response

Success Response (200)
{
  "data": [
    {
      "id": 123,
      "student_id": "STU001",
      "first_name": "John",
      "last_name": "Doe",
      "email": "john.doe@example.com",
      "phone": "+1234567890",
      "date_of_birth": "2005-03-15",
      "class_id": 456,
      "class_name": "Grade 10A",
      "status": "active",
      "enrollment_date": "2023-09-01",
      "address": {
        "street": "123 Main St",
        "city": "Anytown",
        "state": "CA",
        "zip": "12345"
      },
      "parent": {
        "id": 789,
        "name": "Jane Doe",
        "email": "jane.doe@example.com",
        "phone": "+1234567891"
      }
    }
  ],
  "pagination": {
    "total": 150,
    "page": 1,
    "limit": 20,
    "total_pages": 8
  }
}
POST

/students

Create a new student record

Parameters

student_id(string)Required

Unique student identifier

first_name(string)Required

Student first name

last_name(string)Required

Student last name

email(string)Required

Student email address

phone(string)

Student phone number

date_of_birth(string)Required

Date of birth (YYYY-MM-DD)

class_id(integer)Required

Class ID for enrollment

address(object)

Student address object

parent_id(integer)

Parent/Guardian ID

Response

Success Response (201)
{
  "id": 124,
  "student_id": "STU002",
  "first_name": "Jane",
  "last_name": "Smith",
  "email": "jane.smith@example.com",
  "phone": "+1234567892",
  "date_of_birth": "2005-07-20",
  "class_id": 456,
  "class_name": "Grade 10A",
  "status": "active",
  "enrollment_date": "2024-01-15",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}
Error Response (400)
{
  "error": "validation_error",
  "message": "Invalid input data",
  "details": {
    "email": ["Email address is already in use"],
    "student_id": ["Student ID must be unique"]
  }
}
GET

/students/{id}

Retrieve detailed information for a specific student

Parameters

id(integer)Required

Student ID

Response

Success Response (200)
{
  "id": 123,
  "student_id": "STU001",
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "phone": "+1234567890",
  "date_of_birth": "2005-03-15",
  "class_id": 456,
  "class_name": "Grade 10A",
  "status": "active",
  "enrollment_date": "2023-09-01",
  "address": {
    "street": "123 Main St",
    "city": "Anytown",
    "state": "CA",
    "zip": "12345"
  },
  "parent": {
    "id": 789,
    "name": "Jane Doe",
    "email": "jane.doe@example.com",
    "phone": "+1234567891"
  },
  "academic_records": {
    "current_gpa": 3.8,
    "total_credits": 24,
    "attendance_rate": 95.5
  },
  "created_at": "2023-09-01T08:00:00Z",
  "updated_at": "2024-01-15T14:30:00Z"
}
PUT

/students/{id}

Update student information

Parameters

id(integer)Required

Student ID

first_name(string)

Updated first name

last_name(string)

Updated last name

email(string)

Updated email address

phone(string)

Updated phone number

class_id(integer)

Updated class ID

status(string)

Updated status

Response

Success Response (200)
{
  "id": 123,
  "student_id": "STU001",
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "phone": "+1234567890",
  "date_of_birth": "2005-03-15",
  "class_id": 456,
  "class_name": "Grade 10A",
  "status": "active",
  "enrollment_date": "2023-09-01",
  "updated_at": "2024-01-15T15:45:00Z"
}
DELETE

/students/{id}

Delete a student record (soft delete)

Parameters

id(integer)Required

Student ID

Response

Success Response (200)
{
  "message": "Student successfully deleted",
  "id": 123
}

Bulk Operations

Bulk Import Students

Import multiple students from CSV or Excel files

POST /students/import
curl -X POST https://api.klasstra.com/students/import \
  -H "X-API-Key: your_api_key" \
  -F "file=@students.csv" \
  -F "class_id=456"

Export Student Data

Export student information in various formats

GET /students/export
curl -X GET "https://api.klasstra.com/students/export?format=csv&class_id=456" \
  -H "X-API-Key: your_api_key" \
  -o students_export.csv

Advanced Search

Search students with complex filters and sorting

GET /students/search
curl -X GET "https://api.klasstra.com/students/search?q=john&class_id=456&status=active&sort=gpa" \
  -H "X-API-Key: your_api_key"

Student Data Model

Understanding the student data structure will help you work with the API more effectively.

{
  "id": 123,                    // Unique student ID
  "student_id": "STU001",       // Institution student ID
  "first_name": "John",         // Student first name
  "last_name": "Doe",           // Student last name
  "email": "john@example.com",  // Student email
  "phone": "+1234567890",       // Student phone number
  "date_of_birth": "2005-03-15", // Date of birth (ISO format)
  "class_id": 456,              // Current class ID
  "class_name": "Grade 10A",    // Current class name
  "status": "active",           // active, inactive, graduated
  "enrollment_date": "2023-09-01", // Enrollment date
  "address": {                  // Student address object
    "street": "123 Main St",
    "city": "Anytown",
    "state": "CA",
    "zip": "12345"
  },
  "parent": {                   // Parent/Guardian information
    "id": 789,
    "name": "Jane Doe",
    "email": "jane@example.com",
    "phone": "+1234567891"
  },
  "academic_records": {         // Academic performance data
    "current_gpa": 3.8,
    "total_credits": 24,
    "attendance_rate": 95.5
  },
  "created_at": "2023-09-01T08:00:00Z",
  "updated_at": "2024-01-15T14:30:00Z"
}

Best Practices

Performance

  • Use pagination for large datasets
  • Implement caching for frequently accessed data
  • Use specific filters to reduce response size
  • Batch operations when possible

Data Management

  • Validate data before sending requests
  • Handle errors gracefully with proper retry logic
  • Keep student data synchronized
  • Respect privacy and data protection laws

Explore More APIs

Continue building your integration with other Klasstra APIs.