Update policy rule
curl --request PATCH \
--url https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"name": "<string>",
"conditions": [
{
"field_source": "ethereum_transaction",
"value": "<string>"
}
]
}
'HttpResponse<String> response = Unirest.patch("https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();const options = {
method: 'PATCH',
headers: {
'privy-app-id': '<privy-app-id>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
conditions: [{field_source: 'ethereum_transaction', value: '<string>'}]
})
};
fetch('https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'conditions' => [
[
'field_source' => 'ethereum_transaction',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"privy-app-id: <privy-app-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("privy-app-id", "<privy-app-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "allowlist-ousd-contract-on-tempo-14351345",
"name": "Allowlist OUSD contract on Tempo",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "0x20c0000000000000000000006a37DA5C996874BE"
}
],
"action": "ALLOW"
}Rules
Update a rule in a policy
Update a rule by policy ID and rule ID.
PATCH
/
v1
/
policies
/
{policy_id}
/
rules
/
{rule_id}
Update policy rule
curl --request PATCH \
--url https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"name": "<string>",
"conditions": [
{
"field_source": "ethereum_transaction",
"value": "<string>"
}
]
}
'HttpResponse<String> response = Unirest.patch("https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();const options = {
method: 'PATCH',
headers: {
'privy-app-id': '<privy-app-id>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
conditions: [{field_source: 'ethereum_transaction', value: '<string>'}]
})
};
fetch('https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'conditions' => [
[
'field_source' => 'ethereum_transaction',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"privy-app-id: <privy-app-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("privy-app-id", "<privy-app-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "allowlist-ousd-contract-on-tempo-14351345",
"name": "Allowlist OUSD contract on Tempo",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "0x20c0000000000000000000006a37DA5C996874BE"
}
],
"action": "ALLOW"
}Authorizations
Headers
Path Parameters
Body
application/json
The rules that apply to each method the policy covers.
Method the rule applies to.
Available options:
eth_sendTransaction, eth_signTransaction, eth_signUserOperation, eth_signTypedData_v4, personal_sign, eth_sign7702Authorization, wallet_sendCalls, signTransaction, signAndSendTransaction, signMessage, exportPrivateKey, exportSeedPhrase, signTransactionBytes, signRawMessageBytes, tron_sendTransaction, tron_signTransaction, xrpl_signTransaction, earn_deposit, earn_withdraw, earn_incentive_claim, transfer, * conditions
(EthereumTransactionCondition · object | EthereumCalldataCondition · object | EthereumTypedDataDomainCondition · object | EthereumTypedDataMessageCondition · object | Ethereum7702AuthorizationCondition · object | TempoTransactionCondition · object | SolanaProgramInstructionCondition · object | SolanaInstructionDataCondition · object | SolanaSystemProgramInstructionCondition · object | SolanaTokenProgramInstructionCondition · object | SystemCondition · object | TronTransactionCondition · object | TronCalldataCondition · object | XrplTransactionCondition · object | SuiTransactionCommandCondition · object | SuiTransferObjectsCommandCondition · object | ActionRequestBodyCondition · object | AggregationCondition · object | MessageSigningCondition · object)[]
required
The verbatim Ethereum transaction object in an eth_signTransaction or eth_sendTransaction request.
- EthereumTransactionCondition
- EthereumCalldataCondition
- EthereumTypedDataDomainCondition
- EthereumTypedDataMessageCondition
- Ethereum7702AuthorizationCondition
- TempoTransactionCondition
- SolanaProgramInstructionCondition
- SolanaInstructionDataCondition
- SolanaSystemProgramInstructionCondition
- SolanaTokenProgramInstructionCondition
- SystemCondition
- TronTransactionCondition
- TronCalldataCondition
- XrplTransactionCondition
- SuiTransactionCommandCondition
- SuiTransferObjectsCommandCondition
- ActionRequestBodyCondition
- AggregationCondition
- MessageSigningCondition
Show child attributes
Show child attributes
Response
200 - application/json
Updated policy rule object.
A rule that defines the conditions and action to take if the conditions are true.
Method the rule applies to.
Available options:
eth_sendTransaction, eth_signTransaction, eth_signUserOperation, eth_signTypedData_v4, personal_sign, eth_sign7702Authorization, wallet_sendCalls, signTransaction, signAndSendTransaction, signMessage, exportPrivateKey, exportSeedPhrase, signTransactionBytes, signRawMessageBytes, tron_sendTransaction, tron_signTransaction, xrpl_signTransaction, earn_deposit, earn_withdraw, earn_incentive_claim, transfer, * conditions
(EthereumTransactionCondition · object | EthereumCalldataCondition · object | EthereumTypedDataDomainCondition · object | EthereumTypedDataMessageCondition · object | Ethereum7702AuthorizationCondition · object | TempoTransactionCondition · object | SolanaProgramInstructionCondition · object | SolanaInstructionDataCondition · object | SolanaSystemProgramInstructionCondition · object | SolanaTokenProgramInstructionCondition · object | SystemCondition · object | TronTransactionCondition · object | TronCalldataCondition · object | XrplTransactionCondition · object | SuiTransactionCommandCondition · object | SuiTransferObjectsCommandCondition · object | ActionRequestBodyCondition · object | AggregationCondition · object | MessageSigningCondition · object)[]
required
The verbatim Ethereum transaction object in an eth_signTransaction or eth_sendTransaction request.
- EthereumTransactionCondition
- EthereumCalldataCondition
- EthereumTypedDataDomainCondition
- EthereumTypedDataMessageCondition
- Ethereum7702AuthorizationCondition
- TempoTransactionCondition
- SolanaProgramInstructionCondition
- SolanaInstructionDataCondition
- SolanaSystemProgramInstructionCondition
- SolanaTokenProgramInstructionCondition
- SystemCondition
- TronTransactionCondition
- TronCalldataCondition
- XrplTransactionCondition
- SuiTransactionCommandCondition
- SuiTransferObjectsCommandCondition
- ActionRequestBodyCondition
- AggregationCondition
- MessageSigningCondition
Show child attributes
Show child attributes
Was this page helpful?

