NinjaOne icon

NinjaOne

Ninja One Public API documentation. <br><br>See also: <br> <a href="https://resources.ninjarmm.com/API/Ninja+RMM+Public+API+v2.0.5+Device+Filter+Syntax.pdf">Device Filter syntax</a><br><a href="https://app.ninjarmm.com/apidocs-beta/core-resources/articles/webhooks/overview">Webhooks</a>

Actions309

System → List device roles

AI-generated

Summary

Retrieve a list of device roles from the NinjaOne API's /v2/roles endpoint, optionally paginating through multiple pages of results.

Inputs

  • Return All — Boolean flag to return all device roles across all pages or only a single page of results.
  • Options — Additional parameters including custom request body, custom HTTP headers, query filters, batching parameters, debug flag, pagination settings (mode, parameter names, limits), and request timeout.

Output shape

A list (array) of device roles as returned by the NinjaOne API, potentially including metadata if debug is enabled.

Pagination can be controlled via the provided pagination settings, including offset, cursor, or next-URL methods. When 'Return All' is false, only one page of results is fetched. Custom headers and query filters can modify the API request. Debug output, if enabled, adds request details to the response.

Examples

Example 1: List all device roles without pagination

Set 'Return All' to true and leave 'Options' empty to retrieve all device roles in one call.

Example 2: Retrieve device roles with pagination and filters

Enable pagination in 'Options.pagination', specify pagination mode and parameters, and add 'Options.queryFilters' to filter roles by specific query parameters.

Links

Discussion