Skip to content

Getting a policy

To get a policy by its ID, make a GET request to:

bash
https://api.privy.io/v1/policies/<policy_id>

Replacing <policy_id> with the ID of your desired policy.

A sample request to fetch a policy with ID fmfdj6yqly31huorjqzq38zc looks like:

bash
curl --request GET https://api.privy.io/v1/policies/fmfdj6yqly31huorjqzq38zc \
-u "<your-privy-app-id>:<your-privy-app-secret>" \
-H "privy-app-id: <your-privy-app-id>"

A successful response will look like the following:

json
{
  "id": "fmfdj6yqly31huorjqzq38zc",
  "name": "Allowlist certain smart contracts",
  "version": "1.0",
  "chain_type": "ethereum",
  "method_rules": [
    {
      "method": "eth_sendTransaction",
      "rules": [
        {
          "name": "Allowlist USDC",
          "conditions": [
            {
              "field_source": "ethereum_transaction",
              "field": "to",
              "operator": "eq",
              "value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
            }
          ],
          "action": "ALLOW"
        }
      ]
    }
  ],
  "default_action": "DENY"
}