NextGen Digital Studio Back to site

API Documentation

v1
Admin →
REST API

NextGen Digital Studio API

All endpoints return JSON with { ok: boolean }. Base URL: https://nextgendigitalstudio.com. All POST endpoints require a JSON body with Content-Type: application/json.

12 Endpoints7 Lead SourcesAI-Powered
POST/api/contact

Submit Contact Form

Capture a lead from the website contact form.

Request Body
{
  "name": "Tanvir Ahmed",
  "email": "tanvir@example.com",
  "phone": "+8801712345678",
  "company": "Dhaka Realty",
  "service": "AI Chat Agent",
  "message": "Interested in automation"
}
Response
{
  "ok": true,
  "id": "cmqy..."
}
POST/api/book-call

Book Strategy Call

Book a free strategy call. Also creates a lead with source='strategy_call'.

Request Body
{
  "name": "Nusrat Jahan",
  "email": "nusrat@hospital.com",
  "phone": "+8801812345678",
  "service": "AI Voice Agent",
  "date": "2025-02-15",
  "message": "Want to automate appointments"
}
Response
{
  "ok": true,
  "id": "cmqy..."
}
POST/api/newsletter

Newsletter Subscribe

Subscribe an email to the newsletter. Upserts by email.

Request Body
{ "email": "subscriber@example.com" }
Response
{
  "ok": true,
  "id": "cmqy..."
}
POST/api/chat-agent

AI Chat Agent

Send a message to the NextGen AI assistant (GPT-class). Returns a context-aware reply. Bilingual Bangla/English.

Request Body
{
  "message": "What services do you offer?",
  "messages": [
    { "role": "user", "content": "Hi" },
    { "role": "assistant", "content": "Hello! How can I help?" }
  ]
}
Response
{
  "ok": true,
  "reply": "We offer AI Sales Automation..."
}
POST/api/chat-save

Save Chat Conversation

Persist a chat conversation by sessionId. Auto-detects email/phone/name from user messages to create leads.

Request Body
{
  "sessionId": "chat_123_abc",
  "messages": [
    { "role": "user", "content": "My email is rahman@test.com" }
  ]
}
Response
{
  "ok": true,
  "conversationId": "cmqy...",
  "leadId": "cmqy...",
  "detected": { "email": "rahman@test.com" }
}
POST/api/audit

AI Audit Tool

Submit the free AI audit quiz results. Saves a lead with source='ai_audit_tool'.

Request Body
{
  "name": "Rakib Hasan",
  "email": "rakib@example.com",
  "phone": "+8801912345678",
  "industry": "Real Estate",
  "score": 55,
  "responses": ["response=8", "automation=15"]
}
Response
{ "ok": true, "id": "cmqy...", "score": 55 }
POST/api/download

Free Resource Download

Capture a lead when downloading a free resource. Source='free_tools_download'.

Request Body
{
  "name": "Farhana Karim",
  "email": "farhana@example.com",
  "resource": "CRM Automation Checklist"
}
Response
{ "ok": true, "id": "cmqy..." }
POST/api/careers

Job Application

Submit a job application. Saves a lead with source='careers_application'.

Request Body
{
  "name": "Sajid Rahman",
  "email": "sajid@example.com",
  "role": "AI Engineer",
  "portfolio": "https://github.com/sajid",
  "message": "5 years AI experience"
}
Response
{ "ok": true, "id": "cmqy..." }
GET/api/leads

List Leads

Fetch leads with optional source/status filters. Returns leads + aggregate stats.

Response
{
  "ok": true,
  "stats": { "total": 8, "conversations": 0, ... },
  "leads": [ { "id": "cmqy...", "name": "...", ... } ]
}
PATCH/api/leads/[id]

Update Lead

Update a lead's status, notes, and/or assignedTo.

Request Body
{
  "status": "qualified",
  "notes": "Called, interested",
  "assignedTo": "Sales Executive"
}
Response
{ "ok": true, "lead": { "id": "cmqy...", ... } }
DELETE/api/leads/[id]

Delete Lead

Permanently delete a lead.

Response
{ "ok": true }
GET/api/leads/export

Export Leads (CSV)

Download all leads (filtered) as a CSV file. Supports source & status query params.

Response
Content-Type: text/csv
Content-Disposition: attachment; filename="nextgen-leads-2025-01-15.csv"

Name,Email,Phone,Company,Service,Source,Status,...
Tanvir,tanvir@example.com,...

Webhooks (Coming Soon)

Webhook support for real-time lead notifications is on our roadmap. Subscribe to new lead events and get instant POST callbacks to your URL.

NextGen Digital Studio · API Documentation · Built for developers