Skip to content

docs: OpenAPI/Swagger documentation for REST API #127

@BillChirico

Description

@BillChirico

The bot exposes a REST API with 8+ route files and 50+ endpoints, but there's no API documentation. This makes it hard for contributors or future dashboard work to know what's available.

Subtasks

  • Generate OpenAPI spec — Add JSDoc-style annotations to route handlers, or write a standalone `openapi.yaml`
  • Swagger UI — Mount `swagger-ui-express` at `/api/docs` (auth-gated)
  • Document all endpoints: auth, config, guilds, health, members, moderation, community, webhooks, conversations (PR feat: AI conversations viewer with search and replay #121)
  • Request/response schemas — Define TypeScript-like schemas for all request bodies and response shapes
  • Error codes — Document all error responses (400, 401, 403, 404, 429, 500)
  • Rate limit headers — Document `X-RateLimit-*` headers returned by rate-limited endpoints
  • Authentication flow — Document Discord OAuth2 flow and session cookie requirements
  • Public vs authenticated — Clearly mark which endpoints require auth and which are public

Technical Notes

  • Consider `swagger-jsdoc` for annotation-based spec generation
  • Alternative: hand-written OpenAPI 3.1 YAML (more control, less coupling)
  • Gate Swagger UI behind auth in production

Acceptance Criteria

  • All API endpoints documented with request/response schemas
  • Swagger UI accessible at `/api/docs` for authenticated admins
  • OpenAPI spec validates with `swagger-cli validate`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions