Skip to content

API Reference

Relevant source files - app.js - config/swagger.js - routes/auth.routes.js - routes/subscription.routes.js - routes/user.routes.js - routes/workflow.routes.js

The Subscription Tracker API provides a RESTful interface for managing user accounts, tracking recurring subscriptions, and automating renewal notifications. The API is versioned under /api/v1 and follows standard HTTP conventions for status codes and methods.

Base Configuration

All endpoints are prefixed with /api/v1 as defined in the main application entry point app.js27-31 The server supports Cross-Origin Resource Sharing (CORS) and parses JSON request bodies app.js20-21

API Architecture Overview The following diagram maps the logical API domains to their respective route handlers in the codebase.

Title: API Domain Mapping

[Flowchart Diagram]

Sources: app.js27-31routes/auth.routes.js4routes/user.routes.js11routes/subscription.routes.js14routes/workflow.routes.js46routes/test.routes.js5


Authentication API

The Authentication domain handles user identity through registration, login, and logout. It utilizes JWT (JSON Web Tokens) for stateless session management.

For details on token issuance and security, see Authentication API.


User Management API

Provides CRUD operations for user profiles. Most endpoints in this domain are protected by the authorize middleware, requiring a valid JWT routes/user.routes.js27-52

For details on data sanitization and authorization guards, see User Management API.


Subscription API

The core of the application, managing the lifecycle of recurring payments. Creating a subscription automatically triggers an asynchronous background workflow for reminders routes/subscription.routes.js82

For details on ownership logic and workflow triggers, see Subscription API.


Workflow and Test APIs

These endpoints handle the integration with Upstash for scheduled tasks and provide diagnostic tools for developers.

For details on the workflow state machine and email testing, see Workflow and Test APIs.


API Documentation and Health

The API includes built-in documentation and health monitoring.

Title: Documentation and Health Infrastructure

[Flowchart Diagram]

  • Health Check: Accessible at /api/v1/health, returning uptime and environment status app.js44-51
  • Swagger UI: Interactive documentation is available at /api-docs/v1/, generated from JSDoc comments in route files app.js32-40config/swagger.js29

Sources: app.js44-51app.js32-40config/swagger.js4-32