Complete REST API reference for NextGenERP backend
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /health | Public | Health check — returns { status: "ok" } |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /auth/register | Public | Register a new user account |
| POST | /auth/login | Public | Login with email & password |
| POST | /auth/forgot-password | Public | Request password reset OTP via email |
| POST | /auth/reset-password | Public | Reset password with OTP verification |
| POST | /auth/refresh | Public | Refresh access token using refresh token |
| POST | /auth/verify-otp | Public | Verify email OTP after registration |
| POST | /auth/resend-otp | Public | Resend OTP to email |
| GET | /auth/tenants | Auth | List all tenants accessible to the user |
| POST | /auth/switch-tenant | Auth | Switch active tenant context |
| GET | /auth/google | Public | Initiate Google OAuth flow |
| GET | /auth/google/callback | Public | Google OAuth callback handler |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /users/me | Auth | Get current user profile & permissions |
| PATCH | /users/me | Auth | Update own profile |
| POST | /users/me/change-password | Auth | Change own password |
| POST | /users/invites/accept | Public | Accept a team invitation |
| GET | /users/hierarchy | User Management: canView | Get organization user hierarchy |
| GET | /users/export | User Management: canExport | Export users as CSV |
| POST | /users/import | User Management: canCreate | Import users from CSV |
| GET | /users | User Management: canView | List team members with filters |
| POST | /users/invite | User Management: canCreate Limit | Invite a new team member |
| GET | /users/:id | User Management: canView | Get single user details |
| PATCH | /users/:id | User Management: canEdit | Update user details |
| GET | /users/:id/permissions | User Management: canView | Get user permissions |
| PUT | /users/:id/permissions | User Management: canEdit | Set user permissions |
| GET | /users/:id/organization-access | User Management: canView | Get user's organization access info |
| GET | /users/:id/settings | User Management: canView | Get user settings |
| PATCH | /users/:id/settings | User Management: canEdit | Update user settings |
| PATCH | /users/:id/role | User Management: canEdit | Update member role |
| PATCH | /users/:id/reactivate | User Management: canEdit | Reactivate a deactivated member |
| DELETE | /users/:id | User Management: canDelete | Deactivate a team member |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /organizations/my-organization | tenant_admin / super_admin / admin | Get current user's organization details (read-only for admin) |
| GET | /organizations/my-organization/tenants | tenant_admin / super_admin / admin | List all tenants in the organization (read-only for admin) |
| GET | /organizations/my-organization/stats | tenant_admin / super_admin / admin | Get organization statistics (read-only for admin) |
| GET | /organizations | Auth | List all organizations (super_admin only) |
| GET | /organizations/sub-tenants | tenant_admin / super_admin / admin | List sub-tenants under the current root tenant (read-only for admin) |
| POST | /organizations/sub-tenants | tenant_admin / super_admin | Create a sub-tenant under the current root tenant (subject to plan maxSubTenants limit) |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /subscription/plans | Public | List visible subscription plans |
| GET | /subscription | Auth | Get current tenant subscription |
| GET | /subscription/usage | Auth | Get resource usage stats |
| POST | /subscription/select | Auth | Select or change subscription plan |
| POST | /subscription/plans | Super Admin | Create a new plan |
| PATCH | /subscription/plans/:id | Super Admin | Update plan details |
| DELETE | /subscription/plans/:id | Super Admin | Delete a plan |
| GET | /subscription/plans/all | Super Admin | List all plans (including hidden) |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /customers | Customers: canView | List customers with pagination & search |
| POST | /customers | Customers: canCreate Limit | Create a new customer |
| GET | /customers/:id | Customers: canView | Get single customer |
| PATCH | /customers/:id | Customers: canEdit | Update customer |
| DELETE | /customers/:id | Customers: canDelete | Delete customer |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /deals | Leads: canView | List deals with filters |
| POST | /deals | Leads: canCreate Limit | Create a new deal |
| GET | /deals/:id | Leads: canView | Get single deal |
| PATCH | /deals/:id | Leads: canEdit | Update deal |
| DELETE | /deals/:id | Leads: canDelete | Delete deal |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /dashboard/stats | Dashboard: canView | Get dashboard statistics |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /finance/summary | Auth | Get financial summary (revenue, expenses, outstanding) |
| GET | /finance/invoices | Auth | List invoices with pagination & status filter |
| POST | /finance/invoices | Auth Limit | Create a new invoice |
| GET | /finance/invoices/:id | Auth | Get single invoice |
| PATCH | /finance/invoices/:id | Auth | Update invoice |
| DELETE | /finance/invoices/:id | Auth | Delete invoice |
| GET | /finance/expenses | Auth | List expenses with pagination & filters |
| POST | /finance/expenses | Auth | Create a new expense |
| GET | /finance/expenses/:id | Auth | Get single expense |
| PATCH | /finance/expenses/:id | Auth | Update expense |
| DELETE | /finance/expenses/:id | Auth | Delete expense |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /inventory/summary | Auth Feature: inventory | Get inventory summary stats |
| GET | /inventory/products | Auth Feature: inventory | List products with pagination & filters |
| POST | /inventory/products | Auth Feature: inventory Limit | Create a new product |
| GET | /inventory/products/:id | Auth Feature: inventory | Get single product |
| PATCH | /inventory/products/:id | Auth Feature: inventory | Update product details |
| DELETE | /inventory/products/:id | Auth Feature: inventory | Delete product |
| POST | /inventory/stock/in | Auth Feature: inventory | Add stock (stock-in) |
| POST | /inventory/stock/out | Auth Feature: inventory | Remove stock (stock-out) |
| POST | /inventory/stock/adjust | Auth Feature: inventory | Adjust stock count |
| GET | /inventory/stock/:productId | Auth Feature: inventory | Get stock movement history |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /payment/create-order | Auth | Create a payment order (Razorpay) |
| POST | /payment/verify | Auth | Verify payment signature |
| GET | /payment/invoices/:invoiceId/pdf | Auth | Generate & download invoice PDF |
| GET | /payment/config | Super Admin | Get payment gateway config |
| POST | /payment/config | Super Admin | Update payment gateway config |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /email/templates | Super Admin | List email templates |
| GET | /email/templates/:id | Super Admin | Get single email template |
| POST | /email/templates | Super Admin | Create email template |
| PUT | /email/templates/:id | Super Admin | Update email template |
| DELETE | /email/templates/:id | Super Admin | Delete email template |
| GET | /email/queue/stats | Super Admin | Get email queue statistics |
| POST | /email/queue/:id/cancel | Super Admin | Cancel a queued email |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /leads/meta/statuses | Leads: canView | List lead statuses |
| GET | /leads/meta/sources | Leads: canView | List lead sources |
| GET | /leads/meta/tags | Leads: canView | List lead tags |
| POST | /leads/meta/tags | Leads: canCreate | Create a new lead tag |
| GET | /leads/meta/companies | Leads: canView | List lead companies |
| POST | /leads/meta/companies | Leads: canCreate | Create a new company |
| GET | /leads/meta/assignees | Leads: canView | List team members available as lead assignees |
| GET | /leads/kanban | Leads: canView | Get kanban board data (grouped by status) |
| GET | /leads/export | Leads: canExport | Export leads as CSV |
| POST | /leads/import | Leads: canCreate | Import leads from CSV (multipart upload) |
| POST | /leads/import/rows | Leads: canCreate | Import leads from pre-mapped JSON rows array |
| GET | /leads/analytics | Leads: canView | Get lead analytics data (KPIs, funnel, trend) |
| GET | /leads | Leads: canView | List leads with pagination & filters |
| POST | /leads | Leads: canCreate Limit | Create a new lead |
| GET | /leads/:id | Leads: canView | Get single lead details |
| PATCH | /leads/:id | Leads: canEdit | Update lead |
| PATCH | /leads/:id/status | Leads: canEdit | Update lead status (for kanban drag & drop) |
| DELETE | /leads/:id | Leads: canDelete | Delete lead |
| GET | /leads/:id/activities | Leads: canView | Get lead activity timeline |
| POST | /leads/:id/activities | Leads: canEdit | Schedule a follow-up activity (call / email / meeting / WhatsApp) |
| GET | /leads/:id/quotations | Leads: canView | Get quotations linked to this lead |
| POST | /leads/:id/tags | Leads: canEdit | Add tag to lead |
| DELETE | /leads/:id/tags/:tagId | Leads: canEdit | Remove tag from lead |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /sales-settings/quotation-statuses | Setup: canView | List quotation statuses |
| POST | /sales-settings/quotation-statuses | Setup: canEdit | Create quotation status |
| PATCH | /sales-settings/quotation-statuses/:id | Setup: canEdit | Update quotation status |
| DELETE | /sales-settings/quotation-statuses/:id | Setup: canDelete | Delete quotation status |
| GET | /sales-settings/pi-statuses | Setup: canView | List proforma invoice statuses |
| POST | /sales-settings/pi-statuses | Setup: canEdit | Create PI status |
| PATCH | /sales-settings/pi-statuses/:id | Setup: canEdit | Update PI status |
| DELETE | /sales-settings/pi-statuses/:id | Setup: canDelete | Delete PI status |
| GET | /sales-settings/so-statuses | Setup: canView | List sales order statuses |
| POST | /sales-settings/so-statuses | Setup: canEdit | Create SO status |
| PATCH | /sales-settings/so-statuses/:id | Setup: canEdit | Update SO status |
| DELETE | /sales-settings/so-statuses/:id | Setup: canDelete | Delete SO status |
| GET | /sales-settings/numbering-series | Setup: canView | List numbering series |
| PATCH | /sales-settings/numbering-series/:id | Setup: canEdit | Update numbering series config |
| GET | /sales-settings/bank-accounts | Setup: canView | List bank accounts |
| POST | /sales-settings/bank-accounts | Setup: canEdit | Create bank account |
| PATCH | /sales-settings/bank-accounts/:id | Setup: canEdit | Update bank account |
| DELETE | /sales-settings/bank-accounts/:id | Setup: canDelete | Delete bank account |
| GET | /sales-settings/terms-templates | Setup: canView | List terms & conditions templates |
| POST | /sales-settings/terms-templates | Setup: canEdit | Create terms template |
| PATCH | /sales-settings/terms-templates/:id | Setup: canEdit | Update terms template |
| DELETE | /sales-settings/terms-templates/:id | Setup: canDelete | Delete terms template |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /quotations/meta/statuses | Quotations: canView | List quotation statuses |
| GET | /quotations/meta/bank-accounts | Quotations: canView | List bank accounts for quotations |
| GET | /quotations/meta/terms-templates | Quotations: canView | List terms templates for quotations |
| GET | /quotations/export | Quotations: canView | Export quotations as CSV |
| GET | /quotations | Quotations: canView | List quotations with pagination & filters |
| POST | /quotations | Quotations: canCreate | Create a new quotation |
| GET | /quotations/:id | Quotations: canView | Get single quotation |
| PATCH | /quotations/:id | Quotations: canEdit | Update quotation |
| DELETE | /quotations/:id | Quotations: canDelete | Delete quotation |
| PATCH | /quotations/:id/status | Quotations: canEdit | Update quotation status |
| POST | /quotations/:id/revise | Quotations: canCreate | Create a new revision of the quotation |
| GET | /quotations/:id/revisions | Quotations: canView | Get quotation revision history |
| GET | /quotations/:id/activities | Quotations: canView | Get quotation activity timeline |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /proforma-invoices/meta/statuses | Proforma Invoices: canView | List PI statuses |
| GET | /proforma-invoices/meta/bank-accounts | Proforma Invoices: canView | List bank accounts for PI |
| GET | /proforma-invoices/meta/terms-templates | Proforma Invoices: canView | List terms templates for PI |
| GET | /proforma-invoices/export | Proforma Invoices: canExport | Export proforma invoices as CSV |
| POST | /proforma-invoices/from-quotation | Proforma Invoices: canCreate | Create PI from an existing quotation |
| GET | /proforma-invoices | Proforma Invoices: canView | List PIs with pagination & filters |
| POST | /proforma-invoices | Proforma Invoices: canCreate | Create a new proforma invoice |
| GET | /proforma-invoices/:id | Proforma Invoices: canView | Get single PI |
| PATCH | /proforma-invoices/:id | Proforma Invoices: canEdit | Update PI |
| DELETE | /proforma-invoices/:id | Proforma Invoices: canDelete | Delete PI |
| PATCH | /proforma-invoices/:id/status | Proforma Invoices: canEdit | Update PI status |
| GET | /proforma-invoices/:id/payments | Proforma Invoices: canView | Get PI payment records |
| POST | /proforma-invoices/:id/payments | Proforma Invoices: canEdit | Record a payment against the PI |
| GET | /proforma-invoices/:id/activities | Proforma Invoices: canView | Get PI activity timeline |
| GET | /proforma-invoices/:id/pdf | Proforma Invoices: canView | Generate & download PI PDF |
| POST | /proforma-invoices/:id/send-email | Proforma Invoices: canEdit | Send PI PDF via email to customer |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /sales-orders/meta/statuses | Sales Orders: canView | List SO statuses |
| GET | /sales-orders/meta/bank-accounts | Sales Orders: canView | List bank accounts for SO |
| GET | /sales-orders/meta/terms-templates | Sales Orders: canView | List terms templates for SO |
| GET | /sales-orders/export | Sales Orders: canExport | Export sales orders as CSV |
| POST | /sales-orders/from-quotation | Sales Orders: canCreate | Create SO from an existing quotation |
| POST | /sales-orders/from-pi | Sales Orders: canCreate | Create SO from a proforma invoice |
| GET | /sales-orders | Sales Orders: canView | List SOs with pagination & filters |
| POST | /sales-orders | Sales Orders: canCreate | Create a new sales order |
| GET | /sales-orders/:id | Sales Orders: canView | Get single SO |
| PATCH | /sales-orders/:id | Sales Orders: canEdit | Update SO |
| DELETE | /sales-orders/:id | Sales Orders: canDelete | Delete SO |
| PATCH | /sales-orders/:id/status | Sales Orders: canEdit | Update SO status |
| GET | /sales-orders/:id/deliveries | Sales Orders: canView | Get SO delivery records |
| POST | /sales-orders/:id/deliveries | Sales Orders: canEdit | Record a delivery against the SO |
| GET | /sales-orders/:id/activities | Sales Orders: canView | Get SO activity timeline |
| GET | /sales-orders/:id/pdf | Sales Orders: canView | Generate & download SO PDF |
| POST | /sales-orders/:id/send-email | Sales Orders: canEdit | Send SO PDF via email to customer |
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /admin/stats | Super Admin | Get platform-wide statistics (all tenants, users, revenue) |
| GET | /admin/tenants | Super Admin | List all tenants across the platform with pagination |