Policies

Evaluate policy.

Changed on

Evaluates an operation against policies without actually performing the operation. Use this endpoint to check if an operation would be allowed before attempting it.

post/v2/policies/evaluate

Request

  • Base URL: https://api.openfort.io
  • URL: https://api.openfort.io/v2/policies/evaluate
  • Auth: one of:
    • HTTP bearer
    • HTTP bearer
    • HTTP bearer

Request body

operationstring required

The signing operation to evaluate. EVM: signEvmTransaction, sendEvmTransaction, signEvmTypedData, signEvmMessage, signEvmHash Solana: signSolTransaction, sendSolTransaction, signSolMessage

accountIdstring

The account ID to evaluate policies for (starts with acc_). If not provided, only project-scoped policies are evaluated.

Example request

{
  "operation": "signEvmTransaction",
  "accountId": "acc_48eeba57-2cd5-4159-a2cb-057a23a35e65",
  "payload": {
    "chainId": 1,
    "to": "0x742d35Cc6634C0532925a3b844Bc9e7595f0aB12",
    "value": "1000000000000000000",
    "data": "0xa9059cbb...",
    "primaryType": "Permit",
    "network": "mainnet-beta",
    "solValue": "1000000000"
  }
}

Response

Successful response.

object'policy_evaluation' required

The object type.

allowedboolean required

Whether the operation is allowed by the policy.

reasonstring required

The reason for the policy decision.

operationstring required

The operation that was evaluated.

accountIdstring

The account ID that was evaluated (if any).

matchedPolicyIdstring

The ID of the policy that matched (if any).

matchedRuleIdstring

The ID of the rule that matched (if any).

Example response

{
  "object": "policy_evaluation",
  "allowed": true,
  "reason": "Allowed by policy rule",
  "operation": "signEvmTransaction",
  "accountId": "acc_48eeba57-2cd5-4159-a2cb-057a23a35e65",
  "matchedPolicyId": "ply_48eeba57-2cd5-4159-a2cb-057a23a35e65",
  "matchedRuleId": "plr_48eeba57-2cd5-4159-a2cb-057a23a35e65"
}

Changes