npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@abrianto/smartschool-kit

v0.0.13

Published

A toolkit for Smartschool API interactions, both as a library and CLI.

Readme

Smartschool

A modern, TypeScript-based, non-opinionated client for the Smartschool's APIs. This client provides a simple interface to interact with all Smartschool API endpoints.

Features

  • 🚀 Runtime agnostic (works in Deno, Browser, Node.js)
  • 💪 Full TypeScript support with comprehensive type definitions
  • 🔧 CLI interface for quick operations
  • 🎯 Supports all Smartschool API endpoints
  • 📘 Detailed documentation for each method

Installation

From NPM:

npm i @abrianto/smartschool-kit

import { SmartschoolClient } from '@abrianto/smartschool-kit'

From JSR.io

# From JSR
jsr add @abrianto/smartschool-client

# Direct import
import { SmartschoolClient } from "jsr:@abrianto/smartschool-client";

Usage

As a Library

import { SmartschoolClient } from "@abrianto/smartschool-client";

const client = new SmartschoolClient({
  apiEndpoint: "https://your-school.smartschool.be/Webservices/V3",
  accesscode: "your-access-code"
});

// Create a user
await client.saveUser({
  username: "john.doe",
  name: "John",
  surname: "Doe",
  email: "[email protected]",
  basisrol: "leerkracht"
});

// Send a message
await client.sendMsg({
  userIdentifier: "john.doe",
  title: "Welcome",
  body: "Welcome to Smartschool!",
  senderIdentifier: "admin"
});

// Get user details
const userDetails = await client.getUserDetails({
  userIdentifier: "john.doe"
});

Using the CLI

NPM:

npm i -g @abrianto/smartschool-kit

Using the repository and Deno

# Get help
deno run --allow-net ./bin/cli.ts --help

# Create a user, skip optional parameters
deno run --allow-net ./bin/cli.ts \
  --method=saveUser \
  --config=./config.json \
  --username=john.doe \
  --name=John \
  --surname=Doe \
  --skip

# Send a message
deno run --allow-net --allow-read --allow-env ./bin/cli.ts \
  --config=./config.json \
  --method=sendMsg \
  --userIdentifier=jane.roe \
  --title=Hallo \
  --body="Lorem ipsum"

# Get absents
deno run --allow-net --allow-read --allow-env ./bin/cli.ts \
  --config=./config.json \
  --method=getAbsents \
  --userIdentifier=jane.roe \
  --schoolYear=2025

# Interactive mode
deno run --allow-net cli.ts --interactive

Available Methods

See coverage

User Management

  • saveUser - Create or update a user
  • getUserDetails - Get user details
  • getUserDetailsByNumber - Get user details by internal number
  • getUserDetailsByUsername - Get user details by username
  • getUserDetailsByScannableCode - Get user details by scannable code
  • delUser - Delete a user (optional officialDate)
  • setAccountStatus - Set user account status
  • changeUsername - Change a user's username
  • changeInternNumber - Change a user's internal number
  • changePasswordAtNextLogin - Force password change at next login
  • forcePasswordReset - Force password reset
  • replaceInum - Replace internal user number
  • saveUserParameter - Update user parameters (e.g., co-accounts)
  • changeGroupOwners - Update group owners

Groups and Classes

  • saveGroup - Create or update a group
  • saveClass - Create or update a class (optional instituteNumber, adminNumber, schoolYearDate)
  • getAllGroupsAndClasses - Get all groups and classes
  • getClassList - Get class list
  • getClassListJson - Get class list in JSON
  • getClassTeachers - Get class teachers (optional getAllOwners)
  • saveUserToGroup - Add user to group (via saveUserToClass/saveUserToClasses)
  • removeUserFromGroup - Remove user from group (optional officialDate)
  • delClass - Delete a class
  • saveClassList - Bulk update class list (serialized)
  • saveClassListJson - Bulk update class list (JSON)
  • getSchoolyearDataOfClass - Get class metadata (e.g., year)
  • saveSchoolyearDataOfClass - Update class metadata
  • getSkoreClassTeacherCourseRelation - Teacher-course links

Messages

  • sendMsg - Send a message (optional attachments, coaccount, copyToLVS)
  • saveSignature - Save message signature

Absences

  • getAbsents - Get user absences
  • getAbsentsWithAlias - Get absences with alias
  • getAbsentsByDate - Get absences by date
  • getAbsentsWithAliasByDate - Get absences with alias by date
  • getAbsentsWithInternalNumberByDate - Get absences by internal number and date
  • getAbsentsWithUsernameByDate - Get absences by username and date
  • getAbsentsByDateAndGroup - Get absences by date and group

Photos

  • getAccountPhoto - Get user photo
  • setAccountPhoto - Set user photo

Courses

  • addCourse - Add a course (optional visibility)
  • addCourseStudents - Add students to course
  • addCourseTeacher - Add teacher to course
  • getCourses - Get all courses

Helpdesk

  • addHelpdeskTicket - Add a helpdesk ticket
  • getHelpdeskMiniDbItems - Get helpdesk items

Password Management

  • savePassword - Set/update password

Account Management

  • getAllAccounts - List all accounts
  • getAllAccountsExtended - Extended list of accounts
  • getUserOfficialClass - Get user’s official class (optional date)

Data Sync/System

  • startSkoreSync - Start synchronization
  • checkStatus - Check service status
  • clearGroup - Remove all users from a group (optional officialDate)
  • unregisterStudent - Unregister student (optional officialDate)

Co-Accounts

  • removeCoAccount - Delete co-account

Student Career

  • getStudentCareer - Get student career history

Parameters

  • getReferenceField - Retrieve reference field

Error Handling

Note: The API itself handles error code translations. By default, the API returns error codes, and we fetch them to translate them into clear error messages using the SmartschoolError class.

  • returnCsvErrorCodes - List error codes in CSV
  • returnJsonErrorCodes - List error codes in JSON

Deprecated

  • deactivateTwoFactorAuthentication - No longer supported by Smartschool

Type Definitions

The client includes comprehensive TypeScript definitions for all methods. Example:

interface SaveUser {
  username: string;
  name: string;
  surname: string;
  basisrol: string;
  email?: string;
  // ... other optional fields
}

interface SendMessage {
  userIdentifier: string;
  title: string;
  body: string;
  senderIdentifier?: string;
  attachments?: Array<{
    filename: string;
    filedata: string;
  }>;
  coaccount?: number;
  copyToLVS?: boolean;
}

Error Handling

The client provides proper error handling:

try {
  await client.saveUser({...});
} catch (error) {
  if (error instanceof SmartschoolError) {
    console.error("API Error:", error.code, error.message);
  } else {
    console.error("Network or other error:", error);
  }
}

CLI Configuration

Create a config.json file:

{
  "apiEndpoint": "https://your-school.smartschool.be/Webservices/V3",
  "accesscode": "your-access-code"
}

Contributing

Contributions are welcome! Please submit pull requests with any improvements.

License

MIT License - see LICENSE file for details