Skip to main content
Version: 2026-09-21 (current)

The Voshi API

Your tool never builds a URL, sends a token, or calls fetch(). Everything it needs from Voshi is on one object, api, which Voshi constructs from the launch and passes to your element.

class MyTool extends HTMLElement {
constructor(api) {
super()
this.api = api
this.attachShadow({ mode: 'open' })
}

async connectedCallback() {
this.shadowRoot.replaceChildren(this.api.assets.template('index.html'))
try {
const saved = await this.api.storage.memberLocation.get()
this.render(saved)
} catch (err) {
this.showError(err.message)
}
}
}

customElements.define('my-tool', MyTool)

What is on it​

WhatPage
api.user, api.isStaff, api.isStudent, api.groupsWho launched, and their role in the courseWho launched
api.location, api.course, api.organizationWhich of your locations, in which course, at which schoolWho launched
api.canSubmitGradeWhether this launch has a gradebook columnGrades
api.submitGrade(...)Report a scoreGrades
api.storage.course, .location, .member, .memberLocationFour JSON objects your tool owns, each with get, set, update, patchStorage
api.storage.<scope>.filesFiles kept beside each of those, with list, info, get, put, removeFiles
api.assetsYour tool's own stylesheets, templates, and file URLsAssets
api.launch_dataThe whole launch, for anything the properties above don't coverWho launched

Three habits​

Every call that reaches Voshi is async. await it. Reading storage, saving, reporting a grade, listing files — all of them return promises.

Every call throws on failure. A method never returns an error object or a status code; if something went wrong, it throws, and err.message says what. So wrap calls in try/catch and tell the learner what happened. See Errors for the kinds of error and what each means.

Check before you act. api.canSubmitGrade before submitGrade(); api.isStaff before showing instructor features or writing the shared rows. The checks are properties, not calls, and they are correct for this launch.

Versions of the client​

The Voshi API is a file Voshi serves alongside your tool, and it has a major version — the 1 in voshi-api.1.js. Breaking changes move to a new number; within a number, updates arrive rarely and between semesters, and your tool receives them without doing anything. Everything in these pages is version 1.