Policies

Create a policy.

Changed on

Creates a new policy with the specified rules.

post/v2/policies

Request

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

Request body

scope'project' | 'account' | 'transaction' required

The scope of the policy.

  • 'project': applies to all accounts (soft validation - no match = user pays)
  • 'account': applies to a specific account (soft validation)
  • 'transaction': only when explicitly passed (hard validation - no match = tx fails)
descriptionstring

A description of what this policy does.

accountIdstring

The account ID for account-scoped policies (starts with acc_). Required when scope is 'account'.

enabledboolean

Whether the policy is enabled.

priorityinteger

Priority of the policy. Higher priority policies are evaluated first.

Example request

{
  "scope": "project",
  "description": "Limit ETH transfers to 1 ETH to approved addresses",
  "accountId": "acc_48eeba57-2cd5-4159-a2cb-057a23a35e65",
  "enabled": true,
  "rules": [
    {
      "action": "accept",
      "operation": "signEvmTransaction",
      "criteria": [
        {
          "type": "evmAddress",
          "operator": "in",
          "addresses": [
            "0x742d35Cc6634C0532925a3b844Bc9e7595f0aB12"
          ]
        }
      ]
    }
  ]
}

Response

Created.

idstring required
object'policyV2' required
createdAtinteger required
scope'project' | 'account' | 'transaction' required
descriptionstring nullable required

A description of what this policy does.

accountIdstring nullable required

The account ID for account-scoped policies.

enabledboolean required

Whether the policy is enabled.

priorityinteger required

Priority of the policy.

Example response

{
  "description": "Limit ETH transfers to 1 ETH to approved addresses",
  "accountId": "acc_48eeba57-2cd5-4159-a2cb-057a23a35e65",
  "enabled": true,
  "rules": [
    {
      "operation": "signEvmTransaction"
    }
  ]
}

Changes

    • info

      the security scope policies:write was added to the endpoint's security scheme sk

    • warning

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

    • info

      added the new transaction enum value to the request property