CRM API Documentation
This section describes the backend API for ASilva Innovations CRM. All endpoints are prefixed with /api
.
Authentication
Use the following endpoint to authenticate and receive a JWT token for accessing protected routes.
POST /api/login
Request Body:
{
"loginEmail": "user@example.com",
"loginPassword": "password123"
}
Response:
{
"message": "Login successful.",
"token": "your-jwt-token"
}
Contacts
POST /api/contact
Submit a contact form entry.
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"message": "Interested in your CRM."
}
Response:
{
"message": "Contact request received."
}
GET /api/contacts
Retrieve all contact entries. Authorization token required.
Headers:
Authorization: Bearer your-jwt-token
Response:
[
{
"id": 1,
"name": "Jane Smith",
"email": "jane@example.com"
},
...
]
GET /api/contacts/:id
Retrieve a specific contact by ID.
DELETE /api/contacts/:id
Delete a specific contact.
Deals
POST /api/deals
Create a new deal.
Request Body:
{
"dealName": "Website Development",
"value": 10000,
"stage": "Negotiation"
}
Response:
{
"message": "Deal created successfully."
}
GET /api/deals
Retrieve all deals. Authorization token required.
PUT /api/deals/:id
Update deal information.
DELETE /api/deals/:id
Delete a deal by ID.
Reports & Analytics
GET /api/reports
Retrieve business performance reports.
GET /api/analytics
View analytics data about users, deals, and tasks.
Status Codes
200 OK – Request succeeded
201 Created – Resource created
400 Bad Request – Input validation failed
401 Unauthorized – Invalid/missing token
404 Not Found – Resource not found
500 Internal Server Error – General server error