Skip to main content
MetaMask

wallet_requestPermissions

Summary: Requests additional permissions.

Requests additional permissions from the user. This method accepts a single permission per call. Specified by EIP-2255.

Parameters

Permission
object
required

Object containing the permission to request.

permission_name
object

The permission object. permission_name is the name of the permission being requested.

Returns

Permissions list
array

An array of the user's permissions.

Permission
object

Object containing information about the permission.

id
string

The permission ID.

parentCapability
string

The name of the permission being granted. For example, eth_accounts or endowment:permitted-chains.

invoker
string

The URI of the dapp being granted this permission.

caveats
array

An array of caveats that specify restrictions on the permission.

Caveat
object

Object containing information about the caveat.

type
string

Type of caveat.

value

Value of the caveat.

name
string

Name of the caveat.

date
number

The timestamp of the permission request.

Errors

Code
Message
4001
User rejected the request.
Customize request
Parameter
Value
{}
object

Connect your MetaMask wallet to run requests successfully.

Request

await window.ethereum.request({
"method": "wallet_requestPermissions",
"params": [
{
eth_accounts: {}
}
],
});

Example response

{
"eth_accounts": {}
}