API keys can now read insights data

The insights:read scope is now available across API key roles, enabling programmatic access to n8n insights data through API credentials.
n8n workflows can now be extended with programmatic access to insights data. Previously, reading insights required manual interaction with the UI. With this change, API keys gain the insights:read scope across owner, admin, and member roles, allowing automated scripts and external integrations to query insights data directly. The scope is wired into the permissions constants, public API scopes, and global role definitions — ensuring consistent behavior whether accessing via UI or API.
This work is part of a broader effort to expand API key capabilities around insights functionality, building toward richer automation possibilities for users who rely on n8n for data-driven workflows.
View Original GitHub DescriptionFact Check
Summary
Adds the insights:read scope to API key roles, enabling API keys to read insights data. This includes:
- Adding
insights:readtoAPI_KEY_RESOURCESin the permissions constants - Adding
insights:readto public API permissions - Adding
insights:readto global scopes for all global roles (owner, admin, member) - Creating a reversible database migration to backfill the new scope into existing role assignments
Related Linear tickets, Github issues, and Community forum posts
<!-- Link to Linear ticket: https://linear.app/n8n/issue/LIGO-242 -->Review / Merge checklist
- PR title and summary are descriptive. (conventions)
- Docs updated or follow-up ticket created.
- Tests included.
- PR Labeled with
release/backport(if the PR is an urgent fix that needs to be backported)