# API Reference Documentation
## sol.aibitsoft.cloud Backend API

**For Frontend Developers**

---

## Base URLs

### Production
```
HTTPS: https://sol.aibitsoft.cloud
HTTP:  http://sol.aibitsoft.cloud
```

### API Base Path
```
/api
```

### Full API Base URL
```
https://sol.aibitsoft.cloud/api
```

---

## Authentication

### Google OAuth
- **Initiate OAuth:** `GET /auth/google`
- **OAuth Callback:** `GET /auth/google/callback`
- **Debug OAuth Config:** `GET /auth/google/debug`

### User Authentication
- **Save User Login:** `POST /api/users/login`
- **Get Current User:** `GET /api/users/me`
- **Get User by Email:** `GET /api/users/email/:email`

---

## API Endpoints

### 📋 Jobs Management

#### List All Jobs
```
GET /api/jobs
```

**Response:**
```json
{
  "success": true,
  "data": [
    {
      "_id": "string",
      "title": "string",
      "description": "string",
      "department": "string",
      "location": "string",
      "employmentType": "string",
      "applicationUrl": "string",
      "status": "string",
      "createdAt": "ISO date",
      "updatedAt": "ISO date"
    }
  ]
}
```

#### Get Job by ID
```
GET /api/jobs/:id
```

**Parameters:**
- `id` (string, required) - MongoDB ObjectId

**Response:**
```json
{
  "success": true,
  "data": { /* job object */ }
}
```

#### Create Job
```
POST /api/jobs
```

**Request Body:**
```json
{
  "title": "string (required)",
  "description": "string",
  "department": "string (required)",
  "location": "string (required)",
  "employmentType": "string (required)",
  "applicationUrl": "string (required)",
  "status": "string (required)"
}
```

#### Update Job
```
PUT /api/jobs/:id
```

**Request Body:**
```json
{
  "title": "string",
  "description": "string",
  "department": "string",
  "location": "string",
  "employmentType": "string",
  "applicationUrl": "string",
  "status": "string"
}
```

#### Delete Job
```
DELETE /api/jobs/:id
```

---

### 📝 Applications Management

#### List All Applications
```
GET /api/applications
```

**Response:**
```json
{
  "success": true,
  "data": [
    {
      "_id": "string",
      "fullName": "string",
      "email": "string",
      "phone": "string",
      "jobId": "string",
      "role": "string",
      "location": "string",
      "resumeUrl": "string",
      "status": "New | Reviewed | Interview | Rejected",
      "createdAt": "ISO date",
      "updatedAt": "ISO date"
    }
  ]
}
```

#### Get Application by ID
```
GET /api/applications/:id
```

#### Create Application (with file upload)
```
POST /api/applications
Content-Type: multipart/form-data
```

**Form Data:**
- `fullName` (string, required)
- `email` (string, required)
- `phone` (string)
- `jobId` (string)
- `role` (string, required)
- `location` (string, required)
- `cv` (file, required) - Max 10MB

**Response:**
```json
{
  "success": true,
  "data": { /* application object */ }
}
```

#### Update Application
```
PUT /api/applications/:id
```

**Request Body:**
```json
{
  "status": "New | Reviewed | Interview | Rejected",
  "fullName": "string",
  "email": "string",
  "phone": "string",
  "role": "string",
  "location": "string"
}
```

#### Delete Application
```
DELETE /api/applications/:id
```

---

### 📄 User Resumes

#### List All User Resumes
```
GET /api/user-resumes
```

**Response:**
```json
{
  "success": true,
  "data": [
    {
      "_id": "string",
      "fullName": "string",
      "email": "string",
      "phoneNumber": "string",
      "cvURL": "string",
      "coverNote": "string",
      "jobId": "string",
      "positionTitle": "string",
      "createdAt": "ISO date",
      "updatedAt": "ISO date"
    }
  ]
}
```

#### Create User Resume (with file upload)
```
POST /api/user-resumes
Content-Type: multipart/form-data
```

**Form Data:**
- `fullName` (string, required)
- `email` (string, required)
- `phoneNumber` (string)
- `cv` (file, required) - Max 10MB
- `coverNote` (string)
- `jobId` (string)
- `positionTitle` (string)

---

### 👥 Team Members

#### List All Team Members
```
GET /api/team-members
```

**Response:**
```json
{
  "success": true,
  "data": [
    {
      "_id": "string",
      "name": "string",
      "role": "string",
      "img": "string",
      "category": "string",
      "bio": "string",
      "socialLinks": {},
      "createdAt": "ISO date",
      "updatedAt": "ISO date"
    }
  ]
}
```

#### Get Team Member by ID
```
GET /api/team-members/:id
```

#### Create Team Member
```
POST /api/team-members
```

**Request Body:**
```json
{
  "name": "string (required)",
  "role": "string",
  "img": "string (required)",
  "category": "string (required)",
  "bio": "string",
  "socialLinks": {}
}
```

#### Seed Team Members
```
POST /api/team-members/seed
```

**Response:**
```json
{
  "success": true,
  "data": {
    "message": "Team members seeded successfully",
    "results": []
  }
}
```

#### Update Team Member
```
PUT /api/team-members/:id
```

#### Delete Team Member
```
DELETE /api/team-members/:id
```

---

### 📰 Blogs

#### List All Blogs
```
GET /api/blogs
```

**Response:**
```json
{
  "success": true,
  "data": [
    {
      "_id": "string",
      "category": "string",
      "description": "string",
      "status": "string",
      "components": [],
      "heroSection": {},
      "createdAt": "ISO date",
      "updatedAt": "ISO date"
    }
  ]
}
```

#### Get Blog by Category
```
GET /api/blogs/category/:category
```

**Parameters:**
- `category` (string, required) - Blog category name

#### Get Blog by ID
```
GET /api/blogs/:id
```

#### Create Blog
```
POST /api/blogs
```

**Request Body:**
```json
{
  "category": "string (required)",
  "description": "string",
  "status": "string",
  "components": [],
  "heroSection": {}
}
```

#### Update Blog
```
PUT /api/blogs/:id
```

#### Update Blog Hero Section
```
PUT /api/blogs/category/:category/hero
```

**Request Body:**
```json
{
  "title": "string",
  "subtitle": "string",
  "cta": {}
}
```

#### Update Blog Component
```
PUT /api/blogs/category/:category/component/:componentId
```

**Request Body:**
```json
{
  "componentType": "string",
  "componentName": "string",
  "data": {},
  "order": "number",
  "enabled": "boolean"
}
```

#### Update Blog by Category
```
PUT /api/blogs/category/:category
```

#### Delete Blog
```
DELETE /api/blogs/:id
```

---

### 📊 Blog Static Data

#### Get Static Data by Category
```
GET /api/blog-static-data/:category
```

**Parameters:**
- `category` (string, required) - Blog category name

**Response:**
```json
{
  "success": true,
  "data": {
    "category": "string",
    "message": "string",
    "data": {}
  }
}
```

---

### 🎥 Zoom Meetings

#### List All Zoom Meetings
```
GET /api/
GET /api
```

**Response:**
```json
{
  "success": true,
  "data": [
    {
      "_id": "string",
      "zoomMeetingId": "string",
      "topic": "string",
      "startTime": "ISO date",
      "duration": "number",
      "timezone": "string",
      "joinUrl": "string",
      "startUrl": "string",
      "meetingNumber": "string",
      "password": "string",
      "fullName": "string",
      "email": "string",
      "meetingType": "string",
      "preferredMeetingTime": "string",
      "attendees": [],
      "status": "Scheduled | Completed | Cancelled | In Progress",
      "hostUserId": "string",
      "createdAt": "ISO date",
      "updatedAt": "ISO date"
    }
  ]
}
```

