Company Management Functions
The Company Management drop-in provides 26 API functions for managing company structures, users, roles, permissions, and credit, enabling complete B2B company administration workflows.
| Function | Description |
|---|---|
acceptCompanyInvitation | Accepts a company invitation using the invitation code and user details from an email link.. |
allowCompanyRegistration | Return whether the backend allows company self-registration per store configuration.. |
checkCompanyCreditEnabled | Checks whether the Company Credit functionality (“Payment on Account”) is enabled for the logged-in customer’s company.. |
companyEnabled | Return whether the Company feature is enabled in store configuration.. |
createCompany | API function for the drop-in.. |
createCompanyRole | API function for the drop-in.. |
createCompanyTeam | Creates a new company team under an optional target structure node.. |
createCompanyUser | Creates a new company user and optionally places them under a target structure node.. |
deleteCompanyRole | API function for the drop-in.. |
deleteCompanyTeam | Deletes a company team by entity ID.. |
deleteCompanyUser | ⚠️ IMPORTANT: This function unassigns the user from the company and should NOT be used for removing users from the Company Structure tree.. |
fetchUserPermissions | API function retrieves the current user’s role permissions and returns both the flattened permission IDs and the raw role response. |
getCompany | Retrieves complete information about the current company including name, structure, settings, and metadata. |
getCompanyAclResources | API function for the drop-in.. |
getCompanyCredit | Retrieves the company’s credit information including available credit, credit limit, outstanding balance, and currency. |
getCompanyCreditHistory | API function for the drop-in.. |
getCompanyRole | API function for the drop-in.. |
getCompanyRoles | API function for the drop-in.. |
getCompanyStructure | Retrieves the hierarchical organization structure of the company including all teams, divisions, and reporting relationships. |
getCompanyTeam | Fetches details for a single company team by entity ID.. |
getCompanyUser | Fetches details for a single company user by entity ID.. |
getCompanyUsers | Fetches the list of company users with their roles and team information, supporting pagination and status filtering.. |
getCountries | ## Overview.. |
getCustomerCompany | Fetches simplified customer company information for display on the customer account information page. |
getStoreConfig | API function for the drop-in.. |
initialize | Initializes the Company drop-in with optional language definitions and data model metadata.. |
isCompanyAdmin | Check if the current authenticated customer is a company administrator in any company.. |
isCompanyRoleNameAvailable | API function for the drop-in.. |
isCompanyUser | Check if the current authenticated customer belongs to any company.. |
isCompanyUserEmailAvailable | API function for the drop-in.. |
updateCompany | API function for the drop-in.. |
updateCompanyRole | API function for the drop-in.. |
updateCompanyStructure | Moves a structure node under a new parent in the company structure tree.. |
updateCompanyTeam | Updates a company team’s name and/or description.. |
updateCompanyUser | Updates company user fields such as name, email, telephone, role, and status.. |
updateCompanyUserStatus | Updates a company user’s status between Active and Inactive with automatic base64 encoding.. |
validateCompanyEmail | Validates if a company email is available.. |
acceptCompanyInvitation
Accepts a company invitation using the invitation code and user details from an email link.
const acceptCompanyInvitation = async ( input: AcceptCompanyInvitationInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | AcceptCompanyInvitationInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
allowCompanyRegistration
Return whether the backend allows company self-registration per store configuration.
const allowCompanyRegistration = async (): Promise<boolean>Events
Does not emit any drop-in events.
Returns
Returns boolean.
checkCompanyCreditEnabled
Checks whether the Company Credit functionality (“Payment on Account”) is enabled for the logged-in customer’s company.
const checkCompanyCreditEnabled = async (): Promise<CheckCompanyCreditEnabledResponse>Events
Does not emit any drop-in events.
Returns
Returns CheckCompanyCreditEnabledResponse.
companyEnabled
Return whether the Company feature is enabled in store configuration.
const companyEnabled = async (): Promise<boolean>Events
Does not emit any drop-in events.
Returns
Returns boolean.
createCompany
const createCompany = async ( formData: any): Promise<{ success: boolean; company?: CompanyRegistrationModel; errors?: string[] }>| Parameter | Type | Req? | Description |
|---|---|---|---|
formData | any | Yes | An object containing the company registration information including company name, legal name, email, VAT/TAX ID, and resale number. The structure depends on your store’s company registration requirements. |
Events
Does not emit any drop-in events.
Returns
{ success: boolean; company?: CompanyRegistrationModel; errors?: string[] }createCompanyRole
Signature
function createCompanyRole(input: CompanyRoleCreateInputModel): Promise<CompanyRoleModel>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | CompanyRoleCreateInputModel | Yes |
createCompanyTeam
Creates a new company team under an optional target structure node.
const createCompanyTeam = async ( input: CreateCompanyTeamInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | CreateCompanyTeamInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
createCompanyUser
Creates a new company user and optionally places them under a target structure node.
const createCompanyUser = async ( input: CreateCompanyUserInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | CreateCompanyUserInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
deleteCompanyRole
Signature
function deleteCompanyRole(variables: DeleteCompanyRoleVariables): Promise<boolean>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
variables | DeleteCompanyRoleVariables | Yes | An object of type DeleteCompanyRoleVariables containing the role ID to delete. See the type definition for the exact structure. |
deleteCompanyTeam
Deletes a company team by entity ID.
const deleteCompanyTeam = async ( id: string): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
id | string | Yes | The unique identifier for the company team (structure node) to delete. This removes the team and may reassign team members depending on your company’s configuration. |
Events
Does not emit any drop-in events.
Returns
Returns void.
deleteCompanyUser
⚠️ IMPORTANT: This function unassigns the user from the company and should NOT be used for removing users from the Company Structure tree.
const deleteCompanyUser = async ( params: DeleteCompanyUserParams): Promise<DeleteCompanyUserResponse>| Parameter | Type | Req? | Description |
|---|---|---|---|
params | DeleteCompanyUserParams | Yes | An object of type `DeleteCompanyUserParams` containing the user ID to delete and any additional parameters required for user deletion. |
Events
Does not emit any drop-in events.
Returns
Returns DeleteCompanyUserResponse.
fetchUserPermissions
The fetchUserPermissions API function retrieves the current user’s role permissions and returns both the flattened permission IDs and the raw role response. This function is used internally by other API functions to determine what data the user can access.
const fetchUserPermissions = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns void.
getCompany
Retrieves complete information about the current company including name, structure, settings, and metadata. Returns the full company profile for the authenticated user’s company context.
const getCompany = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns a Promise that resolves to a CompanyModel object containing comprehensive company details.
getCompanyAclResources
const getCompanyAclResources = async (): Promise<CompanyAclResourceModel[]>Events
Does not emit any drop-in events.
Returns
Returns an array of CompanyAclResourceModel objects.
getCompanyCredit
Retrieves the company’s credit information including available credit, credit limit, outstanding balance, and currency. This is used to display company credit status and validate purchase limits.
const getCompanyCredit = async (): Promise<CompanyCreditInfo | null>Events
Does not emit any drop-in events.
Returns
Returns CompanyCreditInfo or null.
getCompanyCreditHistory
const getCompanyCreditHistory = async ( params: GetCompanyCreditHistoryParams = {}): Promise<CompanyCreditHistory | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
params | GetCompanyCreditHistoryParams | No | An optional object of type `GetCompanyCreditHistoryParams` containing pagination parameters (currentPage, pageSize) and optional filters. Omit to retrieve history with default pagination. |
Events
Does not emit any drop-in events.
Returns
Returns CompanyCreditHistory or null.
getCompanyRole
Signature
function getCompanyRole(variables: GetCompanyRoleVariables): Promise<CompanyRoleModel>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
variables | GetCompanyRoleVariables | Yes | An object of type GetCompanyRoleVariables containing the role ID to retrieve. Returns complete role details including permissions and assigned users. |
getCompanyRoles
Signature
function getCompanyRoles(variables: GetCompanyRolesVariables = {}): Promise<CompanyRolesResponseModel>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
variables | GetCompanyRolesVariables = {} | Yes | An optional object of type GetCompanyRolesVariables containing pagination and filter parameters. Omit to retrieve all company roles with default pagination. |
getCompanyStructure
Retrieves the hierarchical organization structure of the company including all teams, divisions, and reporting relationships. Returns the complete company tree structure.
const getCompanyStructure = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns a Promise that resolves to a CompanyStructureModel object representing the organizational hierarchy.
getCompanyTeam
Fetches details for a single company team by entity ID.
const getCompanyTeam = async ( id: string): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
id | string | Yes | The unique identifier for the company team to retrieve. Returns detailed information about the team including its name, members, and position in the company hierarchy. |
Events
Does not emit any drop-in events.
Returns
Returns void.
getCompanyUser
Fetches details for a single company user by entity ID.
const getCompanyUser = async ( id: string): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
id | string | Yes | The unique identifier for the company user to retrieve. Returns complete user profile including role, team assignment, and permissions. |
Events
Does not emit any drop-in events.
Returns
Returns void.
getCompanyUsers
Fetches the list of company users with their roles and team information, supporting pagination and status filtering.
const getCompanyUsers = async ( params: CompanyUsersParams = {}): Promise<CompanyUsersResponse>| Parameter | Type | Req? | Description |
|---|---|---|---|
params | CompanyUsersParams | No | An optional object of type `CompanyUsersParams` containing pagination and filter criteria (currentPage, pageSize, filter). Omit to retrieve all users with default pagination. |
Events
Does not emit any drop-in events.
Returns
Returns CompanyUsersResponse.
getCountries
Overview
const getCountries = async (): Promise<{ availableCountries: Country[] | []; countriesWithRequiredRegion: string[]; optionalZipCountries: string[];}>Events
Does not emit any drop-in events.
Returns
Promise<{ availableCountries: Country[] | []; countriesWithRequiredRegion: string[]; optionalZipCountries: string[];}>See Country.
getCustomerCompany
Fetches simplified customer company information for display on the customer account information page. This is a lightweight API that only returns essential company details without requiring full company management permissions.
const getCustomerCompany = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns void.
getStoreConfig
const getStoreConfig = async (): Promise<StoreConfigModel>Events
Does not emit any drop-in events.
Returns
Returns StoreConfigModel.
initialize
Initializes the Company drop-in with optional language definitions and data model metadata.
const initialize = async ( config: CompanyDropinConfig = {}): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
config | CompanyDropinConfig | No | An optional configuration object of type `CompanyDropinConfig` containing initialization settings such as langDefinitions for internationalization. If omitted, default configuration is used. |
Events
Does not emit any drop-in events.
Returns
Returns void.
isCompanyAdmin
Check if the current authenticated customer is a company administrator in any company.
const isCompanyAdmin = async (): Promise<boolean>Events
Does not emit any drop-in events.
Returns
Returns boolean.
isCompanyRoleNameAvailable
Signature
function isCompanyRoleNameAvailable(variables: IsCompanyRoleNameAvailableVariables): Promise<boolean>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
variables | IsCompanyRoleNameAvailableVariables | Yes | An object of type IsCompanyRoleNameAvailableVariables containing the role name to check for availability. Returns a boolean indicating whether the name can be used for a new role. |
isCompanyUser
Check if the current authenticated customer belongs to any company.
const isCompanyUser = async (): Promise<boolean>Events
Does not emit any drop-in events.
Returns
Returns boolean.
isCompanyUserEmailAvailable
const isCompanyUserEmailAvailable = async ( email: string): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
email | string | Yes | The email address. |
Events
Does not emit any drop-in events.
Returns
Returns void.
updateCompany
const updateCompany = async ( input: UpdateCompanyDto): Promise<CompanyModel>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | UpdateCompanyDto | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns CompanyModel.
updateCompanyRole
Signature
function updateCompanyRole(input: CompanyRoleUpdateInputModel): Promise<CompanyRoleModel>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | CompanyRoleUpdateInputModel | Yes |
updateCompanyStructure
Moves a structure node under a new parent in the company structure tree.
const updateCompanyStructure = async ( input: UpdateCompanyStructureInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | UpdateCompanyStructureInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
updateCompanyTeam
Updates a company team’s name and/or description.
const updateCompanyTeam = async ( input: UpdateCompanyTeamInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | UpdateCompanyTeamInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
updateCompanyUser
Updates company user fields such as name, email, telephone, role, and status.
const updateCompanyUser = async ( input: UpdateCompanyUserInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | UpdateCompanyUserInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
updateCompanyUserStatus
Updates a company user’s status between Active and Inactive with automatic base64 encoding.
const updateCompanyUserStatus = async ( params: UpdateCompanyUserStatusParams): Promise<UpdateCompanyUserStatusResponse>| Parameter | Type | Req? | Description |
|---|---|---|---|
params | UpdateCompanyUserStatusParams | Yes | An object of type `UpdateCompanyUserStatusParams` containing the user ID and the new status value (active, inactive). Used to enable or disable user access to company resources. |
Events
Does not emit any drop-in events.
Returns
Returns UpdateCompanyUserStatusResponse.
validateCompanyEmail
Validates if a company email is available.
const validateCompanyEmail = async ( email: string): Promise<ValidateCompanyEmailResponse>| Parameter | Type | Req? | Description |
|---|---|---|---|
email | string | Yes | The email address. |
Events
Does not emit any drop-in events.
Returns
Returns ValidateCompanyEmailResponse.
Data Models
The following data models are used by functions in this drop-in.
CheckCompanyCreditEnabledResponse
The CheckCompanyCreditEnabledResponse object is returned by the following functions: checkCompanyCreditEnabled.
interface CheckCompanyCreditEnabledResponse { creditEnabled: boolean; error?: string;}CompanyAclResourceModel
The CompanyAclResourceModel object is returned by the following functions: getCompanyAclResources.
interface CompanyAclResourceModel { id: string; text: string; sortOrder: number; children?: CompanyAclResourceModel[];}CompanyCreditHistory
The CompanyCreditHistory object is returned by the following functions: getCompanyCreditHistory.
interface CompanyCreditHistory { items: CompanyCreditHistoryItem[]; pageInfo: CompanyCreditHistoryPageInfo; totalCount: number;}CompanyCreditInfo
The CompanyCreditInfo object is returned by the following functions: getCompanyCredit.
interface CompanyCreditInfo { credit: { available_credit: { currency: string; value: number; }; credit_limit: { currency: string; value: number; }; outstanding_balance: { currency: string; value: number; };
};}CompanyRegistrationModel
The CompanyRegistrationModel object is returned by the following functions: createCompany.
interface CompanyRegistrationModel { id: string; name: string; email: string; legalName?: string; vatTaxId?: string; resellerId?: string; legalAddress: { street: string[]; city: string; region: { regionCode: string; region?: string; regionId?: number; }; postcode: string; countryCode: string; telephone?: string; }; companyAdmin: { id: string; firstname: string; lastname: string; email: string; jobTitle?: string; telephone?: string; };}CompanyRoleModel
The CompanyRoleModel object is returned by the following functions: createCompanyRole, getCompanyRole, updateCompanyRole.
interface CompanyRoleModel { id: string; name: string; usersCount: number; permissions: CompanyAclResourceModel[];}CompanyRolesResponseModel
The CompanyRolesResponseModel object is returned by the following functions: getCompanyRoles.
interface CompanyRolesResponseModel { items: CompanyRoleModel[]; totalCount: number; pageInfo: PageInfoModel;}CompanyUsersResponse
The CompanyUsersResponse object is returned by the following functions: getCompanyUsers.
interface CompanyUsersResponse { users: CompanyUser[]; pageInfo: CompanyUsersPageInfo; totalCount?: number;}Country
The Country object is returned by the following functions: getCountries.
type Country = { value: string; text: string; availableRegions?: { id: number; code: string; name: string; }[];};DeleteCompanyUserResponse
The DeleteCompanyUserResponse object is returned by the following functions: deleteCompanyUser.
interface DeleteCompanyUserResponse { success: boolean;}StoreConfigModel
The StoreConfigModel object is returned by the following functions: getStoreConfig.
interface StoreConfigModel { defaultCountry: string; storeCode: string;}UpdateCompanyUserStatusResponse
The UpdateCompanyUserStatusResponse object is returned by the following functions: updateCompanyUserStatus.
interface UpdateCompanyUserStatusResponse { success: boolean; user?: { id: string; status: CompanyUserStatus; };}ValidateCompanyEmailResponse
The ValidateCompanyEmailResponse object is returned by the following functions: validateCompanyEmail.
interface ValidateCompanyEmailResponse { isValid: boolean; error?: string;}