Create policy update intent
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>"
}
}Resource update intents
Update policy
Create an intent to update a policy. The intent must be authorized by the policy owner before it can be executed.
PATCH
/
v1
/
intents
/
policies
/
{policy_id}
Create policy update intent
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
Headers
Body
application/json
Response
200 - application/json
Created policy update intent.
Response for a policy update intent
Current state of the policy before any changes. If undefined, the resource was deleted and no longer exists
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?

