Skip to content
API documentation

Changelog

Version 1.0.0

Initial release of the v1 partner API, with 35 operations for students, sign-in links, exams, applications, certificates and reports.

Added

Release notes

The first release of the Main Team API. Every path is under https://api.main-team.org/v1. Nothing here replaces an earlier version: each behavior below is how the API works from day one, listed so you can see the rules your integration will meet in one place. Each item links to the page that explains it.

Operations

35 operations in eight groups:

GroupOperations
HealthgetHealth
API accountgetCurrentApiAccount, revokeToken
Reference datalistCountries, getCountry, listGrades, getGrade, listOrganizations, getOrganization
StudentslistStudents, getStudent, registerStudent, updateStudent, setStudentPassword, listOrgStudents, getOrgStudent, updateOrgStudent, linkStudentSupervisor
Sign-in linkscreateSigninLink
ExamslistExamCategories, getExamCategory, listExams, listAvailableExams, getExam
ApplicationslistApplications, listExamApplications, listStudentApplications, getApplication, createApplication, moveApplication, deleteApplication
DocumentslistStudentCertificates, downloadCertificate, listStudentReports, downloadReport

Notable behaviors

Authentication and access

  • You sign your own tokens: HS256 with your apiSecret, kid and sub set to your apiKey, iat and exp required, at most 3600 seconds apart, with 30 seconds of clock tolerance. Every authentication failure answers the same 401 unauthorized. See Authentication.
  • revokeToken ends one token early. Role changes and deactivation of your account take effect within 60 seconds.
  • Every operation except the health check needs a permission from your roles, checked against the organization the request acts on; operations without an organization in their path act on mto. Setting a password needs auth/signin on mto. See Permissions.
  • {organizationId} in a path is the organization's _id from listOrganizations, never its slug. An unknown id answers 404 with Organization not found!, after the token is checked. See Organizations.
  • listOrganizations lists the five organizations that run exams: stem, hilingua, neo, gmath and coding. mto, the core record, is not listed: the operations without an organization in their path act on it.
  • Your account sees only the students it registered and the records reached through them. Another account's record answers like a missing one.

Requests and responses

  • JSON bodies in UTF-8, at most 100 kB (413 above that). A field the operation does not accept is refused with 400 naming it. See Requests and responses.
  • Success responses use { success, message, data, pagination? }; errors use { error: { code, message, documentation_url, request_id } }, where documentation_url is the code's entry on the errors page, https://hub.main-team.org/api/errors#<code>. getCurrentApiAccount returns the account without the envelope, and the downloads return the file itself.
  • Every single read answers 404 not_found for a record it cannot show, including getStudent, getOrgStudent, getCountry, getGrade, getOrganization and getExamCategory.
  • Every response carries X-Request-Id. Quote it when you contact support.
  • Lists take page (default 1) and limit (default 20, at most 100; larger values are clamped). See Pagination.
  • Two catalog codes, invalid_email and unprocessable_entity, are reserved: no operation returns them in 1.0.0. See Errors.

Rate limits

  • 100 requests per 60 seconds per account and per operation, whichever organization is in the path. Each operation is counted on its own. See Rate limits.
  • Going over answers 429 with Retry-After and the message "Too many requests to this operation. Wait the number of seconds in Retry-After, then try again.", and blocks that operation for 60 seconds. Counted responses carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset.

Students

  • Registration is not idempotent. An email address already registered to your account answers 409 with that student's id; one held by anyone else answers 409 without an id. See Students.
  • Every student gets a username at registration, which the API never changes.
  • Registration requires firstName, lastName, email, birth, sex, country, grade, city and school, and birth must be a date that exists, as DD/MM/YYYY. Both updates hold the fields you send to the same rules, and refuse null for a field a student can't be without.
  • A student can use every organization by default (activatedPlatformsThisSeason: ["common"]). The list takes common and the slugs stem, hilingua, neo, gmath and coding. Updates only add to it and never remove anything. Updating a student through an organization without the field, even with an empty body, gives the student access to that organization.
  • Changing a student's email address withdraws its confirmation until the student confirms the new address.
  • Passwords are at least 5 characters and at most 72 bytes, may not contain the student's name, username or email address, and can no longer be set once the student has confirmed their email address (409). See Passwords.
  • A sign-in link works once and for 120 seconds. Its optional redirect must be a path on the organization's site that starts with a single /. See Sign-in links.
  • A student without access to the organization gets 403. An unconfirmed email address does not block a link; the panel asks the student to confirm it and lets them choose to do it later.
  • An organization creates its own copy of a student at their first sign-in there. Until then, applications, the student's application, certificate and report lists on that organization answer 409, and a supervisor link answers 404.

Exams and applications

  • Only open exams are listed or can be read by id. The exam picker, listAvailableExams, offers one student exactly what they may apply for. See Exams.
  • Creating the same application again answers 200 with Application already exists. and the existing application. See Applications.
  • A move is refused once the exam has started, and checked against the same rules as a new application. A paid application moves only to an exam with the same price. An AI Challenge application cannot be moved once the student has used part of their image quota.
  • An application with a settled payment cannot be deleted (409). The API records payments but never charges or refunds anyone.
  • getApplication, moveApplication and deleteApplication answer 404 with Application not found! alike for an application that does not exist and one of another account's student.

Certificates and reports

  • Only released documents are listed or downloaded. A download by _id or shortId answers one 404 for a document that is missing, not released, not yours or has no file. See Certificates and reports.

Search the API documentation

Guides, endpoints by name, path or permission, and error codes such as not_found.