API v2
CoCalc API v2 endpoints are validated against an OpenAPI schema so that our documentation expands in lockstep with our API implementation. That documentation can be found at https://cocalc.com/api/v2 .
Source code for the API v2 implementation is in the
CoCalc public GitHub repository under src/packages/next/pages/api/v2. Each “.ts” file under the v2
directory corresponds to an endpoint in the new API. For example, the “stop” endpoint, which allows you to stop a project, has source code at https://github.com/sagemathinc/…/api/v2/projects/stop.ts and is called with the URL https://cocalc.com/api/v2/projects/stop.
Note
For security reasons, API v2 calls must be made with the POST method. This policy supersedes any comments about the availability of GET that may appear in the source code.
Get an API Key
To get started with API v2, you will need a CoCalc account and an API key for that account. To learn how to create an API key, see API Keys.
API v2 Examples
To help get a feel for how one might work with the CoCalc HTTP API, we’ve added some guides and explanations for a handful of useful endpoints below. These are a great jumping-off point for getting started with writing your own integrations with the CoCalc API.