Skip to main content

Get All Customer Roles

Retrieves all customer roles in the store. Use a role's label as the roleName when you create or update a customer.

HTTP Request​

  • URL: /roles
  • Method: GET
  • Headers:
    • accessToken: Required. Your API access token.
  • Required scope: READ_CUSTOMER or READ_WRITE_CUSTOMER

cURL Example​

curl --location '<BASE_URL>/roles' \
--header 'accessToken: <ACCESS_TOKEN>'

Response​

  • 200 OK: The list of roles was returned successfully.
  • 400 Bad Request: The access token is missing or invalid, or the token does not have the required scope.

Sample JSON Response​

{
"success": true,
"message": "Roles fetched successfully",
"data": [
{
"_id": "663a0aff4587085935a4fb94",
"id": "663a0aff4587085935a4fb94",
"name": "admin",
"label": "Admin",
"active": true,
"permissions": ["ADDRESS", "COMPANY", "CART"],
"defaultPermissions": ["ADDRESS", "COMPANY", "CART"],
"createdAt": "2024-05-07T11:13:02.066Z",
"updatedAt": "2024-05-07T11:13:02.066Z"
},
{
"_id": "663a0aff4587085935a4fb95",
"id": "663a0aff4587085935a4fb95",
"name": "buyer",
"label": "Buyer",
"active": true,
"permissions": ["CART"],
"defaultPermissions": ["CART"],
"createdAt": "2024-05-07T11:13:02.066Z",
"updatedAt": "2024-05-07T11:13:02.066Z"
}
]
}

Response Details​

Role Data​

FieldTypeDescription
idStringUnique identifier of the role. The same value is also returned as _id.
nameStringInternal name of the role, for example admin, buyer or juniorBuyer.
labelStringDisplay name of the role, for example Admin, Buyer or Junior Buyer.
activeBooleanWhether the role is active. Default is true.
permissionsArrayStorefront permissions granted to the role.
defaultPermissionsArrayPermissions the role had when it was created.
createdAtStringDate and time the role was created (ISO 8601).
updatedAtStringDate and time the role was last updated (ISO 8601).

Notes​

  • All roles are returned in one response. This endpoint does not use pagination.