Forgecroft Docs
Guides / Governance

Approval Rules

Predicate-based rules that require approval when conditions are met.

What Are Approval Rules?

Approval rules are conditions that, when matched by a run, create approval requirements. Unlike Rego policies (which evaluate arbitrary logic), approval rules use a fixed set of predicates.

Predicate Conditions

ConditionDescription
alwaysAlways require approval
destroyed_gtRequire approval if more than N resources are destroyed
added_gtRequire approval if more than N resources are added
changed_gtRequire approval if more than N resources are changed
trigger_isRequire approval for specific trigger types (manual, push, schedule, pr, promotion)

Creating an Approval Rule

POST /approval-rules
{
  "name": "production-destroy-approval",
  "approver_type": "team",
  "approver_id": "team-uuid",
  "min_approvals": 1,
  "stage": 1,
  "condition": {
    "type": "destroyed_gt",
    "value": 0
  },
  "timeout_hours": 24,
  "escalation_action": "escalate_to",
  "escalation_team_id": "team-uuid",
  "escalation_reason": "Escalated: production destroy pending"
}
FieldTypeRequiredDescription
namestringYesRule name
approver_typestringYesuser, team, or org_role
approver_idUUIDNoTeam or user ID (for org_role, use approver_role)
approver_rolestringNoOrg role (e.g., admin) when approver_type is org_role
min_approvalsintNoDefault: 1
stageintNoDefault: 1
conditionobjectNoPredicate condition
timeout_hoursintNoHours before escalation
escalation_actionstringNoauto_approve, escalate_to, or reject
escalation_team_idUUIDNoTeam to escalate to
escalation_reasonstringNoReason for escalation
project_idUUIDNoProject scope
workspace_idUUIDNoWorkspace scope

Scope Hierarchy

Like policy sets, approval rules can be scoped to org (global), project, or workspace.

Multi-Stage Approvals

Rules with different stage values activate sequentially:

// Stage 1: Team lead approval
{ "name": "stage-1", "stage": 1, "approver_type": "team", "approver_id": "team-lead-id" }

// Stage 2: Security team approval
{ "name": "stage-2", "stage": 2, "approver_type": "team", "approver_id": "security-team-id" }

All requirements in stage 1 must be satisfied before stage 2 activates.

Escalation

ActionBehavior
auto_approveAutomatically approve after timeout
escalate_toEscalate to escalation_team_id
rejectReject the requirement and the run

Timing note: Escalation actions are processed by a background sweeper that runs periodically, not at the exact moment the timeout elapses. Expect up to 1 hour of additional delay beyond the timeout_hours value. Plan your timeout values accordingly — if you need approval within 4 hours, set timeout_hours: 3 to account for sweeper delay.

Promoting Rules

When a non-admin user creates an approval rule, it is tied to them via created_by. Only the creator and admins can modify or delete it.

An admin can promote the rule:

POST /approval-rules/{id}/promote

This removes the created_by attachment, making it an org-owned rule. After promotion, only admins can modify or delete it.

Updating Rules

PATCH /approval-rules/{id}

Non-admin users can only edit rules they created that haven’t been promoted.