#### Get Zoom Meeting by ID
```
GET /api/:id
```

#### Get Zoom Meeting by Zoom ID
```
GET /api/zoom/:zoomId
```

#### Schedule Zoom Meeting
```
POST /api/schedule-zoom
```

**Request Body:**
```json
{
  "title": "string (required)",
  "date": "string (required)",
  "time": "string (required)",
  "duration": "number (required)",
  "timezone": "string (required)",
  "participants": "array (required)",
  "fullName": "string",
  "email": "string",
  "meetingType": "string"
}
```

#### Create Zoom Meeting (Legacy)
```
POST /api/create-meeting
POST /api/
```

**Request Body:**
```json
{
  "fullName": "string (required)",
  "email": "string (required)",
  "meetingType": "string",
  "preferredMeetingTime": "string (required)",
  "projectDescription": "string",
  "additionalNotes": "string"
}
```

#### Cancel Zoom Meeting
```
PUT /api/:id/cancel
```

#### Update Zoom Meeting
```
PUT /api/:id
```

**Request Body:**
```json
{
  "status": "Scheduled | Completed | Cancelled | In Progress",
  "topic": "string",
  "startTime": "ISO date",
  "duration": "number"
}
```

#### Delete Zoom Meeting
```
DELETE /api/:id
```

---

### 📅 Google Meet

#### List All Google Meet Meetings
```
GET /api/google-meet
```

**Response:**
```json
{
  "success": true,
  "data": [
    {
      "_id": "string",
      "eventId": "string",
      "calendarId": "string",
      "title": "string",
      "description": "string",
      "startTime": "ISO date",
      "endTime": "ISO date",
      "timezone": "string",
      "meetLink": "string",
      "fullName": "string",
      "email": "string",
      "meetingType": "string",
      "attendees": [],
      "status": "Scheduled | Completed | Cancelled | In Progress",
      "hostUserId": "string",
      "createdAt": "ISO date",
      "updatedAt": "ISO date"
    }
  ]
}
```

#### Get Google Meet by ID
```
GET /api/google-meet/:id
```

#### Get Google Meet by Event ID
```
GET /api/google-meet/event/:eventId
```

#### Schedule Google Meet
```
POST /api/google-meet/schedule-google-meet
```

**Request Body:**
```json
{
  "title": "string (required)",
  "date": "string (required)",
  "time": "string (required)",
  "duration": "number (required)",
  "timezone": "string (required)",
  "participants": "array (required)",
  "fullName": "string",
  "email": "string",
  "meetingType": "string"
}
```

#### Create Google Meet (Legacy)
```
POST /api/google-meet/create-google-meet
POST /api/google-meet
```

**Request Body:**
```json
{
  "fullName": "string (required)",
  "email": "string (required)",
  "meetingType": "string",
  "preferredMeetingTime": "string (required)",
  "projectDescription": "string",
  "additionalNotes": "string"
}
```

#### Cancel Google Meet
```
PUT /api/google-meet/:id/cancel
```

#### Update Google Meet
```
PUT /api/google-meet/:id
```

**Request Body:**
```json
{
  "status": "Scheduled | Completed | Cancelled | In Progress",
  "title": "string",
  "startTime": "ISO date",
  "duration": "number"
}
```

#### Delete Google Meet
```
DELETE /api/google-meet/:id
```

---

### 🎨 Templates

#### List All Templates
```
GET /api/templates
```

**Response:**
```json
{
  "success": true,
  "data": [
    {
      "_id": "string",
      "title": "string",
      "description": "string",
      "previewImage": "string",
      "type": "string",
      "category": "string",
      "createdAt": "ISO date",
      "updatedAt": "ISO date"
    }
  ]
}
```

#### Get Template by ID
```
GET /api/templates/:id
```

#### Create Template (with image upload)
```
POST /api/templates
Content-Type: multipart/form-data
```

