Get Policy Rule
curl --request GET \
--url https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'privy-app-id: <privy-app-id>'HttpResponse<String> response = Unirest.get("https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.asString();const options = {
method: 'GET',
headers: {'privy-app-id': '<privy-app-id>', Authorization: 'Basic <encoded-value>'}
};
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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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"
"net/http"
"io"
)
func main() {
url := "https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("privy-app-id", "<privy-app-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "rule_123",
"name": "Allowlist USDC contract on Base",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
],
"action": "ALLOW"
}Rules
Get a rule from a policy
Get a rule by policy ID and rule ID.
GET
/
v1
/
policies
/
{policy_id}
/
rules
/
{rule_id}
Get Policy Rule
curl --request GET \
--url https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'privy-app-id: <privy-app-id>'HttpResponse<String> response = Unirest.get("https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.asString();const options = {
method: 'GET',
headers: {'privy-app-id': '<privy-app-id>', Authorization: 'Basic <encoded-value>'}
};
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 => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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"
"net/http"
"io"
)
func main() {
url := "https://api.privy.io/v1/policies/{policy_id}/rules/{rule_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("privy-app-id", "<privy-app-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "rule_123",
"name": "Allowlist USDC contract on Base",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
],
"action": "ALLOW"
}Authorizations
Basic Auth header with your app ID as the username and your app secret as the password.
Headers
ID of your Privy app.
Path Parameters
Required string length:
24Required string length:
24Response
200 - application/json
Requested policy rule object.
A rule that defines the conditions and action to take if the conditions are true.
Required string length:
1 - 50Method 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, transfer, * conditions
(EthereumTransactionCondition · object | EthereumCalldataCondition · object | EthereumTypedDataDomainCondition · object | EthereumTypedDataMessageCondition · object | Ethereum7702AuthorizationCondition · object | TempoTransactionCondition · object | SolanaProgramInstructionCondition · 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
- SolanaSystemProgramInstructionCondition
- SolanaTokenProgramInstructionCondition
- SystemCondition
- TronTransactionCondition
- TronCalldataCondition
- XrplTransactionCondition
- SuiTransactionCommandCondition
- SuiTransferObjectsCommandCondition
- ActionRequestBodyCondition
- AggregationCondition
- MessageSigningCondition
Show child attributes
Show child attributes
The action to take when a policy rule matches.
Available options:
ALLOW, DENY Was this page helpful?

