API Reference
Sectr exposes a REST API built with FastAPI. All endpoints use JSON request/response bodies. Authentication is via Bearer JWT tokens.
Authentication
JWT access and refresh tokens. Bcrypt password hashing. TOTP and backup codes for 2FA. Session invalidation via Redis.
Servers & Channels
CRUD for servers, channels, and categories. Role-based permissions with 64-bit bitmasks. Channel-level overwrites.
Members & Roles
Server membership, role assignments, permission hierarchy. Invite codes and join requests. Friend system.
Messages & Search
Messages are delivered via WebSocket (Gateway). REST API for search, reactions, and message metadata. Elasticsearch-powered full-text search.
Security
Rate limiting (100 req/min per user). CORS with explicit origin allowlist. Admin endpoints with IP whitelist.
Interactive API Docs
When running the API locally in development mode (DEBUG=true), interactive Swagger (OpenAPI) documentation is available at /docs and ReDoc at /redoc. A public, always-on API reference has not been published yet—the categories above summarize the API surface.
Tech Stack
FastAPI 0.115 (async Python 3.12), SQLAlchemy, Pydantic schemas, PostgreSQL, ScyllaDB, Redis, Elasticsearch, Stripe (billing), S3/R2 (file storage).