Skip to Content
ServerRoutesAPI Routes Overview

API Routes Overview

Complete reference for all server API endpoints.

Base URL

  • Development: http://localhost:5001
  • Production: Your deployed server URL

Authentication

Most routes require authentication. Include the JWT token in the Authorization header:

Authorization: Bearer <your-jwt-token>

User Routes

POST /api/user/signup

Create a new user account.

Body:

{ "name": "John Doe", "email": "john@example.com", "password": "securepassword", "repeatPassword": "securepassword" }

Response:

{ "user": { "id": "123", "name": "John Doe", "email": "john@example.com", "plan": "pro" }, "accessToken": "jwt-token" }

POST /api/user/auth

Login with email and password.

Body:

{ "email": "john@example.com", "password": "securepassword" }

POST /api/user/google-auth

Login or signup with Google OAuth.

Body:

{ "credential": "google-id-token" }

GET /api/user

Get current user information. Requires authentication.

Response:

{ "user": { "id": "123", "name": "John Doe", "email": "john@example.com", "plan": "pro", "isAdmin": false } }

GET /api/user/list

Get list of all users (admin only).

Query Parameters:

  • page - Page number (default: 1)
  • limit - Results per page (default: 20)
  • search - Search by name or email

GET /api/user/:id

Get specific user details (admin only).

PUT /api/user/:id

Update user information (admin only).

DELETE /api/user/:id

Delete a user (admin only).

Billing Routes

GET /api/billing

Get billing information for current user.

Response:

{ "billing": { "currentPlan": "pro", "stripeCustomerId": "cus_123", "oneTimePurchases": [...], "subscriptions": [...] } }

GET /api/billing/history

Get billing history for current user.

Stripe Routes

POST /api/stripe/webhook

Stripe webhook endpoint for payment events.

Events handled:

  • checkout.session.completed
  • customer.subscription.updated
  • customer.subscription.deleted

This endpoint must be publicly accessible and verify Stripe signatures.

Next Steps

Last updated on