| name | hlx-admin-api-executor |
| description | Interactive AEM Edge Delivery Services (EDS/Helix 5) Admin API executor with human-in-the-loop oversight. Use when working with the AEM Admin API (admin.hlx.page) to: (1) Plan and execute admin operations step-by-step (preview, publish, config, access, cache, index, snapshots, code), (2) Execute ONE API request at a time with human review and approval, (3) Document all requests/responses in EXECUTION.md with full traceability, (4) Follow GET/SET/GET verification patterns for safe configuration changes, (5) Resume existing executions and add new steps, (6) Manage site configuration, access control, content operations, and code deployments. For careful AEM admin operations where mistakes are costly - NOT for bulk automation. |
HLX Admin API Executor
Execute AEM Edge Delivery Services (Helix 5) Admin API workflows with interactive planning, human-in-the-loop approval, and full request/response documentation. One operation at a time for careful admin work.
Execution Philosophy
Single-Step Execution: Execute ONE operation at a time with full human oversight. Each step is planned, executed individually, verified, and documented. This is for serious admin operations where mistakes are costly.
Mode Selection
Determine mode first:
- New: No existing EXECUTION.md. Follow Phases 1-4.
- Resume: Existing EXECUTION.md provided. Read it, identify last completed step, ask what to do next (continue / add step / retry / verify).
When resuming, never overwrite existing steps. Append with correct numbering. Preserve all previous files.
Authentication
Header: X-Auth-Token: ${AUTH_TOKEN}
Obtain token:
- Open
https://admin.hlx.page/login/{ORG}/{SITE}/{REF} in browser
- Extract
auth_token cookie from DevTools > Application > Cookies
- Save to
local-only/auth-token.sh
- TTL: ~7200 seconds (2 hours)
Verify: GET https://admin.hlx.page/profile with X-Auth-Token header.
Site tokens use a different header: Authorization: token hlx_... (not X-Auth-Token).
Environment Variables
export BASE_URL="https://admin.hlx.page"
export ORG="my-org"
export SITE="my-site"
export REPO="my-repo"
export REF="main"
URL Patterns
| Environment | Pattern |
|---|
| Admin API | https://admin.hlx.page/... |
| Preview | https://{REF}--{SITE}--{ORG}.aem.page/{path} |
| Live | https://{REF}--{SITE}--{ORG}.aem.live/{path} |
Endpoint Reference
For the full endpoint catalog with parameters, response schemas, and job polling details, read references/endpoints.md.
Critical Quirks
- POST overwrites entire config: Access endpoints (
access/admin.json, access/site.json, etc.) replace the entire config on POST. Always GET first, merge changes, then POST the complete payload.
- Single user per POST:
/config/{ORG}/users.json accepts one user object only. Array payloads return 400.
- Site token shown once:
POST /config/{ORG}/sites/{SITE}/secrets.json returns the token value only on creation. Record immediately.
- Bulk ops return 202: Preview/publish/index bulk operations return 202 with a job URL. Poll
GET /job/{ORG}/{SITE}/{REF}/{topic}/{jobName} until state is completed or failed.
- Config auto-reset risk: AEM technical accounts may push config during bulk operations from AEM Sites Console, reverting changes. Verify config after bulk operations.
- Version tracking: Every config change increments the version. Use
/config/{ORG}/sites/{SITE}/versions/{N}.json for auditing or recovery.
- Rate limits: 429 responses when exceeded. Content source operations (preview with
?edit=auto) are subject to SharePoint/Google Docs rate limits (503 on timeout).
Folder Structure
{site-or-project}/
└── YYYY-MM-DD-description/
├── EXECUTION.md
├── .env-setup.sh
└── execution-files/
├── step-1.1-get-description-response.json
├── step-2.1-set-description-request.json
├── step-2.2-set-description-response.json
└── step-3.1-get-verify-description-response.json
Step Numbering
Use decimal sub-steps: .1 for request payload, .2 for response. GET-only steps have one sub-step (.1 for response).
Workflow
Phase 1: Planning
Ask:
- What's the goal?
- What org/site/ref?
- What resources are involved?
- What's the sequence? Suggest GET/SET/GET pattern.
- Where to save files? Suggest
YYYY-MM-DD-description/.
Phase 2: Generate Plan
Create EXECUTION.md with steps as TODO. Each step includes:
- OBJECTIVE: What it accomplishes
- Endpoint: Full URL with method
- Command: Complete curl using env vars and
@file references
- Acceptance Criteria: What success looks like
- Validation: Checkbox list
Create .env-setup.sh with all needed variables. Show plan for approval.
Phase 3: Execution
Execute ONE step at a time. Wait for user confirmation between steps.
GET Requests
source .env-setup.sh
HTTP_STATUS=$(curl -s --request GET \
--url "${BASE_URL}/config/${ORG}/sites/${SITE}.json" \
--header "X-Auth-Token: ${AUTH_TOKEN}" \
-o execution-files/step-1.1-get-site-config-response.json \
-w "%{http_code}")
echo "HTTP Status: ${HTTP_STATUS}"
cat execution-files/step-1.1-get-site-config-response.json | jq
POST/PUT/DELETE (Require Human Review)
Every non-GET request requires human review with a justification block before execution.
- Save request payload to
execution-files/step-N.1-...-request.json
- Present the Change Justification block (see format below)
- Show curl command referencing
@file and the file path
- Wait for explicit "Yes" before executing
- Never inline request body in approval prompt
On failure: If a POST/PUT/DELETE returns a non-2xx status, do NOT automatically retry or fix the request. Instead:
- Report the failure (status code, response body) to the user
- Investigate the root cause (wrong content type, malformed payload, missing fields, etc.)
- Present the proposed fix as a new Change Justification block with WHY/WHAT/HOW
- Wait for explicit human approval before executing the corrected request
This applies even when the fix is obvious. The human must review every mutation attempt.
Approval format with justification:
## Change Review: Step N — [Description]
### WHY
Why is this change needed? What problem does it solve or what goal does it advance?
### WHAT
What exactly is being changed? Describe the before → after state.
Reference the current state from the preceding GET step.
### HOW
How is the change applied? Which endpoint, method, and payload fields are involved?
Call out any side effects (e.g., "POST replaces entire config — all existing fields preserved").
---
Endpoint: POST https://admin.hlx.page/config/{ORG}/sites/{SITE}/access/admin.json
Request payload saved to:
execution-files/step-N.1-set-access-admin-request.json
Command:
curl -s --request POST \
--url "${BASE_URL}/config/${ORG}/sites/${SITE}/access/admin.json" \
--header "Content-Type: application/json" \
--header "X-Auth-Token: ${AUTH_TOKEN}" \
--data @execution-files/step-N.1-set-access-admin-request.json \
-o execution-files/step-N.2-set-access-admin-response.json \
-w "%{http_code}"
Ready to execute? (Yes / No / Modify)
Phase 4: Documentation
Update EXECUTION.md after each step:
- Mark completed steps with
✅ COMPLETED
- Record HTTP status and key findings under Result
- Check off validation items
GET/SET/GET Pattern
For every modification, execute in sequence, one step at a time:
- GET before - Capture current state, wait for user
- SET - Apply the change, wait for user
- GET after - Verify persistence, wait for user
Never execute multiple steps without user confirmation between them.
curl Conventions
${ENV_VARS} - never hardcode values
-s for silent mode
--request METHOD explicit method
--data @file for request bodies (never inline in curl)
-o execution-files/step-N.N-description.json for output
-w "%{http_code}" to capture status
- Pipe to
jq for display
Roles Reference
| Role | Purpose |
|---|
config_admin | Technical account for API automation |
author | Preview, Sidekick, Universal Editor (no publish) |
publish | All author permissions + publish to live |
Templates