RateMyProfessors API Client
A typed, retrying, rate-limited unofficial TypeScript client for RateMyProfessors. Search schools and professors, fetch ratings, and build scripts or tools on top of RMP with a simple API and full TypeScript types.
Disclaimer: This library is unofficial and may break if RMP changes their
internal API. Use responsibly and respect rate limits.
Requirements #
- Node.js 18 or later
- Works in both TypeScript and JavaScript projects — types are included.
Installation #
npm install ratemyprofessors-client
Quick Start #
Create a client and start querying:
import { RMPClient } from "ratemyprofessors-client";
const client = new RMPClient();
try {
const schools = await client.searchSchools("Queen's University");
console.log(schools.schools[0]?.name);
const prof = await client.getProfessor("2823076");
console.log(prof.name, prof.overall_rating);
for await (const rating of client.iterProfessorRatings(prof.id)) {
console.log(rating.date, rating.quality, rating.comment);
}
} finally {
await client.close();
}
Available Functions #
All methods are async. See the full reference for parameters, return types, and examples.
Schools
searchSchools(query)— Search schools by name. Returns paginated results.getSchool(schoolId)— Get a single school by its numeric ID.getCompareSchools(id1, id2)— Fetch two schools side by side.getSchoolRatingsPage(schoolId)— One page of school ratings (cached after first fetch).iterSchoolRatings(schoolId)— Async iterator over all school ratings.
Professors
searchProfessors(query)— Search professors by name. Returns paginated results.listProfessorsForSchool(schoolId)— List professors at a given school.iterProfessorsForSchool(schoolId)— Async iterator over all professors at a school.getProfessor(professorId)— Get a single professor by their numeric ID.getProfessorRatingsPage(professorId)— One page of professor ratings (cached after first fetch).iterProfessorRatings(professorId)— Async iterator over all professor ratings.
Low-level
rawQuery(payload)— Send a raw GraphQL payload to the RMP endpoint.close()— Close the client, abort in-flight requests, and clear caches.
Errors #
All errors extend RMPError. Catch and narrow with instanceof. See the full error reference.
HttpError— Non-2xx HTTP status (e.g. 404, 500).ParsingError— Response couldn't be parsed or entity not found.RateLimitError— Local rate limiter blocked the request.RetryError— Failed after all retry attempts.RMPAPIError— GraphQL API returned errors.ConfigurationError— Invalid client configuration.
Types #
All methods return typed data. See the full type reference.
import type {
School, Professor, Rating, SchoolRating,
ProfessorSearchResult, SchoolSearchResult,
ProfessorRatingsPage, SchoolRatingsPage,
CompareSchoolsResult,
} from "ratemyprofessors-client";
Extras #
Optional helpers for data pipelines. See the extras reference.
import {
normalizeComment, isValidComment,
cleanCourseLabel, buildCourseMapping,
analyzeSentiment,
} from "ratemyprofessors-client/extras";