curl --request POST \
--url https://api.privy.io/v1/policies \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"version": "1.0",
"name": "<string>",
"rules": [
{
"name": "<string>",
"conditions": [
{
"field_source": "ethereum_transaction",
"value": "<string>"
}
],
"id": "<string>"
}
],
"owner": {
"user_id": "<string>"
},
"owner_id": "<string>"
}
'HttpResponse<String> response = Unirest.post("https://api.privy.io/v1/policies")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"version\": \"1.0\",\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"owner\": {\n \"user_id\": \"<string>\"\n },\n \"owner_id\": \"<string>\"\n}")
.asString();const options = {
method: 'POST',
headers: {
'privy-app-id': '<privy-app-id>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
version: '1.0',
name: '<string>',
rules: [
{
name: '<string>',
conditions: [{field_source: 'ethereum_transaction', value: '<string>'}],
id: '<string>'
}
],
owner: {user_id: '<string>'},
owner_id: '<string>'
})
};
fetch('https://api.privy.io/v1/policies', 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",
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([
'version' => '1.0',
'name' => '<string>',
'rules' => [
[
'name' => '<string>',
'conditions' => [
[
'field_source' => 'ethereum_transaction',
'value' => '<string>'
]
],
'id' => '<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/policies"
payload := strings.NewReader("{\n \"version\": \"1.0\",\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"owner\": {\n \"user_id\": \"<string>\"\n },\n \"owner_id\": \"<string>\"\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))
}{
"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
}Create policy
Create a new policy.
curl --request POST \
--url https://api.privy.io/v1/policies \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"version": "1.0",
"name": "<string>",
"rules": [
{
"name": "<string>",
"conditions": [
{
"field_source": "ethereum_transaction",
"value": "<string>"
}
],
"id": "<string>"
}
],
"owner": {
"user_id": "<string>"
},
"owner_id": "<string>"
}
'HttpResponse<String> response = Unirest.post("https://api.privy.io/v1/policies")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"version\": \"1.0\",\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"owner\": {\n \"user_id\": \"<string>\"\n },\n \"owner_id\": \"<string>\"\n}")
.asString();const options = {
method: 'POST',
headers: {
'privy-app-id': '<privy-app-id>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
version: '1.0',
name: '<string>',
rules: [
{
name: '<string>',
conditions: [{field_source: 'ethereum_transaction', value: '<string>'}],
id: '<string>'
}
],
owner: {user_id: '<string>'},
owner_id: '<string>'
})
};
fetch('https://api.privy.io/v1/policies', 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",
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([
'version' => '1.0',
'name' => '<string>',
'rules' => [
[
'name' => '<string>',
'conditions' => [
[
'field_source' => 'ethereum_transaction',
'value' => '<string>'
]
],
'id' => '<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/policies"
payload := strings.NewReader("{\n \"version\": \"1.0\",\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"conditions\": [\n {\n \"field_source\": \"ethereum_transaction\",\n \"value\": \"<string>\"\n }\n ],\n \"id\": \"<string>\"\n }\n ],\n \"owner\": {\n \"user_id\": \"<string>\"\n },\n \"owner_id\": \"<string>\"\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))
}{
"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
}SDK methods
Learn more about creating policies using our SDKs here.Authorizations
Basic Auth header with your app ID as the username and your app secret as the password.
Headers
ID of your Privy app.
Idempotency keys ensure API requests are executed only once within a 24-hour window.
Body
Version of the policy. Currently, 1.0 is the only version.
1.0 Name to assign to policy.
1 - 50The wallet chain types.
ethereum, solana, cosmos, stellar, sui, aptos, movement, tron, bitcoin-segwit, bitcoin-taproot, pearl, near, ton, starknet, xrpl, spark Show 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 object.
A policy for controlling wallet operations.
Version of the policy. Currently, 1.0 is the only version.
1.0 Name to assign to policy.
1 - 50The wallet chain types.
ethereum, solana, cosmos, stellar, sui, aptos, movement, tron, bitcoin-segwit, bitcoin-taproot, pearl, near, ton, starknet, xrpl, spark Unique ID of the created policy. This will be the primary identifier when using the policy in the future.
24The key quorum ID of the owner of the policy.
Unix timestamp of when the policy was created in milliseconds.
Show child attributes
Show child attributes
Was this page helpful?

