API:Restricting API usage

There are several ways to restrict usage of (certain parts of) the API to certain groups of users, or to disable it altogether.

The API is enabled by default.

Disabling the write API
You can disable all changing>Special:MyLanguage/API:Changing wiki content|write modules by setting   in LocalSettings.php.

The write API is enabled by default as of MediaWiki 1.14, and disabled by default in older versions.

Restricting access to the write API
You can deny certain groups the right to use the write API by denying them the writeapi right.

By default, all groups have the writeapi right.

However, both the writeapi right and   are required in order to use the write API.

Disabling modules
You can disable individual modules for all users by adding a line to LocalSettings.php.

Exactly what to add depends on the type of module you want to disable:


 * For   modules, use  


 * For   modules, use  


 * For   modules, use  </>


 * For <tvar|1> </> modules, use <tvar|2> </>

Examples
To disable anyone who isn't a sysop from using <tvar|edit> </>:

To limit the access of an API action, add the following hook for <tvar|api></>:

Replace <tvar|1> </>, <tvar|2> </> and <tvar|3> </> with the appropriate values.