Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Rest API Role Restrict

No security coverage Under active development 1 sites

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!
Drupal 9–10 · not 11

Ask your assistant about Rest API Role Restrict

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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 PHP 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