Organization Units API
The Organization Units API enables you to manage B2B functionalities in your VTEX store, focusing on users and organization units. This API provides endpoints for managing users, organization units, and their associated scopes.
This feature is only available for stores using B2B Buyer Portal, which is currently available to select accounts.
Index
Users
GETGet user scopes: Retrieves the scopes assigned to a user.GETGet user's organization unit: Retrieves the organization unit associated with a specific user.
Organization Units
POSTCreate organization unit: Creates a new organization unit at the root level of the organizational hierarchy.GETSearch organization units: Searches for organization units based on query parameters, with pagination support.GETGet organization unit: Retrieves details of a specific organization unit by its unique identifier.DELETEDelete organization unit: Deletes an organization unit.PATCHRename organization unit: Updates the name of an existing organization unit.GETGet all children organization units: Retrieves child organization units.GETGet root organization units: Retrieves all root-level organization units.PUTMove organization unit: Moves an organization unit to a different parent.POSTAdd user to organization unit: Adds a user to an organization unit.DELETERemove users from organization unit: Removes a user from an organization unit.GETList users from organization unit: Lists users in an organization unit.GETFind all organization units with scope value: Retrieves all organization units that have a specific scope value.
Scopes
GETGet organization unit scopes: Retrieves all scopes for an organization unit.DELETEDelete all scopes: Removes all scopes from an organization unit.POSTCreate organization unit scope: Creates a new scope for an organization unit.PUTUpdate organization unit scope: Updates an existing scope.DELETEDelete organization unit scope: Deletes a specific scope.DELETERemove values from organization unit scope: Removes specific values from a scope.
Common parameters
| Parameter name | Description | Type |
|---|---|---|
accountName |
Name of the VTEX account. Used as part of the URL. | Server variable. |
environment |
Environment to use. Used as part of the URL. | Server variable. |
VtexIdclientAutCookie |
User token, valid for 24 hours. | Authentication header. |
Endpoints
Users
| Summary | Method | Path |
|---|---|---|
| Get user scopes | GET | /api/organization-units/v1/users/{userId}/scopes |
| Get user's organization unit | GET | /api/organization-units/v1/{userId}/unit |
Units
| Summary | Method | Path |
|---|---|---|
| Create organization unit | POST | /api/organization-units/v1 |
| Search organization units | GET | /api/organization-units/v1 |
| Get organization unit | GET | /api/organization-units/v1/{organizationUnitId} |
| Delete organization unit | DELETE | /api/organization-units/v1/{organizationUnitId} |
| Rename organization unit | PATCH | /api/organization-units/v1/{organizationUnitId} |
| Get all children organization units | GET | /api/organization-units/v1/{organizationUnitId}/children |
| Get root organization units | GET | /api/organization-units/v1/roots |
| Move organization unit | PUT | /api/organization-units/v1/{organizationUnitId}/path |
| Add user to organization unit | POST | /api//vtexid/organization-units/{organizationUnitId}/users |
| Remove users from organization unit | DELETE | /api//vtexid/organization-units/{organizationUnitId}/users |
| List users from organization unit | GET | /api//vtexid/organization-units/{organizationUnitId}/users |
| Find all organization units with scope value | GET | /api/organization-units/v1/scope/{scope}/value/{scopeValue} |
Scopes
| Summary | Method | Path |
|---|---|---|
| Get organization unit scopes | GET | /api/organization-units/v1/{organizationUnitId}/scopes |
| Delete all scopes from organization unit | DELETE | /api/organization-units/v1/{organizationUnitId}/scopes |
| Create organization unit scope | POST | /api/organization-units/v1/{organizationUnitId}/scopes/{scope} |
| Update organization unit scope | PUT | /api/organization-units/v1/{organizationUnitId}/scopes/{scope} |
| Delete organization unit scope | DELETE | /api/organization-units/v1/{organizationUnitId}/scopes/{scope} |
| Remove values from organization unit scope | DELETE | /api/organization-units/v1/{organizationUnitId}/scopes/{scope}/remove |