Skip to main content

Create Company

This POST endpoint creates a new company record with specified details, including addresses and metadata fields.

Endpoint

  • URL: /companies
  • 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 request body should be a JSON object containing details for the new company.

FieldTypeDescription
namestringThe name of the company. Required.
emailstringThe email address associated with the company. Required.
phoneNumberstringThe primary contact number for the company. Required.
statusstringCurrent status of the company (e.g., "active"). Required.
shippingAddressarrayAn array of objects representing the company's shipping addresses.
billingAddressarrayAn array of objects representing the company's billing addresses.
paymentMethodsArrayAn array containing ids of payment method.
isTaxExemptBooleanDoes company is Tax Exempt
paymentTermsArrayAn array containing details of payment terms.
metaFieldsarrayAn array of meta-information fields for the company.
notesstringOptional field for additional notes on the company.

Address Structure

For both shippingAddress and billingAddress:

FieldTypeDescription
companyNamestringCompany name of this contact (Optional).
companyEmailstringCompany email of the contact (Optional)
firstNamestringFirst name of the contact person at this address.
lastNamestringLast name of the contact person at this address.
address1stringPrimary address line.
address2stringSecondary address line. Optional.
citystringCity of the address.
statestringState code of the address (e.g., "NJ").
countrystringCountry code of the address (e.g., "US").
zipcodestringPostal code of the address.
phoneNumberstringContact phone number for the address.
isDefaultAddressbooleanIndicates whether this address is the default for shipping addresses.
metaFieldsarrayMeta-information related to the address, such as p21_shipto_id.

Payment Terms

FieldTypeDescription
paymentTermidId of payment Term.
depositRequiredbooleanIs deposit required for placing order
depositPercentagenumberDeposit percentage need to place order

Sample Request Body

{
"name": "spruce",
"email": "John@aximcommerce.com",
"phoneNumber": "65161861",
"status": "active",
"shippingAddress": [
{
"firstName": "John",
"lastName": "Don",
"phoneNumber": "65161861",
"address1": "12/4, test st",
"address2": "",
"city": "Elizabeth",
"state": "NJ",
"country": "US",
"zipcode": "07202",
"isDefaultAddress": false,
"metaFields": [
{
"code": "p21_shipto_id",
"value": 100
}
]
}
],
"billingAddress": [
{
"firstName": "Prashanth",
"lastName": "Viru",
"phoneNumber": "65161861",
"address1": "12/4, test st",
"address2": "",
"city": "Elizabeth",
"state": "NJ",
"country": "US",
"zipcode": "07202"
}
],
"metaFields": [
{
"code": "p21_customer_id",
"value": "12543"
}
],
"notes": "NOTE AREA"
}

Response

  • Status Code: 200 Created

Success Response Body

A successful response will confirm the creation of the company and include its ID.

{
"success": true,
"message": "Company created successfully",
"data": {
"id": "new_company_id"
// other company details...
}
}

Success Response Body

FieldTypeDescription
successbooleanIndicates the success status of the request, typically true for a successful operation.
messagestringA message conveying the outcome of the operation, e.g., "Company created Successfully".
dataobjectContains the company object detailing the product information just added.

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 all required fields are provided and correctly formatted.
  • Confirm the access token is active and valid for authenticating the request.