API:Options

Token
To change options, an options token is required.

Options tokens can be obtained via action=query&meta=tokens

In older versions, a token can be obtained via action=tokens&type=options:

Changing options
Options can be changed using action=options.

While this API is primarily intended for changing options which are registered by MediaWiki core or extensions and available on Special:Preferences, since you can also use it to set arbitrary user options that can be used by user-scripts or external editors.

These arbitrary options have three limits imposed on them:
 * the key must start with the prefix
 * the length of the key must not be more than 255 bytes
 * the key must consist only of ASCII letters, numbers, hyphens and underscores (a-z, A-Z, 0-9, _, -)

There are currently no hard limits on the length or contents of the value, nor is there a limit on the number of user options you can set at once. You can even store a complex tree of data within a user option by encoding it as a JSON string. However, user options are downloaded in their entirety for every page view. Only very small datums should be stored.

Parameters

 * Note: Providing only names of options without equal sign (e.g. ) results in resetting them. In the case of an arbitrary   name/value pair, the resetting results in the removal of the name/value pair; in other words - deletion.
 * Note: Providing only names of options without equal sign (e.g. ) results in resetting them. In the case of an arbitrary   name/value pair, the resetting results in the removal of the name/value pair; in other words - deletion.
 * Note: Providing only names of options without equal sign (e.g. ) results in resetting them. In the case of an arbitrary   name/value pair, the resetting results in the removal of the name/value pair; in other words - deletion.
 * Note: Providing only names of options without equal sign (e.g. ) results in resetting them. In the case of an arbitrary   name/value pair, the resetting results in the removal of the name/value pair; in other words - deletion.



The change parameter cannot be used to set a value which contains a pipe character "|", as it is used by the API to separate options. If you need to set such a value (for example, a user signature) use an optionname & optionvalue pair.

Available Options
The following is an example list obtained with /w/api.php?action=query&format=json&meta=userinfo&uiprop=options for a Wikipedia account.

Note that most of the options listed here are defined by various MediaWiki extensions, like Echo, VisualEditor, WikiLove, Gadgets or EducationProgram, among others.
 * : 0
 * : 80
 * : "mdy"
 * : 0
 * : 0
 * : "default"
 * : 0
 * : 0
 * : 0
 * : 0
 * : 1
 * : 0
 * : "1"
 * : "1"
 * : "1"
 * : "male"
 * : 0
 * : 0
 * : 2
 * : 0
 * : 0
 * : 0
 * : user signature
 * : 0
 * : 0
 * : 0
 * : 1
 * : "14"
 * : "100"
 * : 25
 * : false
 * : 1
 * : 1
 * : "vector"
 * : 0
 * : "3"
 * : 2
 * : 0
 * : 0
 * : 1
 * : "1"
 * : 0
 * : "2"
 * : 0
 * : 0
 * : 0
 * : 0
 * : 0
 * : 0
 * : "1"
 * : "300"
 * : 1
 * : 1
 * : 1
 * : 0
 * : true
 * : false
 * : 1
 * : 1
 * : true
 * : 0
 * : 0
 * : 0
 * : 0
 * : 0
 * : 1
 * : false
 * : true
 * : false
 * : false
 * : false
 * : true
 * : true
 * : true
 * : false
 * : true
 * : true
 * : 0
 * : "html"
 * : true
 * : true
 * : true
 * : true
 * : false
 * : true
 * : 1
 * : true
 * : false
 * : true
 * : false
 * : false
 * : false
 * : true
 * : true
 * : false
 * : true
 * : false
 * : true
 * : "en"
 * : "gan"
 * : "iu"
 * : "kk"
 * : "ku"
 * : "shi"
 * : "sr"
 * : "tg"
 * : "uz"
 * : "zh"
 * : true
 * : false
 * : "1"
 * : false
 * : "1"
 * : false
 * : "1"
 * : false
 * : "1"
 * : false
 * : "1"
 * : false
 * : "1"
 * : false
 * : "1"
 * : false
 * : false
 * : false
 * : false
 * : false
 * : false
 * : false
 * : false
 * : false
 * : false
 * : false
 * : false
 * : false
 * : 1
 * : 1
 * : 1
 * : 1
 * : 1
 * : "0"
 * : "0"
 * : timestamp
 * : "0"
 * : "ZoneInfo|60|Europe/London"
 * : "0"
 * : "1"
 * : arbitrary value
 * : token
 * : arbitrary value
 * : token

Example
Note: In this example, all parameters are passed in a GET request for the sake of simplicity. However, action=options requires POST requests; GET requests will cause an error.

Possible errors
In addition to the usual stuff: