AstroGuru API Documentation

Complete API reference for the horoscope service

← Back to App

Base URL

https://astro-guru-1.netlify.app/.netlify/functions

Authentication

POST /auth-signup

Description

Register a new user with automatic zodiac sign detection

Request Body

{ "name": "John Doe", "email": "john@example.com", "password": "MyPassword123", "birthdate": "1990-06-15" }

Example Request

curl -X POST https://astro-guru-1.netlify.app/.netlify/functions/auth-signup \ -H "Content-Type: application/json" \ -d '{ "name": "John Doe", "email": "john@example.com", "password": "MyPassword123", "birthdate": "1990-06-15" }'

Response Example

{ "success": true, "message": "User created successfully", "data": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "user": { "id": "...", "name": "John Doe", "email": "john@example.com", "birthdate": "1990-06-15T00:00:00.000Z", "zodiacSign": "gemini" } } }
POST /auth-login

Description

Login with email and password

Request Body

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

Example Request

curl -X POST https://astro-guru-1.netlify.app/.netlify/functions/auth-login \ -H "Content-Type: application/json" \ -d '{ "email": "john@example.com", "password": "MyPassword123" }'
GET /auth-profile 🔒 Auth Required

Description

Get current user profile information

Headers

Authorization: Bearer YOUR_JWT_TOKEN

Example Request

curl -X GET https://astro-guru-1.netlify.app/.netlify/functions/auth-profile \ -H "Authorization: Bearer YOUR_JWT_TOKEN"

Horoscope

GET /horoscope-today 🔒 Auth Required

Description

Get today's horoscope for the authenticated user

Example Request

curl -X GET https://astro-guru-1.netlify.app/.netlify/functions/horoscope-today \ -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response Example

{ "success": true, "data": { "horoscope": { "id": "...", "date": "2025-08-30T00:00:00.000Z", "content": "Today brings fiery energy your way! Your natural leadership qualities will shine...", "zodiacSign": "gemini", "zodiacInfo": { "element": "Air", "planet": "Mercury", "symbol": "♊", "dates": "May 21 - June 20" } } } }
GET /horoscope-history 🔒 Auth Required

Description

Get the last 7 days of horoscope history

Example Request

curl -X GET https://astro-guru-1.netlify.app/.netlify/functions/horoscope-history \ -H "Authorization: Bearer YOUR_JWT_TOKEN"

Response Example

{ "success": true, "data": { "horoscopes": [ { "id": "...", "date": "2025-08-30T00:00:00.000Z", "content": "Today brings fiery energy your way!", "zodiacSign": "gemini" }, // ... more horoscopes ], "zodiacInfo": { ... }, "totalCount": 7 } }

Complete Workflow Examples

1. Register and Get Today's Horoscope

# Step 1: Register RESPONSE=$(curl -s -X POST https://astro-guru-1.netlify.app/.netlify/functions/auth-signup \ -H "Content-Type: application/json" \ -d '{ "name": "Jane Smith", "email": "jane@example.com", "password": "SecurePass123", "birthdate": "1992-12-03" }') # Step 2: Extract token TOKEN=$(echo $RESPONSE | grep -o '"token":"[^"]*"' | cut -d'"' -f4) # Step 3: Get today's horoscope curl -X GET https://astro-guru-1.netlify.app/.netlify/functions/horoscope-today \ -H "Authorization: Bearer $TOKEN"

Password Requirements

  • Minimum 6 characters
  • At least one uppercase letter
  • At least one lowercase letter
  • At least one number

Error Responses

All endpoints return errors in this format:

{ "success": false, "message": "Error description", "errors": [ /* validation errors if applicable */ ] }

Rate Limiting

API endpoints are rate limited to prevent abuse:

  • Auth endpoints: 10 requests per 15 minutes
  • Horoscope endpoints: 5 requests per minute