Get All Corporates
This GET endpoint retrieves a list of corporates with pagination support. You can specify the page number and the number of items per page using query parameters.
Endpoint
- URL:
/corporates?page={page}&limit={limit} - Method:
GET
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | int | The page number to retrieve. Default is 1. |
limit | int | The number of items per page. Default and max is 10. |
company | string | Filter corporates by parent company ID. |
company:in | string | Filter corporates by a list of parent company IDs (comma-separated). |
date_created:min | string | Filter corporates created on or after this date (format: YYYY-MM-DD). |
date_created:max | string | Filter corporates created on or before this date (format: YYYY-MM-DD). |
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Request Body
No request body is needed for this GET operation.
Response
- Status Code: 200 OK
Sample Response Body
A successful response will return a list of corporates with pagination details:
{
"success": true,
"data": [
{
"parentCompany": "67bd7732e2c361f0b15a1c18",
"name": "Test Company - 1",
"active": true,
"subCompanies": [
"64f72a721e63ec3bf06acd65",
"64ae9fbb401a953a2b8988a1"
],
"createdBy": {
"id": "64f0a70c6212cdcbe89a2402",
"name": "first key",
"type": "api"
},
"id": "67bd786f177125410d15d694"
}
],
"pagination": {
"page": 1,
"total": 1,
"count": 1
}
}
Success Response
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the request was successful. |
data | array | List of corporate objects. |
pagination | object | Pagination details for the response data. |
corporate Object (data[])
| Field | Type | Description |
|---|---|---|
name | string | Name of the corporate. |
parentCompany | string | ID of the parent company for which the sub-companies are assigned. |
subCompanies | Array | ID of the child companies that are assigned to the parent company |
active | boolean | Current status of the corporate (e.g., "active / inactive"). |
createdBy | object | Information about who created the corporate entry. |
id | string | Unique identifier for the corporate. |
Pagination Object (pagination)
| Field | Type | Description |
|---|---|---|
page | int | Current page number of the response data. |
total | int | Total number of available pages. |
count | int | Total number of records returned. |
Error Responses
| Status Code | Description |
|---|---|
| 401 Unauthorized | The access token is invalid or missing. |
| 403 Forbidden | You do not have permission to access this resource. |
| 500 Internal Server Error | An error occurred on the server. |
Notes
- Make sure the
accessTokenis valid and that the token has permission to access corporate data. - Adjust the
pageandlimitquery parameters to control pagination according to your needs. - Only accessible to authorized users with sufficient access rights.