Skip to main content

Update Corporate

This PUT endpoint is used to update an existing corporate record in the system. The request must include necessary corporate details, including company association and sub-company information.

Endpoint

  • URL: /api/corporates/:id
  • Method: PUT

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.No
namestringThe name of the corporate entity.No
activebooleanIndicates if the corporate entity is active.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: 200 OK

Success Response Body

{
"success": true,
"message": "Corporate updated 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 updated 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.
404 Not FoundThe corporate entity does not exist.
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 update corporate data.
  • This endpoint updates an existing corporate entity and returns its updated details on success.