curl --request PATCH \
--url https://api.privy.io/v1/intents/policies/{policy_id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"name": "<string>",
"rules": [
{
"name": "<string>",
"conditions": [
{
"field_source": "ethereum_transaction",
"value": "<string>"
}
]
}
],
"owner": {
"user_id": "<string>"
},
"owner_id": "<string>"
}
'HttpResponse<String> response = Unirest.patch("https://api.privy.io/v1/intents/policies/{policy_id}")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"owner\": {\n \"user_id\": \"<string>\"\n },\n \"owner_id\": \"<string>\"\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>',
rules: [
{
name: '<string>',
conditions: [{field_source: 'ethereum_transaction', value: '<string>'}]
}
],
owner: {user_id: '<string>'},
owner_id: '<string>'
})
};
fetch('https://api.privy.io/v1/intents/policies/{policy_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/intents/policies/{policy_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>',
'rules' => [
[
'name' => '<string>',
'conditions' => [
[
'field_source' => 'ethereum_transaction',
'value' => '<string>'
]
]
]
],
'owner' => [
'user_id' => '<string>'
],
'owner_id' => '<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}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"owner\": {\n \"user_id\": \"<string>\"\n },\n \"owner_id\": \"<string>\"\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))
}{
"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": "POLICY",
"request_details": {
"method": "PATCH",
"url": "<string>",
"body": {
"name": "<string>",
"rules": [
{
"name": "<string>",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "<string>"
}
],
"action": "ALLOW"
}
],
"owner": {
"user_id": "<string>"
},
"owner_id": "<string>"
}
},
"created_by_id": "<string>",
"rejected_at": 123,
"dismissed_at": 123,
"dismissal_reason": "<string>",
"current_resource_data": {
"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,
"response_body": {
"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
},
"prior_state": {
"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
},
"authorized_by_display_name": "<string>",
"authorized_by_id": "<string>"
}
}Update policy
Create an intent to update a policy. The intent must be authorized by the policy owner before it can be executed.
curl --request PATCH \
--url https://api.privy.io/v1/intents/policies/{policy_id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"name": "<string>",
"rules": [
{
"name": "<string>",
"conditions": [
{
"field_source": "ethereum_transaction",
"value": "<string>"
}
]
}
],
"owner": {
"user_id": "<string>"
},
"owner_id": "<string>"
}
'HttpResponse<String> response = Unirest.patch("https://api.privy.io/v1/intents/policies/{policy_id}")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"owner\": {\n \"user_id\": \"<string>\"\n },\n \"owner_id\": \"<string>\"\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>',
rules: [
{
name: '<string>',
conditions: [{field_source: 'ethereum_transaction', value: '<string>'}]
}
],
owner: {user_id: '<string>'},
owner_id: '<string>'
})
};
fetch('https://api.privy.io/v1/intents/policies/{policy_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/intents/policies/{policy_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>',
'rules' => [
[
'name' => '<string>',
'conditions' => [
[
'field_source' => 'ethereum_transaction',
'value' => '<string>'
]
]
]
],
'owner' => [
'user_id' => '<string>'
],
'owner_id' => '<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}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"owner\": {\n \"user_id\": \"<string>\"\n },\n \"owner_id\": \"<string>\"\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))
}{
"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": "POLICY",
"request_details": {
"method": "PATCH",
"url": "<string>",
"body": {
"name": "<string>",
"rules": [
{
"name": "<string>",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "<string>"
}
],
"action": "ALLOW"
}
],
"owner": {
"user_id": "<string>"
},
"owner_id": "<string>"
}
},
"created_by_id": "<string>",
"rejected_at": 123,
"dismissed_at": 123,
"dismissal_reason": "<string>",
"current_resource_data": {
"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,
"response_body": {
"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
},
"prior_state": {
"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
},
"authorized_by_display_name": "<string>",
"authorized_by_id": "<string>"
}
}Authorizations
Basic Auth header with your app ID as the username and your app secret as the password.
Headers
ID of your Privy app.
Request expiry. Value is a Unix timestamp in milliseconds representing the deadline by which the request must be processed.
Path Parameters
ID of the policy.
Body
Name to assign to policy.
1 - 50Show child attributes
Show child attributes
Owner input specifying a Privy user ID.
- OwnerInputUser
- OwnerInputPublicKey
Show child attributes
Show child attributes
The key quorum ID to set as the owner of the resource. If you provide this, do not specify an owner.
Response
Created policy update intent.
Response for a policy intent
Unique ID for the intent
Display name of the user who created the intent
Unix timestamp when the intent was created
ID of the resource being modified (wallet_id, policy_id, etc)
Detailed authorization information including key quorum members, thresholds, and signature status
Show child attributes
Show child attributes
Current status of an intent.
pending, processing, executed, failed, expired, rejected, dismissed Whether this intent has a custom expiry time set by the client. If false, the intent expires after a default duration.
Unix timestamp when the intent expires
POLICY The original policy update request that would be sent to the policy endpoint
Show child attributes
Show child attributes
ID of the user who created the intent. If undefined, the intent was created using the app secret
Unix timestamp when the intent was rejected, present when status is 'rejected'
Unix timestamp when the intent was dismissed, present when status is 'dismissed'
Human-readable reason for dismissal, present when status is 'dismissed'
Current state of the policy before any changes. If undefined, the resource was deleted and no longer exists
Show child attributes
Show child attributes
{
"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
}
Result of policy update execution (only present if status is 'executed' or 'failed')
Show child attributes
Show child attributes
Was this page helpful?