**Form Data:**
- `title` (string, required)
- `description` (string)
- `previewImage` (file, required)
- `type` (string)
- `category` (string)

#### Delete Template
```
DELETE /api/templates/:id
```

---

### 📧 Interview Email

#### Send Interview Email
```
POST /api/interviews/send-email
```

**Request Body:**
```json
{
  "candidateName": "string (required)",
  "candidateEmail": "string (required)",
  "role": "string (required)",
  "interviewDate": "ISO date (required)",
  "interviewType": "string (required)",
  "interviewer": "string (required)",
  "interviewTime": "string",
  "location": "string",
  "additionalNotes": "string"
}
```

---

### 📝 Contact Form

#### Submit Contact Form
```
POST /api/contact
```

**Request Body:**
```json
{
  "name": "string (required)",
  "email": "string (required)",
  "phone": "string (required)",
  "services": "array (required, min 1)",
  "message": "string",
  "company": "string"
}
```

**Response:**
```json
{
  "ok": true,
  "message": "Contact form submitted successfully"
}
```

---

### 💼 Proposal Form

#### Submit Proposal Form
```
POST /api/proposal
```

**Request Body:**
```json
{
  "name": "string (required, min 2 chars)",
  "email": "string (required)",
  "phone": "string (required)",
  "services": "array (required, min 1)",
  "company": "string",
  "budget": "string",
  "timeline": "string",
  "message": "string"
}
```

**Response:**
```json
{
  "ok": true,
  "message": "Proposal form submitted successfully"
}
```

---

### 👨‍💼 Book Expert Form

#### Submit Book Expert Form
```
POST /api/book-expert
```

**Request Body:**
```json
{
  "name": "string (required)",
  "email": "string (required)",
  "phone": "string (required)",
  "services": "array (required, min 1)",
  "preferredDate": "string",
  "preferredTime": "string",
  "message": "string"
}
```

**Response:**
```json
{
  "ok": true,
  "message": "Book expert form submitted successfully"
}
```

---

### 🤝 Partner Form

#### Submit Partner Form
```
POST /api/partner
```

**Request Body:**
```json
{
  "name": "string (required, min 2 chars)",
  "email": "string (required)",
  "phone": "string (required)",
  "partnershipType": "string (required)",
  "company": "string",
  "message": "string"
}
```

**Response:**
```json
{
  "ok": true,
  "message": "Partner form submitted successfully"
}
```

---

### 👤 User Management

#### Save User Login
```
POST /api/users/login
```

**Request Body:**
```json
{
  "provider": "string (required)",
  "providerId": "string (required)",
  "email": "string (required)",
  "name": "string (required)",
  "picture": "string"
}
```

#### Get User by Email
```
GET /api/users/email/:email
```

**Parameters:**
- `email` (string, required) - User email address

**Response:**
```json
{
  "success": true,
  "data": {
    "_id": "string",
    "email": "string",
    "name": "string",
    "picture": "string",
    "provider": "string",
    "providerId": "string",
    "createdAt": "ISO date",
    "updatedAt": "ISO date"
  }
}
```

#### Get Current User
```
GET /api/users/me
```

**Note:** May require authentication token

---

### 🔐 Authentication

#### Debug OAuth Configuration
```
GET /auth/google/debug
```

**Response:**
```json
{
  "backendUrl": "string",
  "frontendUrl": "string",
  "callbackUrl": "string",
  "clientId": "string",
  "clientSecret": "string",
  "jwtSecret": "string",
  "message": "string",
  "instructions": "string",
  "requiredEnvVars": {}
}
```

#### Initiate Google OAuth
```
GET /auth/google
```

**Note:** Redirects to Google OAuth consent screen

#### Google OAuth Callback
```
GET /auth/google/callback?code=:code
```

**Note:** Handled automatically by OAuth flow, redirects to frontend

---

## Common Response Formats

