Documentation for (and examples of) using the Khan Academy API
JavaScript CSS Python HTML Makefile
Latest commit 7573009 Jan 2, 2016 Alan Pierce Overhaul the README
Add sections for how to get help with the API (some of which was moved from the
"Khan Academy API Authentication" page) and how to contribute. Also rewrite
basically everything else because it had gotten out of date.

Auditors: benkraft
Failed to load latest commit information.
examples Ensure test_client2 handles URL queries. Aug 24, 2015
explorer Update lint_blacklist to include node_modules. Remove js_version.py f… Aug 23, 2013
third_party Fix OAuth signing with repeated parameters in the sample client Mar 30, 2015
.arcconfig Tell .arcconfig to use the .arclint file in the khan-api repo. Jun 8, 2015
.arclint Fix the regexp for arc lint to correctly only match a single line. Oct 13, 2015
.gitignore
.gitmodules External libraries for new explorer Jul 16, 2013
README.md Overhaul the README Jan 2, 2016
app.yaml Minification process for javascript Jul 17, 2013
requirements.txt External libraries for new explorer Jul 16, 2013
run.py Config bits for appengine, require.js, requirements, etc. Jul 16, 2013

README.md

Khan Academy API

This repository provides documentation and some examples for working with the Khan Academy API.

Documentation

Documentation can be found on the GitHub project wiki:

  • The Khan Academy API wiki page has general information about how to use the API.
  • The Khan Academy API Authentication wiki page provides more detailed documentation about how to use OAuth 1 to log in as a Khan Academy user and access information.

Unfortunately, not all of the documentation is completely up-to-date, so feel free to file issues if documentation looks wrong or incomplete.

Asking questions and reporting bugs

If you have a question about how to use the API, there are a few ways you can get support:

  • You can ask a StackOverflow question with the khan-academy tag. We watch for new issues with that tag, and you're also likely to get help from other community members.
  • You can file an issue in the issue tracker for this GitHub project. This is especially useful if you find a bug in one of the sample clients or with the API itself.
  • If you already have a contact at Khan Academy (e.g. through a partnership), you can reach out to them.
  • Any other questions can be sent to api-questions@khanacademy.org .

Unfortunately, we're not always actively developing and maintaining the API, so we're unlikely to add significant features and may be slow at responding to questions, but we try to get to every question and we hope you'll still find the existing API useful.

Sample API clients

See the examples directory for a few sample API clients. All example code is MIT licensed.

The most current example client is test_client2, which shows how to connect using the /api/auth2 authentication endpoints.

Here's an example of how you might use it (using the consumer key and secret obtained when registering an app):

$ cd examples/test_client2
$ python test.py
consumer key: [your consumer key]
consumer secret: [your consumer secret]
server base url: https://www.khanacademy.org

Resource relative url (e.g. /api/v1/playlists): /api/v1/user


{"spawned_by": null, "total_seconds_watched": 140627, ...}

Time: 0.647733926773s

Contributing

If you want to contribute your own sample client, we'd be happy to include it; just send us a pull request! There's also plenty of room for improvement in the existing clients, so we're happy to accept contributions to those as well.