Policies

Create Policy Rule

Changed on

Create a new rule for a policy.

post/v1/policies/{policy_id}/rules

Request

  • Base URL
    https://api.privy.io
  • URL
    https://api.privy.io/v1/policies/{policy_id}/rules
  • Auth
    HTTP basic

Path parameters

policy_idstring required

Headers

privy-app-idstring required

ID of your Privy app.

privy-authorization-signaturestring

Request authorization signature. If multiple signatures are required, they should be comma separated.

privy-request-expirystring

Request expiry. Value is a Unix timestamp in milliseconds representing the deadline by which the request must be processed.

Request body

namestring required
method'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' | '*' required

Method the rule applies to.

action'ALLOW' | 'DENY' required

The action to take when a policy rule matches.

Example request

{
  "conditions": [
    {
      "field": "content"
    }
  ]
}

Response

Created policy rule object.

namestring required
method'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' | '*' required

Method the rule applies to.

action'ALLOW' | 'DENY' required

The action to take when a policy rule matches.

idstring required

Example response

{
  "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"
}

Changes

    • warning

      added the new earn_incentive_claim enum value to the response property for the response status

    • info

      added the new earn_incentive_claim enum value to the request property

    • warning

      added the new data_byte_length enum value to the /// response property for the response status

    • info

      added the new data_byte_length enum value to the request property ///