CoBlocksGet CoBlocks→
Skip to guide
Wiki/Technical
COBLOCKS WIKI

HTTP API & live events

A source-linked reference for the routes used by the extension and the live collaboration message families.

CoBlocks user guide
On this pageBase URL and authenticationAuthentication routesProject and sync routesAccess, invites, and friendsChat and backpackLive message familiesLookup and operator routes

Base URL and authentication

The production extension uses https://livescratchapi.waakul.com/apiv2. Socket.IO uses /apiv2/socket.io. A custom-server setting takes an origin; the extension constructs its API base. Source routes are the authoritative contract for compatible clients.

Protected HTTP calls use the authorization header containing the CoBlocks token. Some routes also take uname in a header, path, or request body. These are not interchangeable; follow the specific handler. Do not embed tokens in URLs.

Typical failures include 401 for rejected authentication, 403 for denied project/owner access, 404 for missing records, and 429 for rate limiting. Error bodies vary by route (for example noauth, noaccess, or err); callers must inspect HTTP status and body.

Authentication routes

Route under /apiv2Purpose
POST /auth/scratch/startBegins a short-lived login and returns a state and provider URL.
GET /auth/scratch/callbackReceives and verifies the Scratch Auth provider callback.
GET /auth/scratch/completeCompletes the browser-to-extension handoff.
POST /auth/scratch/finishExchanges completed handoff state for a backend login.
POST /auth/sessionValidates a token against the stated Scratch username.
POST /auth/logoutInvalidates a CoBlocks session.

Project and sync routes

RoutePurpose
POST /newProject/:scratchId/:ownerCreates a collaboration from a Scratch project snapshot.
GET /lsId/:scratchId/:unameResolves a Scratch copy to a collaboration.
PUT /linkScratch/:scratchId/:lsId/:ownerLinks a Scratch copy to a collaboration, with conflict checks.
GET /projectJSON/:lsIdFetches a project snapshot for an authorized user.
POST /projectSavedJSON/:lsId/:versionPersists a saved snapshot/version.
GET /changesSince/:id/:versionRetrieves changes after a known version.
GET /active/:lsIdLists active project participants.
GET /userProjectsScratch/:userLists eligible project cards and Scratch links.
PUT /leaveScratchId/:scratchId/:username or /leaveLSId/:lsId/:usernameLeaves or unlinks membership via the indicated identifier.

Access, invites, and friends

RoutePurpose
GET /share/:idReads project membership.
PUT /share/:id/:to/:fromOwner adds a collaborator.
PUT /unshare/:id/:toOwner removes a collaborator.
POST /invite/:idOwner creates/replaces the seven-day invite.
DELETE /invite/:idOwner revokes the current invite.
POST /invite/:id/acceptAuthenticated user submits a token to gain membership.
GET /friends/:user; POST /friends/:user/:friend; DELETE /friends/:user/:friendRead, add, and remove CoBlocks friend entries.
GET /privateMe/:username; PUT /privateMe/:username/:privateRead/update the public usage-badge privacy preference.
GET /userExists/:usernameReports public CoBlocks usage subject to privacy settings.

Chat and backpack

RoutePurpose
GET /chat/:idLoads authorized project chat history.
GET /backpack/:idReads project scripts.
POST /backpack/:idValidates and stores a script item.
DELETE /backpack/:id/:itemIdOwner or item creator removes a script.

Live message families

The Socket.IO connection receives message envelopes dispatched by meta. Implemented handlers include joinSession, joinSessions, leaveSession, projectChange, setTitle, setCursor, pointer, and chat.

Live edit/chat/pointer operations require project access and a joined identity. The pointer path accepts Code-workspace coordinates and target identity; it is not a generic page-coordinate broadcast.

Lookup and operator routes

Admin routes are operator endpoints, not public user settings or a versioned third-party SDK. The ADMIN_USER environment value configures HTTP Basic Auth. The ADMIN username list separately enables privileged in-chat broadcast handling. Review those handlers and restrict operator access before exposing a custom service.

RoutePurpose / access
GET /API service response.
GET /scratchIdInfo/:scratchIdReads a Scratch-copy mapping subject to the handler’s project access checks.
GET /projectTitle/:idReads the collaboration’s project title.
GET /userRedirect/:scratchId/:usernameDetermines which linked copy to open or whether to create one.
GET /userProjects/:userLists eligible shared collaboration IDs.
POST /auth/scratch/ackAcknowledges an issued login token and clears the pending handoff.
GET /dau/:daysAggregate recent-usage count; days must be greater than zero and at most 365.
GET /statsHTTP Basic Auth protected operator statistics.
GET /banned; PUT /ban/:username; PUT /unban/:usernameHTTP Basic Auth protected moderation endpoints.
GET /html/*Static backend HTML resources.

Source references

Check the code and release notes if your installed build looks different.

backend/index.js ↗backend/WebSockets.js ↗backend/utils/scratch-auth.js ↗
Latest release notes ↗
Something different in your build? Report a documentation issue ↗