Edit in GitHubLog an issue
Adobe Commerce only. Learn more

Manage company users

A company user is a customer (buyer) that is assigned extended attributes that identify the company the user belongs to. Use the POST /V1/customers call, which is included with Magento Open Source and Adobe Commerce, to create the user. After the user is created, you can use the PUT /V1/customers/:customer_id call to set their company data with the company_attributes extended attributes.

Managing company users with REST

This section describes the REST endpoints used to manage company users.

Service Name:

customerCustomerRepositoryV1

REST Endpoints:

Copied to your clipboard
POST /V1/customers/
PUT /V1/customers/:customerId

Company user parameters:

The following table lists the parameters that can be used to set company data for a user.

NameDescriptionFormatRequirements
customer_id
System-generated customer ID.
integer
Not applicable for create operations.
company_id
System-generated company ID.
integer
Required to create or update a company user.
job_title
A string that describes the company user's responsibilities.
string
Required to create or update a company.
status
Indicates whether the company user is active or inactive
integer
0 - inactive; 1 - active
telephone
Telephone number
string
Required to create a company user.

Create a company user

The POST /V1/customers call creates an Adobe Commerce customer. B2B extends the customerAccountManagementV1 service so that you can create a company user.

Sample Usage:

POST <host>/rest/<store_code>/V1/customers

First, create the standard customer. Their company_id will initially be set to 0.

Copied to your clipboard
{
"customer": {
"email": "mshaw@example.com",
"firstname": "Melanie",
"lastname": "Shaw"
}
}

If you create a user from the admin dashboard, you can also set their company data at the same time.

Modify a company user

The following example assigns the user to a company, sets their status to inactive and also sets their job_title and telephone.

If you change the status to inactive, the account is locked. If the company user has child users, the system re-assigns the child users to the parent of the deactivated user.

Sample Usage:

PUT <host>/rest/<store_code>/V1/customers/13

Copied to your clipboard
{
"customer": {
"id": 13,
"email": "mshaw@example.com",
"firstname": "Melanie",
"lastname": "Shaw",
"website_id": 1,
"extension_attributes": {
"company_attributes": {
"company_id": 2,
"status": 0,
"job_title": "Sales Rep",
"telephone": "512-555-3322"
}
}
}
}

Delete a company user

If the specified company user has child users, the system re-assigns the child users to the parent of the deleted user. The user account is deleted from Commerce with all of its content, except quotes and orders. The user's orders and quotes remain visible to the seller.

Commerce locks the deleted user's quotes and changes their status to Closed. The system does not allow to make changes on such quotes.

Sample Usage:

DELETE <host>/rest/<store_code>/V1/customers/13

Copied to your clipboard
// Not applicable
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.