# Update policy rule

Source: https://business-api-docs.youhodler.com/docs/api/reference/policies/policy-rules-update

## Request

**Request URL — PATCH**
```http
PATCH /policy-rules/{rule_id}
```

**Request Body — application/json**
```json
{
  "name": "Updated policy rule name"
}
```

## Responses

**200 Operation succeeded**

Operation succeeded.

```json
{
  "name": "Large crypto withdrawal approval",
  "description": "Require compliance review for large crypto withdrawals",
  "activated_at": "2026-05-01T10:00:00Z",
  "conditions": [
    {
      "amount_basis": "usd_equivalent",
      "kind": "amount_threshold",
      "operator": "gte",
      "threshold": {
        "currency": "USD",
        "value": "10000.00"
      }
    }
  ],
  "created_at": "2026-05-01T10:00:00Z",
  "decision": {
    "approver_role_ref": "roles/44444444-4444-4444-8444-444444444444",
    "initiator_cannot_approve": true,
    "kind": "require_approval",
    "reason": "large_crypto_withdrawal",
    "threshold": 2
  },
  "etag": "policy-rule-v2-0001",
  "id": "b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
  "operation_type": "withdrawal",
  "resource": "policy_rule",
  "retired_at": null,
  "scope_ref": "enterprises/b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
  "status": "active",
  "updated_at": "2026-05-01T10:00:00Z",
  "version": 1
}
```

**400 Invalid request payload**

Invalid request payload, query, or parameter shape.

```json
{
  "code": "validation_failed",
  "details": {
    "reason": "invalid_condition"
  },
  "message": "Policy rule is invalid."
}
```

**401 Caller is not authenticated or the bearer token is invalid**

Caller is not authenticated or the bearer token is invalid.

```json
{
  "code": "unauthorized",
  "message": "Authentication required."
}
```

**403 Caller lacks the required capability or permitted scope**

Caller lacks the required capability or permitted scope.

```json
{
  "code": "forbidden_capability_scope",
  "details": {
    "reason": "missing_capability"
  },
  "message": "Insufficient capability for this operation."
}
```

**404 Resource not found**

Resource not found.

```json
{
  "code": "resource_not_found",
  "details": {
    "reason": "policy_rule_not_found"
  },
  "message": "Policy rule not found."
}
```

**409 State conflict — the request cannot be applied to the current resource state**

State conflict — the request cannot be applied to the current resource state.

```json
{
  "code": "conflict",
  "details": {
    "reason": "etag_mismatch"
  },
  "message": "ETag mismatch — the rule was modified by a concurrent request."
}
```

**412 If-Match check failed**

If-Match check failed; the resource has changed since the cached etag.

```json
{
  "code": "precondition_failed",
  "details": {
    "reason": "etag_mismatch"
  },
  "message": "If-Match check failed; the resource has changed since the cached etag."
}
```

**422 Operation is not admissible — it violates a business rule**

Operation is not admissible — it violates a business rule, policy constraint, or lifecycle precondition specific to this resource.

```json
{
  "code": "not_admissible",
  "details": {
    "reason": "not_admissible"
  },
  "message": "The operation is not admissible in the current state."
}
```

**429 Request rate limit exceeded**

Request rate limit exceeded. Retry after the delay indicated in the `details.retry_after_ms` field.

```json
{
  "code": "rate_limited",
  "details": {
    "retry_after_ms": 5000
  },
  "message": "Too many requests."
}
```

**502 Upstream service returned an unexpected error**

Upstream service returned an unexpected error.

```json
{
  "code": "upstream_error",
  "message": "An upstream service returned an unexpected error."
}
```

**503 Service is temporarily unavailable**

Service is temporarily unavailable; retry with backoff.

```json
{
  "code": "temporarily_unavailable",
  "details": {
    "reason": "service_temporarily_unavailable"
  },
  "message": "Service is temporarily unavailable."
}
```
