REST API Reference
Base URL: https://api.coldrune.com (or your self-hosted instance)
All responses use JSON. Errors follow the format:
Authentication
Section titled “Authentication”Most endpoints require one of:
Authorization: Bearer <session-token>— for human usersX-API-Key: cr_sa_...— for service accounts
POST /api/auth/login
Section titled “POST /api/auth/login”Request a magic link login code.
Returns 200 with {"message": "..."}. The 6-digit code is sent via email (or printed to server logs in dev mode).
POST /api/auth/verify
Section titled “POST /api/auth/verify”Verify the login code and receive a session token.
Returns 200 with {"token": "..."}.
DELETE /api/auth/logout
Section titled “DELETE /api/auth/logout”Invalidate the current session. Requires auth.
GET /api/auth/me
Section titled “GET /api/auth/me”Return the authenticated user’s profile. Requires auth.
Organizations
Section titled “Organizations”POST /api/orgs
Section titled “POST /api/orgs”Create an organization. Requires auth. Caller becomes owner.
GET /api/orgs
Section titled “GET /api/orgs”List organizations the user is a member of. Superadmins see all.
GET /api/orgs/{org_name}
Section titled “GET /api/orgs/{org_name}”Get organization details.
PATCH /api/orgs/{org_name}
Section titled “PATCH /api/orgs/{org_name}”Rename an organization. Requires owner role.
DELETE /api/orgs/{org_name}
Section titled “DELETE /api/orgs/{org_name}”Soft-delete an organization. Requires owner role.
Members
Section titled “Members”POST /api/orgs/{org_name}/members
Section titled “POST /api/orgs/{org_name}/members”Invite a user to the organization. Requires admin+ role.
Roles: owner, admin, developer, member.
GET /api/orgs/{org_name}/members
Section titled “GET /api/orgs/{org_name}/members”List organization members.
PATCH /api/orgs/{org_name}/members/{user_id}
Section titled “PATCH /api/orgs/{org_name}/members/{user_id}”Update a member’s role. Requires owner role.
DELETE /api/orgs/{org_name}/members/{user_id}
Section titled “DELETE /api/orgs/{org_name}/members/{user_id}”Remove a member. Requires admin+ role.
Projects
Section titled “Projects”POST /api/orgs/{org_name}/projects
Section titled “POST /api/orgs/{org_name}/projects”Create a project. Automatically creates dev, staging, prod environments. Requires admin+ role.
GET /api/orgs/{org_name}/projects
Section titled “GET /api/orgs/{org_name}/projects”List projects in the organization.
GET /api/orgs/{org_name}/projects/{project_name}
Section titled “GET /api/orgs/{org_name}/projects/{project_name}”Get project details.
PATCH /api/orgs/{org_name}/projects/{project_name}
Section titled “PATCH /api/orgs/{org_name}/projects/{project_name}”Rename a project. Requires admin+ role.
DELETE /api/orgs/{org_name}/projects/{project_name}
Section titled “DELETE /api/orgs/{org_name}/projects/{project_name}”Soft-delete a project. Requires admin+ role.
Environments
Section titled “Environments”POST /api/orgs/{org_name}/projects/{project_name}/envs
Section titled “POST /api/orgs/{org_name}/projects/{project_name}/envs”Create an environment. Requires admin+ role.
GET /api/orgs/{org_name}/projects/{project_name}/envs
Section titled “GET /api/orgs/{org_name}/projects/{project_name}/envs”List environments in a project.
DELETE /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}
Section titled “DELETE /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}”Delete an environment. Requires admin+ role.
Secrets
Section titled “Secrets”PUT /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}/secrets/{key}
Section titled “PUT /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}/secrets/{key}”Set (create or update) a secret. Requires write permission.
Returns the secret metadata with version number:
GET /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}/secrets/{key}
Section titled “GET /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}/secrets/{key}”Get a secret’s decrypted value. Requires read permission.
GET /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}/secrets
Section titled “GET /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}/secrets”List secret keys. Values are not returned. Requires read permission.
DELETE /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}/secrets/{key}
Section titled “DELETE /api/orgs/{org_name}/projects/{project_name}/envs/{env_name}/secrets/{key}”Soft-delete a secret. Requires write permission.
Access Control (ACL)
Section titled “Access Control (ACL)”POST /api/orgs/{org_name}/acl
Section titled “POST /api/orgs/{org_name}/acl”Grant an ACL rule. Upserts if the same subject + pattern combination exists. Requires admin+ role.
For service accounts, use "subject_type": "service_account" and "subject_id": "<sa-id>" instead of email.
GET /api/orgs/{org_name}/acl
Section titled “GET /api/orgs/{org_name}/acl”List ACL rules for the organization. Requires admin+ role.
DELETE /api/orgs/{org_name}/acl/{rule_id}
Section titled “DELETE /api/orgs/{org_name}/acl/{rule_id}”Revoke an ACL rule. Requires admin+ role.
Service Accounts
Section titled “Service Accounts”POST /api/orgs/{org_name}/service-accounts
Section titled “POST /api/orgs/{org_name}/service-accounts”Create a service account. The API key is returned once and cannot be retrieved again. Requires admin+ role.
project is optional. Omit to create an org-scoped service account.
Response:
GET /api/orgs/{org_name}/service-accounts
Section titled “GET /api/orgs/{org_name}/service-accounts”List service accounts in the organization. Requires admin+ role.
DELETE /api/orgs/{org_name}/service-accounts/{sa_id}
Section titled “DELETE /api/orgs/{org_name}/service-accounts/{sa_id}”Revoke a service account. Cascades soft-delete to its ACL rules. Requires admin+ role.
Audit Logs
Section titled “Audit Logs”GET /api/orgs/{org_name}/audit-logs
Section titled “GET /api/orgs/{org_name}/audit-logs”Query audit logs. Requires admin+ role or superadmin.
Query parameters:
| Parameter | Description |
|---|---|
action | Filter by action (e.g. secret.set, org.create) |
actor_id | Filter by actor ID |
resource_type | Filter by resource type (e.g. secret, org) |
limit | Max results (1-100, default 20) |
after | Pagination cursor from previous response |
Response:
Backups
Section titled “Backups”POST /api/backups
Section titled “POST /api/backups”Create a manual backup. Returns the backup metadata.
GET /api/backups
Section titled “GET /api/backups”List all backups.
POST /api/backups/{backup_id}/restore
Section titled “POST /api/backups/{backup_id}/restore”Restore from a backup. Downloads and decrypts the backup to {db_path}.restore.{id}. The operator must manually stop the server, swap the database file, and restart.
Health
Section titled “Health”GET /health
Section titled “GET /health”No authentication required.