Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Rest API Role Restrict

1 sites No security coverage Drupal 9–10 · not 11
View on drupal.org

This module restricts access to Drupal's REST API, allowing only users with specific roles to access it. Site administrators can configure these allowed roles through a user interface.

REST Role Restrict provides a simple but powerful solution for controlling access to Drupal's REST API. It restricts all API access to only users with specific roles that site administrators can configure via a UI.

Installation

  1. Download the module with Composer.

  2. Enable the module.

    Use the Admin UI to enable the module.

  3. Ensure dependencies are enabled.

    These core modules must be active for REST to function:
    • rest
    • serialization
    • user

Post-Installation

  1. Go to the configuration page.

    Navigate to Configuration → Web Services → REST Role Restrict or go directly to:

    /admin/config/services/rest-role-restrict

  2. Select allowed roles.

    Use the checkboxes to choose which user roles should be granted access to Drupal’s REST API.

  3. Save the configuration.

    The settings will apply globally to all REST API requests.

  4. Control access to the settings page.

    Only users with the administer rest role restrict permission can configure which roles have API access.

  5. Disallowed users receive a structured error.

    When a user without an allowed role makes a REST API request, they will receive a JSON response like this:
    {
      "message": "Access to the REST API is restricted to specific roles. Contact your site administrator."
    }

Supporting this Module

If this module saves you time or adds value to your project, you can show your support in two ways:

  • Buy me a coffee to say thanks:
    https://buymeacoffee.com/tylerhastain
  • Want to contribute or sponsor development?
    Reach out directly if you're interested in helping improve or maintain the module — contributions, ideas, and support are always welcome!

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Jun 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 4
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
1.2.0 Stable 9–10 Jul 21, 2025
1.1.1 Stable 9–10 Jul 18, 2025
1.0.1 Stable 9–10 Jun 24, 2025
1.0.0 Stable 9–10 Jun 20, 2025