Indepth Solution
Backend API

API Documentation

Complete reference for the Indepth Solution Backend API.

Authentication
All /api/* endpoints require an API key.

Include the key in the X-Api-Key header with every request:

curl -H "X-Api-Key: YOUR_WORKER_API_KEY" \
     https://backend.indepthsolution.net/api/jobs

The API key is set via the WORKER_API_KEY environment variable. Requests without a valid key receive 401 Unauthorized.

Endpoints
All available routes
MethodPathAuthDescription
GET / No Home page (this server's landing page)
GET /status No Server status dashboard with live metrics
GET /docs No This API documentation page
GET /health No JSON health check — uptime, memory, timestamp
POST /api/jobs/run/:jobId X-Api-Key Queue a CronJob for execution via Agenda.js
POST /api/jobs/pause/:jobId X-Api-Key Cancel/pause a running Agenda job
GET /api/jobs/status/:jobId X-Api-Key Get job progress (current, total, message)
POST /api/jobs/start-campaign/:campaignId X-Api-Key Start an email campaign via cold_email_sender job
POST /api/jobs/pause-campaign/:campaignId X-Api-Key Pause an email campaign and cancel queued sends
GET /health
Returns server health information. No authentication required.

Response:

{
  "status": "ok",
  "uptime": 3456.78,
  "timestamp": "2026-02-28T12:00:00.000Z",
  "memory": {
    "used": 45,
    "total": 1024
  },
  "node": "v20.20.0"
}
POST /api/jobs/run/:jobId
Queue a CronJob for execution via Agenda.js. Looks up the job config from MongoDB and dispatches the appropriate handler.

Request body:

{
  "jobType": "google_maps_scraper",
  "config": { "keywords": ["plumber"], "locations": ["New York"] }
}

Response:

{
  "success": true,
  "message": "Job queued",
  "agendaJobId": "65f..."
}
GET /api/jobs/status/:jobId
Returns progress of a CronJob. Poll this endpoint for live progress updates.

Response:

{
  "success": true,
  "data": {
    "status": "running",
    "progress": { "current": 42, "total": 100, "message": "Scraping keyword 3/5" }
  }
}
POST /api/jobs/start-campaign/:campaignId
Start an email campaign. Sets campaign status to "running" and queues the cold_email_sender job via Agenda.

Response:

{
  "success": true,
  "message": "Campaign started"
}
POST /api/jobs/pause-campaign/:campaignId
Pause a running email campaign. Cancels any queued Agenda sends and sets status to "paused".

Response:

{
  "success": true,
  "message": "Campaign paused"
}
Supported Job Types
Background jobs processed by Agenda.js
Job TypeScheduleDescription
google_maps_scraper On-demand Scrapes Google Maps for business leads using Puppeteer. Extracts name, address, phone, website, rating, reviews. Max 500 results per run.
cold_email_sender On-demand Sends campaign emails via SMTP with anti-spam protections (random delays, daily limits, List-Unsubscribe header).
drip_sequence Every hour Finds leads due for their next email step and queues individual cold_email_sender jobs.
bounce_handler Every hour Processes bounced emails, marks leads, tracks domain bounce rates. Auto-pauses campaigns exceeding 5% bounce rate.
Error Codes
Standard HTTP status codes returned by the API
CodeMeaning
200Success
401Unauthorized — missing or invalid X-Api-Key
404Not Found — endpoint doesn't exist
500Internal Server Error — check server logs