1.7.5 • Public • Published

npm version JavaScript Style Guide tested with jest

Canvas LMS API for Node.js

Canvas API functions bundled as a NPM package for Node.js.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for use with your own API tokens and Canvas domains.


  1. Install Node 8.0.0 or greater.


To use with node:

$ npm install node-canvas-api

Then, in wherever you want to use this package:

const canvasAPI = require('node-canvas-api')

Rename the sample.env file to .env and add your institution's domain and API access token.

Attached to the canvasAPI are a bunch of functions. Run the attached functions!

Example Usage

Get information about self:

const canvasAPI = require('node-canvas-api')

  .then(self => console.log(self))

Get students in a course:

const { getUsersInCourse, getOptions } = require('node-canvas-api')

getUsersInCourse(12345, getOptions.users.enrollmentType.student) // first argument is Canvas course ID
  .then(students => console.log(students))


Contributions are welcome and greatly appreciated!

How to contribute

  1. Create an issue describing what contribution you are planning to make.
  2. Fork the repo.
  3. Add your contributions to the source directory (and not the src directory. This directory is generated by Rollup during the build phase, and is what gets published to npm.)
  4. If you add a file to source, please add the file to the existing index.js inside source, so that during the build your contribution will be included in src.
  5. Test your code by creating a file in the root of the project directory, importing your code addition from src, and running it.
  6. Once you're happy with your contribution, open an pull request and I'll take a look.

Hypothetical scenario for adding new feature

  1. Add new file to source folder (say that the new file you want to add is getUsersWithGradeThreshold.js)
  2. In the source folder, there’s an index.js file that lists all of the files you want exported to src. There you will add: export { default as getUsersWithGradeThreshold } from './getUsersWithGradeThreshold'
  3. Run npm run build, which will build the project and output your new function into src.
  4. In the index.js at the root of the project that you create (this is not the index.js that’s in the source folder), import your new file from src like this: const getUsersWithGradeThreshold = require('.src/getUsersWithGradeThreshold') and test by running the code: node index.js.
  5. Once you’re happy that it works, create a PR.



This project is licensed under the MIT License.

Package Sidebar


npm i node-canvas-api

Weekly Downloads






Unpacked Size

64.3 kB

Total Files


Last publish


  • justin0022