Skip to content

Documents

github-actions[bot] edited this page Oct 16, 2026 · 1 revision

Documents | Learn how to get documents with Litedirecte.

The Documents module provides access to official school documents.


🚀 Getting Started

Let's retrieve the list of available school documents and see what's ready to download.

import { Litedirecte } from "litedirecte";
import { writeFile } from "node:fs/promises";

const ld = new Litedirecte();
await ld.auth.login("your_username", "your_password");

// Fetch lists of invoices, report cards, etc.
const result = await ld.documents.getDocuments();

// Check if any report cards are available under the "notes" document array
const latestReportCard = result.notes?.[0];

if (latestReportCard) {
  console.log(`Downloading report card: ${latestReportCard.libelle}...`);

  // To download documents, send a post request to the download endpoint using the document ID and type
  const fileData = await ld.downloads.download({
    as: "buffer",
    params: {
      forceDownload: 0,
      id: latestReportCard.id,
      type: latestReportCard.type,
    },
  });

  // Save it locally!
  await writeFile(`./${latestReportCard.libelle}.pdf`, Buffer.from(fileData));
  console.log("Download complete!");
} else {
  console.log("No report cards available to download.");
}

📖 API Reference

ld.documents.getDocuments

Fetches categorized folders of files made available to the student.

ld.documents.getDocuments(): Promise<any>

Returns

A promise that resolves to the raw EcoleDirecte API payload (treated as any), with document lists grouped by category. Litedirecte preserves the API's original key names and only normalizes values (date strings become Date, base64 fields are decoded).


🗂️ Response Shape

ld.documents.getDocuments resolves to the raw EcoleDirecte API payload (treated as any). Documents are categorized into buckets such as factures, notes, viescolaire, and administratifs, each an array of document objects. Litedirecte preserves the API's original key names and only normalizes values (date strings become Date, base64 fields are decoded).


💾 Caching

getDocuments() is a maintained entry (its cache key includes the account id explicitly, even though the endpoint has none). It accepts { force: true } to skip the cache. See Cache & sync.

Clone this wiki locally