(Redirected from Scratch API)

SandCastleIcon.png This page has links to websites or programs not trusted by Scratch or hosted by Wikipedia. Remember to stay safe while using the Internet, as we can't guarantee the safety of other websites.


The Scratch API is an interface which provides access to various instances of data in a mostly programmer-friendly manner. It can be used in many different ways in order to create applications which can send and extract data to and from the Scratch Website. The address of the current Scratch API is https://api.scratch.mit.edu.

api.scratch.mit.edu Interface

The api.scratch.mit.edu interface is the latest revision of the Scratch API. It can be used to return various types of data regarding the Scratch website. This API can be accessed via the following URL.

https://api.scratch.mit.edu

GET /

The root of the api interface provides basic information regarding the API and the Scratch website.


Example Request
GET https://api.scratch.mit.edu
Example Response


Health

GET /health

Used to return the status of the Scratch website.


Example Request
GET https://api.scratch.mit.edu/health
Example Response


News

GET /news

Returns information regarding the "Scratch News" section of the homepage.


Example Request
GET https://api.scratch.mit.edu/news
Example Response


Projects

GET /projects/count/all

Returns the total number of shared projects on the Scratch website.


Example Request
GET https://api.scratch.mit.edu/projects/count/all
Example Response


Proxy

GET /proxy/featured

Returns information regarding the projects currently visible on the front page of the website.


Example Request
GET https://api.scratch.mit.edu/proxy/featured
Example Response


GET /proxy/users/<username>/activity

Returns information regarding the "What I've been doing" section of a given user's profile.


Example Request
GET https://api.scratch.mit.edu/proxy/users/mres/activity
Example Response


GET /proxy/users/<username>/activity/count

This returns the number of unread messages a user currently has.


Example Request
GET https://api.scratch.mit.edu/proxy/users/mres/activity/count
Example Response


Users

GET /users/<username>

Returns information about the specified user.


Example Request
GET https://api.scratch.mit.edu/users/mres
Example Response


GET /users/<username>/favorites

Returns an array of details regarding the projects that a given user has favourited on the website.


Example Request
GET https://api.scratch.mit.edu/users/mres/favorites
Example Response


GET /users/<username>/followers

Returns a list of a user's most recent followers.


Example Request
GET https://api.scratch.mit.edu/users/mres/followers
Example Response


GET /users/<username>/following

Returns a list of the users that the specified user has most recently followed.


Example Request
GET https://api.scratch.mit.edu/users/mres/following
Example Response


GET /users/<username>/messages/count

This returns the number of unread messages a user currently has.


Example Request
GET https://api.scratch.mit.edu/users/mres/messages/count
Example Response


GET /users/<username>/projects

Returns an array with information regarding the projects that a given user has shared on the Scratch website.


Example Request
GET https://api.scratch.mit.edu/users/mres/projects
Example Response


GET /users/<username>/projects/<project_id>

Returns information relevant to the given project.


Example Request
GET https://api.scratch.mit.edu/users/mres/projects/142
Example Response


April Fools' Day, 2018

As an easter egg for April Fool's Day 2018, a counter endpoint was added.

POST /surprise

Increments the counter and returns its current value.


Example Request
POST https://api.scratch.mit.edu/surprise
Example Response


GET /surprise

Returns the counter's current value. This is cached on the server, and so might return an earlier value.


Example Request
GET https://api.scratch.mit.edu/surprise
Example Response


site-api Interface (Removed)

Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.


The site-api was a legacy interface which was officially deprecated on 25 October 2015, as announced by Scratch Team member, thisandagain.[1] This API could be accessed via the following URL:

https://scratch.mit.edu/site-api/

Comments

GET /comments/gallery/<studio_id>/

Returns the comments on a studio in the form of raw HTML.


Example Request
GET https://scratch.mit.edu/site-api/comments/gallery/5342/
Example Response


GET /comments/project/<project_id>/

Returns the comments on a project in the form of raw HTML.


Example Request
GET https://scratch.mit.edu/site-api/comments/project/142/
Example Response


GET /comments/user/<username>/

Returns the comments on a given user's profile in the form of raw HTML.


Example Request
GET https://scratch.mit.edu/site-api/comments/user/mres/
Example Response


Request Headers

These are the request headers which may be filled out.

Host:
User-Agent:
Accept:
Accept-Language:
Accept-Encoding:
Content-Type:
X-CSRFToken:
X-Requested-With:
Referer:
Content-Length:
Cookie:
Connection:

varserver Interface (REMOVED)

Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.


The varserver API could be utilised to request the values of cloud variables in projects. This API could be accessed via the following URL. It is no longer available, and future requests will return 404 errors.[2]

https://scratch.mit.edu/varserver/

GET /<project_id>

Returned information regarding the cloud data of a given project.


Example Request
GET https://scratch.mit.edu/varserver/10080213
Example Response


api/v1 Interface (REMOVED)

Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.

As of 23 April 2018, the API v1 interface no longer exists queries to this path are immediately met with HTTP 403 errors.

The API v1 interface is a legacy interface which was originally built during the development of Scratch 2.0. It was accessed via the following URL.

https://scratch.mit.edu/api/v1/

GET /

The root of the API v1 interface provides basic information regarding the API.


Example Request
GET https://scratch.mit.edu/api/v1/
Example Response


Projects

GET /project/<project_id>/

Returns information regarding a project and its author.


Example Request
GET https://scratch.mit.edu/api/v1/project/142/
Example Response


GET /project/set/<project_ids>/

Returns information regarding a set of projects and their authors. Project IDs are separated with a semicolon.


Example Request
GET https://scratch.mit.edu/api/v1/project/set/142;864/
Example Response


Users

GET /user/<username>/

Returns information regarding the given user.


Example Request
GET https://scratch.mit.edu/api/v1/user/mres/
Example Response


GET /user/set/<usernames>/

Returns information regarding the given users. Names should be separated with semicolons. The "userprofile" value for each user object is currently empty making this feature of the API effectively useless. One should note that the single user feature remains functional.


Example Request
GET https://scratch.mit.edu/api/v1/user/set/mres;Gaza101/
Example Response


See Also

This article or section documents an outdated version of Scratch (version 2.0). For this article in Scratch 1.4, see Scratch API (1.4).


References

  1. thisandagain. (26/10/2015). "The “site-api” endpoints are all deprecated as of today." https://scratch.mit.edu/discuss/post/1552554/
  2. thisandagain. (22/5/2018). "Yup. That legacy system has been removed." https://scratch.mit.edu/users/thisandagain/#comments-45728731

External Links