List Companies API
Overview
Retrieves a paginated list of registered corporate companies.
- Endpoint:
/api/companies/list - Method:
GET - Access: Super Admin / Platform RM
Query Parameters (req.query)
| Parameter | Type | Required | Description |
|---|---|---|---|
search | String | No | Search filter by company name, legal name, GSTIN, or email |
page | Number | No | Page number (Default: 1) |
limit | Number | No | Items per page (Default: 10, Max: 100) |
activeOnly | Boolean | No | Filter active companies only |
Query Example
GET /api/companies/list?search=Abbott&page=1&limit=10
Success Response (200 OK)
{
"success": true,
"message": "Companies retrieved successfully",
"data": [
{
"id": "c478a846-993d-4c8d-bf8d-d77cb3370e01",
"name": "Abbott Healthcare",
"legalName": "Abbott Healthcare India Private Limited",
"gstin": "27AAACA0000A1Z5",
"creditLimit": "1000000.00",
"creditDays": 30,
"active": true,
"_count": {
"users": 45,
"bookings": 128
}
}
],
"pagination": {
"totalItems": 1,
"currentPage": 1,
"totalPages": 1,
"pageSize": 10,
"hasNextPage": false,
"hasPreviousPage": false
}
}
Database Impact
- Table:
companies - Operations:
SELECTwithfindManyandcount.