### Success Response
```json
{
  "success": true,
  "data": { /* response data */ }
}
```

### Error Response
```json
{
  "success": false,
  "error": "Error message",
  "errors": {
    "formErrors": [],
    "fieldErrors": {
      "fieldName": ["Error message"]
    }
  }
}
```

### Alternative Success Format (Some endpoints)
```json
{
  "ok": true,
  "message": "Success message",
  "data": { /* response data */ }
}
```

### Alternative Error Format (Some endpoints)
```json
{
  "ok": false,
  "error": "Error message",
  "errors": {
    "formErrors": [],
    "fieldErrors": {}
  }
}
```

---

## HTTP Status Codes

- `200 OK` - Request successful
- `201 Created` - Resource created successfully
- `400 Bad Request` - Validation error or invalid request
- `401 Unauthorized` - Authentication required
- `404 Not Found` - Resource not found
- `500 Internal Server Error` - Server error

---

## File Upload Endpoints

### Endpoints that accept file uploads:

1. **Applications** - `POST /api/applications`
   - Field name: `cv`
   - Max size: 10MB
   - Content-Type: `multipart/form-data`

2. **User Resumes** - `POST /api/user-resumes`
   - Field name: `cv`
   - Max size: 10MB
   - Content-Type: `multipart/form-data`

3. **Templates** - `POST /api/templates`
   - Field name: `previewImage`
   - Content-Type: `multipart/form-data`

---

## CORS Configuration

- **Origin:** Configured to allow requests from frontend
- **Credentials:** Supported (cookies/auth headers)
- **Methods:** GET, POST, PUT, DELETE, OPTIONS

---

## Rate Limiting

Currently no rate limiting implemented. Use responsibly.

---

## Example Usage

### JavaScript/Fetch Example

```javascript
// Base URL
const API_BASE_URL = 'https://sol.aibitsoft.cloud/api';

// GET Request
async function getJobs() {
  const response = await fetch(`${API_BASE_URL}/jobs`);
  const data = await response.json();
  return data;
}

// POST Request
async function createJob(jobData) {
  const response = await fetch(`${API_BASE_URL}/jobs`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(jobData),
  });
  const data = await response.json();
  return data;
}

// File Upload
async function uploadApplication(formData) {
  const response = await fetch(`${API_BASE_URL}/applications`, {
    method: 'POST',
    body: formData, // FormData object with file
  });
  const data = await response.json();
  return data;
}
```

### Axios Example

```javascript
import axios from 'axios';

const api = axios.create({
  baseURL: 'https://sol.aibitsoft.cloud/api',
  headers: {
    'Content-Type': 'application/json',
  },
});

// GET Request
const getJobs = async () => {
  const response = await api.get('/jobs');
  return response.data;
};

// POST Request
const createJob = async (jobData) => {
  const response = await api.post('/jobs', jobData);
  return response.data;
};

// File Upload
const uploadApplication = async (formData) => {
  const response = await api.post('/applications', formData, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
  return response.data;
};
```

---

## Notes for Frontend Developers

1. **Base URL:** Always use `https://sol.aibitsoft.cloud/api` for production
2. **HTTPS:** All endpoints support HTTPS (recommended)
3. **Trailing Slashes:** Both `/api/jobs` and `/api/jobs/` work
4. **Error Handling:** Always check `success` or `ok` field in responses
5. **File Uploads:** Use `FormData` for file upload endpoints
6. **Validation:** Check `errors.fieldErrors` for validation errors
7. **IDs:** Use MongoDB ObjectId format (24 character hex string)
8. **Dates:** ISO 8601 format for date strings
9. **OAuth:** Use `/auth/google` to initiate Google OAuth flow
10. **CORS:** Configured to work with frontend, credentials supported

---


**Last Updated:** January 17, 2026  
**API Version:** 1.0.0  
**Base URL:** https://sol.aibitsoft.cloud

