ThoughtHive API

RESTful API for Note-Taking Application

Base URL: http://thoughthive-backend.onrender.com

Quick Start

  1. Register: Create a new user account
  2. Login: Get your JWT authentication token
  3. Use Token: Include token in 'auth-token' header for protected routes
  4. Manage Notes: Create, read, update, and delete your notes

Authentication Endpoints

POST /api/auth/signup

Description: Register a new user

{ "name": "John Doe", "email": "john@example.com", "password": "password123" }
POST /api/auth/login

Description: Login and get JWT token

{ "email": "john@example.com", "password": "password123" }
GET /api/auth/getuser

Description: Get user details (Protected)

Headers: auth-token: YOUR_JWT_TOKEN

Notes Endpoints

GET /api/notes/fetchallnotes

Description: Get all user notes (Protected)

Headers: auth-token: YOUR_JWT_TOKEN

POST /api/notes/addnote

Description: Create a new note (Protected)

Headers: auth-token: YOUR_JWT_TOKEN

{ "title": "My Note Title", "description": "Note content here", "tags": "work" // optional }
PUT /api/notes/updatenote/:id

Description: Update existing note (Protected)

Headers: auth-token: YOUR_JWT_TOKEN

{ "title": "Updated Title", "description": "Updated content", "tags": "personal" }
DELETE /api/notes/deletenote/:id

Description: Delete note (Protected)

Headers: auth-token: YOUR_JWT_TOKEN

Usage Example

Step 1: Register → Step 2: Login → Step 3: Copy JWT token → Step 4: Use token in headers for protected routes
// Example using fetch API fetch('http://thoughthive-backend.onrender.com/api/auth/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: 'your@email.com', password: 'yourpassword' }) }) .then(res => res.json()) .then(data => { const token = data.authtoken; // Use this token in subsequent requests });