# Use a Keycloak client role in a rule

1. Open the policy version (draft) in the editor.
2. On the stage, click **+ Add rule**.
3. Set **rule type** to `role`.
4. In the **Role name** field, enter the role exactly as defined on the client (e.g. `PROGRAM_MANAGER`).
5. In the **Client** field, enter the `clientId` (e.g. `registry-staff-portal`). Leave blank for a realm role.
6. Save and activate.

AWE looks up the client by `clientId`, then queries that client's role members. Make sure the AWE service account has `view-clients` and `view-users` realm-management roles — see [Deployment → Client-secret sync and service-account roles](/platform/platform-services/approval-workflow-engine/deployment.md#client-secret-sync-and-service-account-roles).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openg2p.org/platform/platform-services/approval-workflow-engine/how-to/client-role-rule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
