| Action | Method | Endpoint |
|---|---|---|
| Add a rule | POST | /v1/intents/policies/{policy_id}/rules |
| Update a rule | PATCH | /v1/intents/policies/{policy_id}/rules/{rule_id} |
| Delete a rule | DELETE | /v1/intents/policies/{policy_id}/rules/{rule_id} |
Intents expire 72 hours after creation by default. Signers must
authorize them within this window.
- REST API
- Node SDK
- Go SDK
- Ruby SDK
- Java SDK
- Python SDK
curl -X POST https://api.privy.io/v1/intents/policies/<policy_id>/rules \
-u "<your-privy-app-id>:<your-privy-app-secret>" \
-H "privy-app-id: <your-privy-app-id>" \
-H "Content-Type: application/json" \
-d '{
"name": "Restrict destination address",
"method": "eth_sendTransaction",
"action": "ALLOW",
"conditions": [
{
"field": "to",
"field_source": "ethereum_transaction",
"operator": "eq",
"value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
]
}'
import {PrivyClient, type IntentCreatePolicyRuleParams} from '@privy-io/node';
const client = new PrivyClient({
appId: 'your-app-id',
appSecret: 'your-app-secret'
});
const rule: IntentCreatePolicyRuleParams = {
name: 'Restrict destination address',
method: 'eth_sendTransaction',
action: 'ALLOW',
conditions: [
{
field: 'to',
field_source: 'ethereum_transaction',
operator: 'eq',
value: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
}
]
};
const intent = await client.intents().createPolicyRule('insert-policy-id', rule);
console.log(intent.intent_id, intent.status, intent.authorization_details);
import privy "github.com/privy-io/go-sdk"
client := privy.NewPrivyClient(privy.PrivyClientOptions{
AppID: "your-app-id",
AppSecret: "your-app-secret",
})
intent, err := client.Intents.NewPolicyRule(ctx, "policy-id", privy.IntentNewPolicyRuleParams{
PolicyRuleRequestBody: privy.PolicyRuleRequestBody{
Name: "Restrict destination address",
Action: privy.PolicyActionAllow,
Method: privy.PolicyMethodEthSendTransaction,
Conditions: []privy.PolicyConditionUnion{
{
OfEthereumTransaction: &privy.EthereumTransactionCondition{
Field: privy.EthereumTransactionConditionFieldTo,
FieldSource: privy.EthereumTransactionConditionFieldSourceEthereumTransaction,
Operator: privy.ConditionOperatorEq,
Value: privy.ConditionValueUnion{OfString: privy.String("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913")},
},
},
},
},
})
require "privy"
client = Privy::PrivyClient.new(
app_id: "your-app-id",
app_secret: "your-app-secret"
)
intent = client.intents.create_policy_rule(
"policy-id",
name: "Restrict destination address",
method_: "eth_sendTransaction",
action: "ALLOW",
conditions: [
{
field: "to",
field_source: "ethereum_transaction",
operator: "eq",
value: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
]
)
puts(intent.intent_id, intent.status, intent.authorization_details)
import io.privy.api.PrivyClient;
import io.privy.api.models.components.*;
import io.privy.api.models.operations.IntentCreateRuleResponse;
import java.util.List;
PrivyClient client = PrivyClient.builder()
.appId("your-privy-app-id")
.appSecret("your-app-secret")
.build();
IntentCreateRuleResponse intent = client.intents().createRule(
"insert-policy-id",
PolicyRuleRequestBody.builder()
.name("Restrict destination address")
.method(PolicyMethod.ETH_SEND_TRANSACTION)
.action(PolicyAction.ALLOW)
.conditions(List.of(EthereumTransactionCondition.builder()
.field(EthereumTransactionConditionField.TO)
.fieldSource(EthereumTransactionConditionFieldSource.ETHEREUM_TRANSACTION)
.operator(ConditionOperator.EQ)
.value(ConditionValue.of("0xB00F0759DbeeF5E543Cc3E3B07A6442F5f3928a2"))
.build()))
.build(),
null);
intent = client.intents.create_policy_rule(
"insert-policy-id",
intent_create_policy_rule_params={
"name": "Restrict destination address",
"action": "ALLOW",
"method": "eth_sendTransaction",
"conditions": [
{
"field": "to",
"field_source": "ethereum_transaction",
"operator": "eq",
"value": "insert-token-contract-address",
}
],
},
)
Next steps
Sign intents
Add authorization signatures to execute a proposed intent.
Intent status
Track an intent from proposal to execution.

