data-src=../../includes/commerce-only.md
Create a company address
data-variant=info
data-slots=text
Magento_CompanyAddressStorefrontCompatibility::add ACL resource.This endpoint creates a new billing or shipping address for a company using the saveForCompany operation of the companyAddressRepositoryV1 service.
The company address book must be enabled for the company (is_company_address_book_enabled), or the request fails with 400 Bad Request and the message Company address book is not enabled for this company.
Missing required fields (for example, firstname) return 400 Bad Request with a message identifying the missing field.
Service Name:
companyAddressRepositoryV1
REST Endpoint:
POST /V1/company/:companyId/address
CompanyAddressInterface Parameters:
The following table lists the parameters defined in CompanyAddressInterface.
company_address_idcompany_id:companyId path parameter.type1 - Billing<br/>2 - ShippingnicknamefirstnamelastnamemiddlenameprefixMr.)suffixJr.)companystreetcitycountry_idregion_idregion is resolved automatically.regionregion_id, region, and region_code.postcodetelephonefaxvat_idcustom_attributesCreate a company billing address
The following example creates a billing address for company 2.
Sample Usage:
POST <host>/rest/<store_code>/V1/company/2/address
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"companyAddress": {
"type": 1,
"nickname": "HQ Billing",
"firstname": "John",
"lastname": "Doe",
"company": "Acme Corp",
"street": [
"123 Main St"
],
"city": "Austin",
"country_id": "US",
"region_id": 57,
"postcode": "78701",
"telephone": "5551234567"
}
}
Response
{
"company_address_id": 12,
"company_id": 2,
"type": 1,
"nickname": "HQ Billing",
"firstname": "John",
"lastname": "Doe",
"company": "Acme Corp",
"street": [
"123 Main St"
],
"city": "Austin",
"country_id": "US",
"region_id": 57,
"region": {
"region_id": 57,
"region": "Texas",
"region_code": "TX"
},
"postcode": "78701",
"telephone": "5551234567",
"custom_attributes": []
}
Create a company shipping address
The following example creates a shipping address for the same company.
Sample Usage:
POST <host>/rest/<store_code>/V1/company/2/address
data-slots=heading, code
data-repeat=2
data-languages=JSON, JSON
Payload
{
"companyAddress": {
"type": 2,
"nickname": "Warehouse",
"firstname": "John",
"lastname": "Doe",
"company": "Acme Corp",
"street": [
"500 Distribution Way"
],
"city": "Austin",
"country_id": "US",
"region_id": 57,
"postcode": "78702",
"telephone": "5551234567"
}
}
Response
{
"company_address_id": 13,
"company_id": 2,
"type": 2,
"nickname": "Warehouse",
"firstname": "John",
"lastname": "Doe",
"company": "Acme Corp",
"street": [
"500 Distribution Way"
],
"city": "Austin",
"country_id": "US",
"region_id": 57,
"region": {
"region_id": 57,
"region": "Texas",
"region_code": "TX"
},
"postcode": "78702",
"telephone": "5551234567",
"custom_attributes": []
}