॥ श्री ॥

Shani Platform API

Software & Apps 2026-09-18

platform.shani.dev is the unified backend for the Shanios commercial planes: fleet management, billing, licensing, notifications, and the org-scoped fleet web console. Both fleet agents (shani-fleet, shani-insights) enroll and report through this same backend. This page is the reference for its HTTP surface; the agent-side enrollment flow is covered in the Fleet Monitoring Runbook.

Authentication Model

  • JSON API (/fleet/, /notify/, /orgs/*, etc.) uses Authorization: Bearer <JWT> — RS256-signed, with kid rotation and GET /.well-known/jwks.json exposing the current key set.
  • Payment webhooks (/billing/webhooks/*) authenticate by provider signature — Stripe, Razorpay, and PayPal signatures are verified server-side.
  • Fleet agent endpoints (heartbeat, task/command results, console polling) additionally require a machine identity derived from the enrollment token — agents authenticate with a per-machine key, not a user JWT.
  • Web console (/fleet/console/*) uses cookie sessions + a per-jti HMAC CSRF token; all mutating console routes go through CSRFMiddleware automatically.
  • Internal server-to-server calls may use an API token (see roadmap item "API_TOKEN Auth for Mutating Routes" in shani-platform's AGENTS.md) — scoped to specific endpoints, never a blanket bypass of the auth above.

Identity & Auth /auth/*

MethodPathPurpose
POST/signupCreate an account (JSON)
POST/loginIssue a session JWT
GET/meCurrent user profile (platform_admin claim included)
POST/logoutRevoke the current session
POST/logout-allRevoke every session
POST/2fa/enableEnable 2FA
POST/2fa/verifyVerify a 2FA code
POST/forgot-passwordRequest a password reset
POST/reset-passwordComplete a password reset
POST/change-passwordChange password (also clears forced-rotation)

SSO login/callback live under /auth/sso:

MethodPathPurpose
GET/auth/sso/{org_slug}/loginOIDC start
GET/auth/sso/{org_slug}/callbackOIDC callback
GET/auth/sso/{org_slug}/saml/metadataSAML SP metadata
GET/auth/sso/{org_slug}/saml/loginSAML login redirect
POST/auth/sso/{org_slug}/saml/acsSAML assertion consumer

Fleet Agent API /fleet/*

Used by the installed agents (shani-fleet, shani-insights — shared endpoints distinguished by a product field):

MethodPathPurpose
POST/fleet/enrollment-tokensCreate an enrollment token (product: "fleet" or "insights")
POST/fleet/enrollEnroll a machine using its token
POST/fleet/heartbeatPeriodic machine heartbeat (drives online/offline state)
POST/fleet/tasks/{task_id}/resultReport a task result
POST/fleet/commands/{command_id}/resultReport a command result
GET/fleet/console-checkPoll for pending console work
GET/fleet/console/commands/pendingFetch pending console commands
POST/fleet/console/commands/{command_id}/outputPush console command output
POST/fleet/console/statsReport console session stats
GET/fleet/console/commands/{command_id}/blobFetch linked blob
POST/fleet/console/commands/{command_id}/blobUpload linked blob
GET/fleet/machinesMachine list (JSON)
GET/fleet/alertsAlert list (JSON)
POST/fleet/groups/{group_name}/commandDispatch a command to a whole group
GET/fleet/evidence/export.jsonEvidence export (JSON)

Fleet Licenses /fleet/licenses/*

MethodPathPurpose
POST/fleet/licenses/issueIssue a machine license
POST/fleet/licenses/renewRenew a machine license
GET/fleet/licenses/statusCurrent license status
POST/fleet/licenses/auto-syncServer-to-server license sync (machine-key authenticated)

Fleet Compliance /fleet/compliance/*

MethodPathPurpose
POST/fleet/compliance/signing-profilesCreate a signing profile
GET/fleet/compliance/signing-profilesList signing profiles
POST/fleet/compliance/mirror-manifestsCreate a mirror manifest
GET/fleet/compliance/mirror-manifests/{org_id}/{channel}Fetch a mirror manifest

Fleet Web Console /fleet/console/*

HTML pages and their backing JSON endpoints — machines, alerts, audit, activity, settings (billing/team/notifications/webhooks/security/sessions/SSO), trust, API tokens, scheduled commands, rings, live stream. Highlights:

MethodPathPurpose
GET/fleet/console/login · /signupCookie-auth pages
GET/fleet/consoleConsole dashboard
GET/fleet/console/machinesMachines page (+ CSV export)
POST/fleet/console/machines/{machine_id}/commandSend a command to a machine
POST/fleet/console/machines/{machine_id}/tasksEnqueue a task
GET/fleet/console/machines/{machine_id}/consoleRemote-console page
POST/fleet/console/machines/{machine_id}/console/execExecute in the remote console
POST/fleet/console/machines/{machine_id}/console/fs/list · read · write · deleteRemote filesystem (path-traversal guarded)
GET/fleet/console/alerts · /alerts/historyAlerts pages
POST/fleet/console/alerts/{alert_id}/resolveResolve an alert
GET/fleet/console/audit · /audit/export.csvAudit log
GET/fleet/console/settings/securitySecurity settings (2FA, allowlist, sessions)
GET/fleet/console/updatesUpdates page
POST/fleet/console/api/tokensIssue an org API token
GET/fleet/console/streamLive event stream

Billing /billing/*

MethodPathPurpose
GET/billing/entitlements/{org_id}Current plan entitlements
GET/billing/payment-providersEnabled payment providers
POST/billing/checkoutCreate a checkout session (Stripe / Razorpay / PayPal)
POST/billing/webhooks/{provider}Provider webhooks (signature-verified)

Notifications /notify/*

MethodPathPurpose
GET/notify/settings · PUTRead/update notification settings
GET/notify/channelsConfigured channels
POST/notify/testSend a test notification
POST/notify/alertRaise an alert
POST/notify/digest/subscribe · /unsubscribeManage digest subscriptions
POST/notify/digest/send-nowBuild and email the current fleet-status digest

Organizations /orgs/*

MethodPathPurpose
POST/orgs/inviteInvite a user
GET/orgs/invite/{token}Resolve an invite
POST/orgs/invite/{token}/acceptAccept an invite

Trust /trust/*

MethodPathPurpose
POST/trust/artifactsRegister a signed artifact
GET/trust/artifacts · /artifacts/{artifact_id}Query artifacts
POST/trust/attestationsRegister an attestation
GET/trust/attestationsQuery attestations

Platform Admin /admin/*

Cross-org read-only views plus account management, gated by require_platform_admin (and the forced-password-rotation gate):

MethodPathPurpose
GET/admin · /admin/orgs · /admin/users · /admin/subscriptionsOverview panes
GET/admin/auditGlobal audit log
POST/admin/users/{user_id}/is_adminPromote/demote a platform admin
POST/admin/orgs · /admin/orgs/{org_id}/planOrg management
GET/admin/coupons · POSTCoupon management
GET/admin/enterprise-leads · POST /enterprise-leads/{lead_id}/contactedEnterprise lead tracking

Infrastructure Endpoints

MethodPathPurpose
GET/.well-known/jwks.jsonCurrent JWK set (JWT key rotation)
GET/metricsPrometheus-style service metrics

See Also