External API
Maintenance note: Update this file when API endpoints, the Python client, or the conat bridge protocol change.
API Call Flow
Hub API Methods
Accessed via POST /api/conat/hub:
Available Services
| Service | Example Methods |
|---|---|
projects.* | createProject, start, stop, setQuotas, addCollaborator, removeCollaborator |
db.* | Database query operations |
purchases.* | Payment, subscription management |
jupyter.* | Kernel management, code execution |
system.* | Health, version, stats |
messages.* | User messaging |
org.* | Organization management |
Project API Methods
Accessed via POST /api/conat/project:
Available Services
| Service | Methods |
|---|---|
system.ping | Health check |
system.exec | Execute shell commands |
system.jupyterExecute | Run Jupyter code |
Python API Client
Location: python/cocalc-api/
The official Python client library, published as cocalc-api on PyPI.
Structure
Usage
Method Registration
The Python client uses decorators to map methods to conat API calls:
This maps to POST /api/conat/hub with {"name": "projects.createProject", "args": [...]}.
v2 REST API
In addition to the conat bridge, there are traditional REST endpoints at /api/v2/. These are documented in packages/next/pages/api/v2/ and validated with Zod schemas in packages/next/lib/api/schema/.
Authentication
All API requests require an API key via HTTP Bearer or Basic auth:
For Basic auth, the password field is empty. The Next.js bridge validates the key and resolves the associated account_id (or project_id for project-scoped keys) before forwarding to conat.
Only POST requests are accepted — GET is rejected for security.
Error Handling
Async Operations
Some operations support fire-and-forget mode:
Returns { "type": "async", "job_id": "...", "status": "running" }. Poll with async_get: job_id to retrieve results.
Timeouts
Conat bridge default: 15,000ms (15 seconds)
Project bridge uses
waitForInterest: trueto wait for project readinessIndividual operations may have their own timeout parameters