--- title: permissions slug: Mozilla/Add-ons/WebExtensions/API/permissions tags: - API - Add-ons - Extensions - NeedsTranslation - Permissions - Reference - TopicStub - WebExtensions translation_of: Mozilla/Add-ons/WebExtensions/API/permissions ---
{{AddonSidebar}}
Enables extensions to request extra permissions at runtime, after they have been installed.

Extensions need permissions to access more powerful WebExtension APIs. They can ask for permissions at install time, by including the permissions they need in the permissions manifest.json key. The main advantages of asking for permissions at install time are:

There is not yet a simple GUI, for users to view permissions of their installed WebExtension Add-ons.  Users must use about:debugging, go to the Add-ons section, then use the "Manifest Url" link for this Add-on. This shows raw json, which includes a "permissions" block, showing the permissions used by this addon.

With the permissions API, an extension can ask for additional permissions at runtime. These permissions need to be listed in the optional_permissions manifest.json key. Note that some permissions are not allowed in optional_permissions. The main advantages of this are:

To use the permissions API, decide which permissions your extension can request at runtime, and list them in optional_permissions. After this, you can request any permissions that were included in optional_permissions. Requests may only be made in the handler for a user action (for example, a click handler).
For advice on designing your request for runtime permissions, to maximize the likelihood that users grant them, see Request permissions at runtime.

Types

{{WebExtAPIRef("permissions.Permissions")}}
Represents a set of permissions.

Methods

{{WebExtAPIRef("permissions.contains()")}}
Discover an extension's given set of permissions.
{{WebExtAPIRef("permissions.getAll()")}}
Get all the permissions this extension currently has.
{{WebExtAPIRef("permissions.remove()")}}
Give up a set of permissions.
{{WebExtAPIRef("permissions.request()")}}
Ask for a set of permissions.

Event handlers

{{WebExtAPIRef("permissions.onAdded")}}
Fired when a new permission is granted.
{{WebExtAPIRef("permissions.onRemoved")}}
Fired when a permission is removed.

Browser compatibility

{{Compat("webextensions.api.permissions")}}

See also

{{WebExtExamples("h2")}}

Acknowledgements

This API is based on Chromium's chrome.permissions API.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.