Skip to content

List Roles (GraphQL)

Returns the paginated list of admin roles. A role is a named permission set assigned to admin users to control which areas of the admin panel they can access.

Operation

OperationTypePurpose
adminSettingsRolesQueryCollectionList all roles (cursor-paginated)

Arguments

All arguments are optional and combine in a single query — filter, sort and paginate together.

Pagination

ArgumentDescription
firstNumber of records to return.
afterCursor to fetch the page after (from pageInfo.endCursor).

Filters

Each filter narrows the result; supplying more than one combines with logical AND. They mirror the admin Roles datagrid filters.

ArgumentTypeMatchExample
nameStringPartial (contains)."Catalog"
permission_typeStringExact — all or custom."custom"

Sorting

ArgumentTypeValues
sortStringid (default), name
orderStringasc, desc (default desc)

Quirks

  • permissions is a string array of permission keys for a custom role. For an all role it is null (full access — no explicit key list is stored).
  • The example trims the permissions list to a few entries; a real custom role can hold over a hundred keys.
  • The seeded Administrator role (_id: 1) has null timestamps — it predates timestamp tracking.
  • Page forward with first + after (pass the previous response's endCursor); totalCount is the unfiltered total.

TIP

All operations require an admin Bearer token — see Authentication.

Released under the MIT License.