Scratch API (1.4)

The Scratch API is a relatively simple way for sites not using the Scratch Website to access information about the website. There is no official documentation, but the source contains comments, explaining the way to use them.

There are 28 APIs. They access data about projects, users, galleries, and statistics.

Use

The API is used by downloading the content of the page. This can be done in any programming language that can read the source of web pages. The Scratch ModificationPanther works for this.

The page to be accessed is https://scratch.mit.edu/api/[apiname]/[parameters]. [apiname] is the name of the API. [parameters] are variables that can be passed to the API, such as with getproject, the project ID parameter is available. If multiple parameters are accepted, such as with getprojectinfobyID, they are usually separated by slashes. An exception is authenticateuser, where parameters are passed using URL variables (https://scratch.mit.edu/api/authenticateuser?username=demo&password=demo123).

Output

Different APIs have different types of output.

Redirect

Some APIs, such as getuser, redirect to a page on the website.

Plain text output

Some APIs print a plain value. getregisteredusers, and other statistics APIs, are examples.

Example Uses

Sparks's Scratch API, which is a user-friendly implementation of some of the official APIs

API

The subject of this article or section has changed dramatically and requires updating. Please keep in mind that some of the information or images may not be accurate or relevant to the current version of Scratch, the Scratch website, or the article subject. (April 2016)

This is a full list of all the current Scratch APIs.

getproject

This function takes project ID as input and redirects to project page based on a project ID.