Policies
Overview
Create, inspect, attach, or remove JSON access policies. Routes use /wp-json/aam/v2 on a standard WordPress installation.
Endpoints
| Method | Route | Input | Purpose |
|---|---|---|---|
| GET | /policies |
fields |
Get policies. |
| POST | /policies |
policy, title, excerpt, effect, status, fields |
Create policy. |
| DELETE | /policies |
— | Reset policies. |
| GET | /policy/{id} |
id, fields |
Get policy. |
| PATCH | /policy/{id} |
id, effect, fields |
Toggle policy. |
| DELETE | /policy/{id} |
id |
Delete policy. |
PATCH rows also accept POST and PUT because WordPress registers them as editable routes. The Input column lists route-specific parameters. A path parameter in {braces} is required. WordPress validates body and query parameters against the registered route schema.
Parameter guide
The route table shows which operation uses each parameter. Path parameters are required; other requirements depend on the operation.
| Parameter | Type | Meaning |
|---|---|---|
effect |
string |
Attach or detach policy. |
excerpt |
string |
Policy short description. |
fields |
string |
List of additional fields to return. |
id |
number |
Policy ID. |
policy |
string |
JSON policy. |
status |
string |
Policy status. |
title |
string |
Policy title. |
Access level and authorization
Most routes accept access_level=role&role_id=editor, access_level=user&user_id=42, access_level=visitor, or access_level=default. This selects whose rules you read or change. A path ID or body value selects the target.
Required permission: aam_manager and aam_manage_policies. See Authentication and Error handling.
Example
GET /wp-json/aam/v2/policies?access_level=role&role_id=editor
Authorization: Basic <base64 username:application-password>
This lists policies attached to or available to the Editor access level.