API reference
The Cosmogov web app uses JSON endpoints on the same origin as the site. These examples use the session of the signed-in account.
Authentication
Sign in on the site, or send an email and password as JSON to POST /api/auth/login. A successful login sets the HTTP-only cosmogov_session cookie and returns a profile. A browser sends the cookie on same-origin requests. A command-line client needs a cookie jar.
Keep session cookies and passwords private. Account roles and community membership determine what the session can access.
Read data
This example fetches the missions visible to the signed-in user.
// Run on your Cosmogov site's origin after signing in.
const response = await fetch("/api/missions");
if (!response.ok) {
throw new Error(`Cosmogov returned ${response.status}`);
}
const missions = await response.json();GET /api/auth/me- Returns the signed-in account profile.
GET /api/organizations- Lists communities the signed-in user belongs to, including their role and membership and proposal counts.
GET /api/missions- Lists up to 50 personal or community missions the signed-in user can access, ordered by last update.
GET /api/proposals- Lists up to 50 visible proposals. Filter by status, orgId, search, or category.
GET /api/participation/accountability- Returns accessible participation milestones and recent mission outcomes.
Handle errors
Check the HTTP status before reading the result. A protected request can return 401 if the session is missing or expired, or 403 if the account lacks permission. Some writes return 429 when their rate limit is reached.