How to create a company using REST API B2B Magento Adobe commerce?

Adobe Commerce Company’s feature covers wholesale B2B functionality for the store owners.

The company feature is robust and you can create a company from the front end via creating a company account, Admin panel new Company, GraphQL as well as using REST API.

I will provide you step by step guide to creating a new company using REST API.

Before creating Company, you just need to create a customer to assign that customer as a superuser for the company.

This step is optional if you have already created a company,
Create Customer using Magento API,

Action: POST

URL: <HOST_URL>/rest/<storeCode>/V1/customers

HEADER: Authorization: Bearer <ADMIN_TOKEN>

Request Payload:

Response:

Here New customer is generated and the new id will be 5.

Now We are just moving to the original post of Create Company API stuff.

Action: POST

URL: <HOST_URL>/rest/<storeCode>/V1/company

HEADER: Authorization:Bearer <ADMIN_TOKEN>

Request Payload:

Below are the  list of  required fields in request body (*),

  • company_name
  • company_email
  • street
  • city
  • country_id
  • region
  • postcode
  • telephone
  • customer_group_id
  • super_user_id.

customer_group_id is the company’s shared catalog Id.  If you pass 1 that means the default shared catalog. Here we have assigned a value is 15 for our custom customer group id.

super_user_id is the customer id assigned as superuser of the company.

Response: