Update Company
This PUT endpoint updates the details of an existing company identified by its unique ID.
Endpoint
- URL:
/companies/{company_id/email} - Method:
PUT
Path Parameters
| Parameter | Type | Description |
|---|---|---|
company_id/email | string | The unique identifier of the company to be updated. |
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
Content-Type | string | Must be application/json. |
accessToken | string | Access token for authentication. (required) |
Request Body
The request body should be a JSON object containing fields to update for the company.
| Field | Type | Description |
|---|---|---|
name | string | The name of the company. Required. |
email | string | The email address associated with the company. Required. |
phoneNumber | string | The primary contact number for the company. Required. |
status | string | Current status of the company (e.g., "active"). Required. |
shippingAddress | array | An array of objects representing the company's shipping addresses. |
billingAddress | array | An array of objects representing the company's billing addresses. |
paymentMethods | Array | An array containing ids of payment method. |
paymentTerms | Array | An array containing details of payment terms. |
isTaxExempt | Boolean | Does company is Tax Exempt |
metaFields | array | An array of meta-information fields for the company. |
notes | string | Optional field for additional notes on the company. |
Address Structure
For both shippingAddress and billingAddress:
| Field | Type | Description |
|---|---|---|
companyName | string | Company name of this contact (Optional). |
companyEmail | string | Company email of the contact (Optional) |
firstName | string | First name of the contact person at this address. |
lastName | string | Last name of the contact person at this address. |
address1 | string | Primary address line. |
address2 | string | Secondary address line. Optional. |
city | string | City of the address. |
state | string | State code of the address (e.g., "NJ"). |
country | string | Country code of the address (e.g., "US"). |
zipcode | string | Postal code of the address. |
phoneNumber | string | Contact phone number for the address. |
isDefaultAddress | boolean | Indicates whether this address is the default for shipping addresses. |
metaFields | array | Meta-information related to the address, such as p21_shipto_id. |
addressId | id | AddressId of either billing / shipping regarding to the address updating. |
Payment Terms
| Field | Type | Description |
|---|---|---|
paymentTerm | id | Id of payment Term. |
depositRequired | boolean | Is deposit required for placing order |
depositPercentage | number | Deposit percentage need to place order |
Sample Request Body
{
"name": "spruce",
"email": "John@aximcommerce.com",
"phoneNumber": "65161861",
"status": "active"
}
Response
- Status Code: 200 OK
Success Response Body
A successful response will confirm the update of the company details:
{
"success": true,
"message": "Company updated successfully",
"data": {
"id": "637e18fc741020de0693227a"
// other company details...
}
}
Error Responses
| Status Code | Description |
|---|---|
| 400 Bad Request | The request body contains invalid data or is missing required fields. |
| 401 Unauthorized | The access token is invalid or missing. |
| 404 Not Found | No company matches the specified company_id/email. |
| 500 Internal Server Error | An error occurred on the server. |
Notes
- Ensure the
company_id/emailin the URL is replaced with the actual ID/email of the company you wish to update. - Only provide fields in the request body that need to be updated.
- Confirm the access token is active and valid.