Create a policy
Use the PrivyClient
’s createPolicy
method to create a new policy.
Use the PrivyClient
’s createPolicy
method to create a new policy.
To create a new policy, make a POST
request to:
In the request headers, make sure to include Privy’s required authentication headers and headers that may be required for your app’s wallet API setup.
Body
In the request body, include the following:
Version of the policy. Currently, 1.0 is the only version.
Name to assign to policy.
Chain type for wallets that the policy will be applied to.
A list of Rule
objects describing what rules to apply to each RPC method (e.g.
'eth_sendTransaction'
) that the wallet can take. Learn more about
Rule
s.
Once you have successfully created a policy, you can assign that policy to server wallets at creation.
Currently, the policy engine supports the eth_signTransaction
and eth_sendTransaction
RPC
methods and the ethereum_transaction
field source. We are actively expanding support
here.
Response
If the policy is created successfully, the response will include the request body as well as an additional unique id
field for the policy.
Unique ID for the policy.
Version of the policy. Currently, 1.0 is the only version.
Name to assign to policy.
Chain type for wallets that the policy will be applied to.
A list of Rule
objects describing what rules to apply to each RPC method (e.g.
'eth_sendTransaction'
) that the wallet can take. Learn more about
Rule
s.
Example
As an example, a sample request to create a new eth_sendTransaction
policy might look like the following:
A successful response will look like the following: