Lab Digitizer API Documentation
Welcome to the official API documentation for Lab Digitizer by Next Innovations Pvt Ltd. This API provides secure programmatic access to authentication, user management, plants, companies, dashboard analytics, and readings management.
Base URL
All API requests should be prefixed with the following base URL:
https://labdigitiser.nextin.space/api.php/
Authentication
The API uses JWT (JSON Web Token) authentication. For all protected routes, you must include a valid token in the HTTP headers.
Login Flow
- Call
POST /auth/loginwith valid credentials. - Receive your unique JWT token in the response payload.
- Pass the token in the headers for all subsequent protected API calls.
Authorization: Bearer YOUR_JWT_TOKEN
Response Format
All API responses are returned in standard JSON format.
{
"status": true,
"message": "Success",
"data": {}
}
API Endpoints
Check the API and database connection status.
Request
GET /health
Response
{
"status": true,
"message": "DB connected"
}
Authenticate an existing user and receive a JWT token.
Request Body
{
"email": "admin@example.com",
"password": "123456"
}
Response
{
"status": true,
"token": "JWT_TOKEN"
}
Returns the profile details of the currently logged-in user.
Headers
Bearer YOUR_JWT_TOKEN
Response
{
"status": true,
"data": {
"id": 1,
"name": "Admin",
"role": "admin"
}
}
Returns a list of all available plants.
Headers
Bearer YOUR_JWT_TOKEN
Response
{
"status": true,
"data": [
{
"id": 1,
"name": "Plant A"
}
]
}
Returns a list of all available companies.
Headers
Bearer YOUR_JWT_TOKEN
Response
{
"status": true,
"data": [
{
"id": 1,
"name": "Company A"
}
]
}
Returns aggregated dashboard statistics and recent activity for a specific plant.
Query Parameters
The unique identifier of the target plant.
Response
{
"status": true,
"stats": {},
"activity": []
}
Returns a list of locations associated with a specific plant.
Path Parameters
Plant ID.
Example
GET /plants/1/locations
Response
{
"status": true,
"data": []
}
Returns the set of parameters linked to a specific plant.
Path Parameters
Plant ID.
Example
GET /plants/1/parameters
Response
{
"status": true,
"data": []
}
Returns a complete list of all registered users within the platform.
Authorization
Bearer YOUR_JWT_TOKEN
Restricted exclusively to users with the Admin role.
Response
{
"status": true,
"data": []
}
Create a new reading entry along with its associated parameter values.
Headers & Body
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json
{
"plant_id": 1,
"location_id": 2,
"parameter_values": [
{
"parameter_id": 1,
"value": "20"
}
]
}
Response
{
"status": true,
"message": "Entry + values saved"
}
Retrieve the complete details of a specific reading record.
Example Request
GET /readings/19
Response
{
"status": true,
"data": {}
}
Permanently remove a reading record from the database.
Example Request
DELETE /readings/19
Response
{
"status": true,
"message": "Deleted"
}
Permissions & Roles
| Role | Access Level |
|---|---|
| Admin | Full unhindered access to all endpoints, including user management and structural modifications. |
| Member | Limited operational access. Primarily restricted to viewing assigned plants and basic dashboard metrics. |
Access Restriction Policy
If a Member user attempts to access an Admin-only endpoint (such as GET /users), the API will reject the request and return a standard 403 Forbidden response.
{
"status": false,
"message": "Forbidden",
"code": 403
}
HTTP Status Codes
The Lab Digitizer API uses standard HTTP response codes to indicate the success or failure of your API requests.
| Code | Meaning | Description |
|---|---|---|
| 200 | Success | The request was successful and the requested data is returned. |
| 201 | Created | The resource was successfully created (e.g., creating a new reading). |
| 400 | Bad Request | The request was invalid or could not be served. Check your parameters. |
| 401 | Unauthorized | The request requires user authentication. Check your JWT token. |
| 403 | Forbidden | The authenticated user does not have permission to access the resource. |
| 404 | Not Found | The requested resource could not be found on the server. |
| 500 | Server Error | An error occurred on our end. Please try again later. |
Quick Start Example
Here is a complete cURL flow demonstrating how to authenticate and fetch the list of plants.
1. Login to get token
curl -X POST https://labdigitiser.nextin.space/api.php/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"admin@example.com","password":"123456"}'
2. Access protected route
curl -X GET https://labdigitiser.nextin.space/api.php/plants \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Developer Notes
- Always ensure you are sending your JWT token via the Authorization header for protected routes.
- When making POST or PUT requests, the body payload must be in JSON format, and the
Content-Type: application/jsonheader must be explicitly set. - Pay attention to role assignments. Admin endpoints will strictly block Member access.
- Resource IDs in URL paths (e.g.,
/readings/{id}) are dynamic integer IDs representing specific records.