Introduction

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

  1. Call POST /auth/login with valid credentials.
  2. Receive your unique JWT token in the response payload.
  3. Pass the token in the headers for all subsequent protected API calls.
Header
Authorization: Bearer YOUR_JWT_TOKEN

Response Format

All API responses are returned in standard JSON format.

{
  "status": true,
  "message": "Success",
  "data": {}
}

API Endpoints

GET /health

Check the API and database connection status.

Request

HTTP
GET /health

Response

JSON
{
  "status": true,
  "message": "DB connected"
}
POST /auth/login

Authenticate an existing user and receive a JWT token.

Request Body

JSON
{
  "email": "admin@example.com",
  "password": "123456"
}

Response

JSON
{
  "status": true,
  "token": "JWT_TOKEN"
}
GET /auth/me

Returns the profile details of the currently logged-in user.

Headers

Authorization Required

Bearer YOUR_JWT_TOKEN

Response

JSON
{
  "status": true,
  "data": {
    "id": 1,
    "name": "Admin",
    "role": "admin"
  }
}
GET /plants

Returns a list of all available plants.

Headers

Authorization Required

Bearer YOUR_JWT_TOKEN

Response

JSON
{
  "status": true,
  "data": [
    {
      "id": 1,
      "name": "Plant A"
    }
  ]
}
GET /companies

Returns a list of all available companies.

Headers

Authorization Required

Bearer YOUR_JWT_TOKEN

Response

JSON
{
  "status": true,
  "data": [
    {
      "id": 1,
      "name": "Company A"
    }
  ]
}
GET /dashboard

Returns aggregated dashboard statistics and recent activity for a specific plant.

Query Parameters

plant_id Required int

The unique identifier of the target plant.

Response

JSON
{
  "status": true,
  "stats": {},
  "activity": []
}
GET /plants/{id}/locations

Returns a list of locations associated with a specific plant.

Path Parameters

id Required int

Plant ID.

Example

GET /plants/1/locations

Response

JSON
{
  "status": true,
  "data": []
}
GET /plants/{id}/parameters

Returns the set of parameters linked to a specific plant.

Path Parameters

id Required int

Plant ID.

Example

GET /plants/1/parameters

Response

JSON
{
  "status": true,
  "data": []
}
GET /users

Returns a complete list of all registered users within the platform.

Authorization

Authorization Required

Bearer YOUR_JWT_TOKEN

Access Level Admin Only

Restricted exclusively to users with the Admin role.

Response

JSON
{
  "status": true,
  "data": []
}
POST /readings

Create a new reading entry along with its associated parameter values.

Headers & Body

HTTP Headers
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: application/json
JSON Body
{
  "plant_id": 1,
  "location_id": 2,
  "parameter_values": [
    {
      "parameter_id": 1,
      "value": "20"
    }
  ]
}

Response

JSON
{
  "status": true,
  "message": "Entry + values saved"
}
GET /readings/{id}

Retrieve the complete details of a specific reading record.

Example Request

GET /readings/19

Response

JSON
{
  "status": true,
  "data": {}
}
DELETE /readings/{id}

Permanently remove a reading record from the database.

Example Request

DELETE /readings/19

Response

JSON
{
  "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
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
curl -X GET https://labdigitiser.nextin.space/api.php/plants \
-H "Authorization: Bearer YOUR_JWT_TOKEN"

Developer Notes