Skip to main content

Create Corporate

This POST endpoint is used to create a new corporate record in the system. The request must include necessary corporate details, including company association and sub-company information.

Endpoint

  • URL: /api/corporates
  • Method: POST

Authentication

  • Header: accessToken
  • Type: Bearer Token
  • Value: <ACCESS-TOKEN>

Request Headers

HeaderTypeDescription
Content-TypestringMust be application/json.
accessTokenstringAccess token for authentication. (required)

Request Body

The body of the request should be a JSON object containing the following corporate details:

FieldTypeDescriptionRequired
parentCompanystringThe ID of the parent company.Yes
namestringThe name of the corporate entity.No
activebooleanIndicates if the corporate entity is active. Default: true.No
subCompaniesarrayArray of company IDs representing sub-companies.No

Sample Request Body

{
"parentCompany": "637e18fc741020de0693227a",
"name": "Axim Solutions",
"active": true,
"subCompanies": ["637e18fc741020de0693227b", "637e18fc741020de0693227c"]
}

Response

  • Status Code: 201 Created

Success Response Body

{
"success": true,
"message": "Corporate created successfully",
"data": {
"id": "generated_id_here"
// other corporate details...
}
}

Success Response Body Structure

FieldTypeDescription
successbooleanIndicates if the request was successful.
messagestringMessage indicating the result of the operation.
dataobjectContains details of the newly created corporate.

Data Object (data)

FieldTypeDescription
idstringUnique identifier for the corporate entity.
parentCompanystringThe ID of the parent company.
namestringThe name of the corporate entity.
activebooleanIndicates if the corporate is active.
subCompaniesarrayList of associated sub-companies.
createdAtstringTimestamp of when the corporate was created.
updatedAtstringTimestamp of the last update to the corporate data.

Error Responses

Status CodeDescription
400 Bad RequestThe request body contains invalid data or is missing required fields.
401 UnauthorizedThe access token is invalid or missing.
500 Internal Server ErrorAn error occurred on the server.

Notes

  • Ensure that all required fields are included in the request body.
  • Confirm that your access token is valid and has permissions to create corporate data.
  • This endpoint creates a new corporate entity and returns its details on success.