Create policy rule intent
curl --request POST \
--url https://api.privy.io/v1/intents/policies/{policy_id}/rules \
--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.post("https://api.privy.io/v1/intents/policies/{policy_id}/rules")
.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: 'POST',
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/intents/policies/{policy_id}/rules', 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/intents/policies/{policy_id}/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/intents/policies/{policy_id}/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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))
}{
"intent_id": "<string>",
"created_by_display_name": "<string>",
"created_at": 123,
"resource_id": "<string>",
"authorization_details": [
{
"members": [
{
"type": "user",
"user_id": "<string>",
"signed_at": 123
}
],
"threshold": 123,
"display_name": "<string>"
}
],
"status": "pending",
"custom_expiry": true,
"expires_at": 123,
"intent_type": "RULE",
"request_details": {
"method": "POST",
"url": "<string>",
"body": {
"name": "<string>",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "<string>"
}
],
"action": "ALLOW"
}
},
"created_by_id": "<string>",
"rejected_at": 123,
"dismissed_at": 123,
"dismissal_reason": "<string>",
"current_resource_data": {
"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"
},
"policy": {
"id": "tb54eps4z44ed0jepousxi4n",
"name": "Allowlisted stablecoins",
"chain_type": "ethereum",
"rules": [
{
"id": "bdyfoa65pro1eez6iwtzanol",
"name": "Allowlist USDC contract on Base",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
],
"action": "ALLOW"
}
],
"owner_id": null,
"version": "1.0",
"created_at": 1741833088894
},
"action_result": {
"status_code": 123,
"executed_at": 123,
"authorized_by_display_name": "<string>",
"authorized_by_id": "<string>",
"response_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"
},
"prior_state": {
"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"
}
}
}Resource update intents
Create rule
Create an intent to add a rule to a policy. The intent must be authorized by the policy owner before it can be executed.
POST
/
v1
/
intents
/
policies
/
{policy_id}
/
rules
Create policy rule intent
curl --request POST \
--url https://api.privy.io/v1/intents/policies/{policy_id}/rules \
--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.post("https://api.privy.io/v1/intents/policies/{policy_id}/rules")
.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: 'POST',
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/intents/policies/{policy_id}/rules', 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/intents/policies/{policy_id}/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/intents/policies/{policy_id}/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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))
}{
"intent_id": "<string>",
"created_by_display_name": "<string>",
"created_at": 123,
"resource_id": "<string>",
"authorization_details": [
{
"members": [
{
"type": "user",
"user_id": "<string>",
"signed_at": 123
}
],
"threshold": 123,
"display_name": "<string>"
}
],
"status": "pending",
"custom_expiry": true,
"expires_at": 123,
"intent_type": "RULE",
"request_details": {
"method": "POST",
"url": "<string>",
"body": {
"name": "<string>",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "<string>"
}
],
"action": "ALLOW"
}
},
"created_by_id": "<string>",
"rejected_at": 123,
"dismissed_at": 123,
"dismissal_reason": "<string>",
"current_resource_data": {
"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"
},
"policy": {
"id": "tb54eps4z44ed0jepousxi4n",
"name": "Allowlisted stablecoins",
"chain_type": "ethereum",
"rules": [
{
"id": "bdyfoa65pro1eez6iwtzanol",
"name": "Allowlist USDC contract on Base",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
],
"action": "ALLOW"
}
],
"owner_id": null,
"version": "1.0",
"created_at": 1741833088894
},
"action_result": {
"status_code": 123,
"executed_at": 123,
"authorized_by_display_name": "<string>",
"authorized_by_id": "<string>",
"response_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"
},
"prior_state": {
"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
Headers
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
Created rule intent.
Response for a create or update rule intent
Current state of the rule before any changes. Undefined for create intents or if the rule was deleted
Show child attributes
Show child attributes
Example:
{
"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"
}
Parent policy containing this rule, including sibling rules for contextual display
Show child attributes
Show child attributes
Example:
{
"id": "tb54eps4z44ed0jepousxi4n",
"name": "Allowlisted stablecoins",
"chain_type": "ethereum",
"rules": [
{
"id": "bdyfoa65pro1eez6iwtzanol",
"name": "Allowlist USDC contract on Base",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
],
"action": "ALLOW"
}
],
"owner_id": null,
"version": "1.0",
"created_at": 1741833088894
}
Was this page helpful?

