Review content changes with the AEO API
The Optimizer turns recommendations into a proposed change to one of your pages and waits for a person to approve or reject it. This walkthrough follows that review from your backend: read recommendations, request a proposed change, read it, and record a decision.
Approving a change does not publish it. The approval records that a reviewer accepted that exact proposal. Your own system decides what happens next.
Before you start
- The proposal and review workflow requires Optimizer (
growth). The board is also available on Analyzer (starter). - A brand (
POST /v2/brands) with a domain, and a page URL on that domain. - An API key with the scopes in the table below, and users or services with the roles shown. Set
AEO_API_BASE_URLto your API origin andAEO_API_KEYto your key, and call from your server.
| Step | Operation | Scope | Roles |
|---|---|---|---|
| Read recommendations | GET /v2/recommendations |
recommendations:read |
viewer, editor, approver, publisher, owner, service |
| Request a proposed change | PATCH /v2/recommendations with section: "act" |
optimizations:write |
editor, owner, service |
| Read it | GET /v2/recommendations?view=action&action_id={action_id} |
optimizations:read |
viewer, editor, approver, publisher, owner, service |
| Approve or reject | PATCH /v2/recommendations with section: "decide" |
optimizations:write |
approver, owner |
1. Read the recommendations
Ask for the recommendations for one brand.
curl --fail-with-body --get "$AEO_API_BASE_URL/v2/recommendations" \
-H "Authorization: Bearer $AEO_API_KEY" \
--data-urlencode "brand_id=$BRAND_ID" \
--data-urlencode "view=diagnosis"Use the diagnosis view to read the recommendation fields below. To work with task items, see Track it on a board.
| Field | Meaning |
|---|---|
id |
UUID. Use it as a recommendation_ids value in step 2. |
title, hypothesis |
What to change and why. |
type |
debugger, content, citation, technical or local. |
severity |
critical, high, medium, low or info. |
priority |
Integer from 1 to 5. |
effort |
small, medium or large. |
expected_impact, verification |
What you expect to change and how to check it. |
evidence_ids |
The saved evidence behind the recommendation. |
status |
open, resolved or dismissed. |
Example response, not live data (one recommendation, values are placeholders):
{
"data": [
{
"id": "<uuid>",
"brand_id": "<uuid>",
"title": "<text>",
"type": "content",
"severity": "medium",
"priority": "<integer 1 to 5>",
"effort": "small",
"status": "open",
"evidence_ids": ["<uuid>"]
}
],
"meta": { "request_id": "<uuid>", "next_cursor": null }
}Choose the recommendations you want a change for. One request can include up to 20.
2. Request a proposed change
Send the brand, the recommendation IDs, the page URL, and max_units. The page URL must be on a domain of the brand. max_units is an integer of at least 1.
Before requesting a proposal, run PROPOSAL_KEY=$(uuidgen) once and save the key for this operation. Retry with the saved key and the same request body. Generate a new key for each new operation.
curl --fail-with-body -X PATCH "$AEO_API_BASE_URL/v2/recommendations" \
-H "Authorization: Bearer $AEO_API_KEY" \
-H "Idempotency-Key: ${PROPOSAL_KEY:?Set PROPOSAL_KEY before sending}" \
-H "Content-Type: application/json" \
-d '{
"section": "act",
"workflow": "optimization",
"brand_id": "'"$BRAND_ID"'",
"recommendation_ids": ["'"$RECOMMENDATION_ID"'"],
"target_url": "https://www.example.com/pricing",
"max_units": 100
}'Idempotency-Key is required, 8 to 128 characters. Repeat a request with the same key and the same body and you get the original response. The same key with a different body returns 409. Keys are kept for 7 days.
The response is 202 Accepted. The action is queued. This example shows the v2 response fields with placeholders.
{
"data": {
"id": "<uuid>",
"kind": "optimization",
"state": "queued",
"revision": 1,
"progress": 0,
"estimated_units": "<integer>",
"reserved_units": "<integer>",
"billed_units": "<integer>",
"result": null,
"error": null,
"v2_action_id": "optimization:<uuid>",
"created_at": "<timestamp>",
"updated_at": "<timestamp>"
},
"meta": { "request_id": "<uuid>" }
}Save data.v2_action_id as ACTION_ID for polling and recording a decision. data.billed_units shows the credits charged so far.
3. Read the proposed change
Call GET /v2/recommendations?view=action&action_id={action_id} until state is awaiting_approval.
curl --fail-with-body --get "$AEO_API_BASE_URL/v2/recommendations" \
-H "Authorization: Bearer $AEO_API_KEY" \
--data-urlencode "view=action" \
--data-urlencode "action_id=$ACTION_ID"Pause between requests. Pass the complete data.v2_action_id as ACTION_ID.
The states you can see:
state |
Meaning |
|---|---|
queued, running, in_progress |
Wait before checking again. |
awaiting_approval |
The proposal is ready for a decision. |
approved |
A reviewer approved this exact proposal and the approval has not expired. |
stale_approval |
The approval expired. A new decision is needed. |
rejected |
A reviewer rejected it. |
cancelled |
The action ended before a proposal was ready. |
When state is awaiting_approval, data.result has kind: "optimization" and these fields:
| Field | Meaning |
|---|---|
target_url |
The page the change is for. |
diff |
The proposed change as text, up to 10,000 characters. |
artifact_sha256 |
A 64-character hash of exactly that proposal. You send it back to approve. |
verification_findings |
Checks to run once the change is live. Each has code, severity, url, evidence, recommendation and verification. Long lists are paged with meta.next_cursor. |
approval_id, approval_expires_at |
Set after an approval. Null before. |
artifact_download_url |
null while the action is awaiting_approval. If exports are enabled, a currently approved artifact may have a short-lived download URL. |
Show diff to your reviewer. Do not approve from your own code without a person looking at it.
4. Record a decision
Approve with the hash you showed the reviewer, the revision you read, and a reason. Set EXPECTED_REVISION to data.revision from the awaiting_approval response in step 3.
Before recording a decision, run DECISION_KEY=$(uuidgen) once and save the key for this operation. Retry with the saved key and the same request body. Generate a new key for each new operation.
curl --fail-with-body -X PATCH "$AEO_API_BASE_URL/v2/recommendations" \
-H "Authorization: Bearer $AEO_API_KEY" \
-H "Idempotency-Key: ${DECISION_KEY:?Set DECISION_KEY before sending}" \
-H "Content-Type: application/json" \
-d '{
"section": "decide",
"action_id": "'"$ACTION_ID"'",
"decision": "approve",
"artifact_sha256": "'"$ARTIFACT_SHA256"'",
"expected_revision": '"$EXPECTED_REVISION"',
"reason": "Checked the diff against the page owner."
}'To reject, keep section: "decide" and the complete action_id. Set decision to reject, include expected_revision and reason, and omit artifact_sha256.
What can go wrong, and what to do:
| Status | Cause | What to do |
|---|---|---|
| 412 | expected_revision is out of date. |
Read the action again and show the reviewer what changed. |
| 409 | artifact_sha256 does not match the current proposal, or the request sent the same Idempotency-Key with a different body. |
Read the action again, show the new diff, ask again. |
| 403 | The key or the user’s role may not approve. By default the person who requested a change cannot approve it themselves. | Ask a different approver. |
| 422 | A field is missing or out of range, for example an empty reason. |
Fix the request. |
An approval expires. If state becomes stale_approval, ask for a new decision.
5. Track it on a board
Recommendations can also be tracked as tasks. PATCH /v2/recommendations with section: "board" updates up to 100 of them in one call. Each edit needs the item_id, the revision you last read in expected_revision, and a status of new, in_progress, completed, dismissed or archived. It can also set assignee. Set outreach_outcome only on eligible third-party source opportunities. Its values are no_response, declined, accepted, published and other.
Read the item with GET /v2/recommendations?view=board and brand_id. The board read requires analytics:read and recommendations:read. Find the item in data.items and set ITEM_ID to its item_id and BOARD_REVISION to its revision. If you selected a report_id or month, send the same selection in the PATCH body.
To keep the assignee while changing status, set BOARD_ASSIGNEE_JSON to the current assignee as JSON, including the quotes for a string. Use the JSON literal null for an unassigned item. Omitting assignee clears an existing assignment.
curl --fail-with-body -X PATCH "$AEO_API_BASE_URL/v2/recommendations" \
-H "Authorization: Bearer $AEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"brand_id": "'"$BRAND_ID"'",
"section": "board",
"edits": [
{
"item_id": "'"$ITEM_ID"'",
"expected_revision": '"${BOARD_REVISION:?Set BOARD_REVISION from the board item}"',
"assignee": '"${BOARD_ASSIGNEE_JSON:?Set BOARD_ASSIGNEE_JSON from the board item}"',
"status": "in_progress"
}
]
}'This needs the brands:write, analytics:read and recommendations:read scopes and an editor, owner or service role. It is available on both plans.
Written content drafts
For long-form content, the API has a separate review flow on /v2/brands/{brand_id}/drafts. A draft moves through these statuses: draft, in_review, changes_requested, approved, handed_off, publication_failed, published, archived.
| Step | Operation |
|---|---|
| Create a draft from a recommendation | PUT /v2/brands/{brand_id}/drafts/{draft_id} |
Edit it (send expected_revision) |
PATCH /v2/brands/{brand_id}/drafts/{draft_id} |
Move it (send expected_revision) |
PATCH /v2/brands/{brand_id}/drafts/{draft_id} with transition submit, request_changes (with a note, up to 500 characters) or approve (with content_sha256) |
| Read the history | GET /v2/brands/{brand_id}?view=content_events, each event with sequence, type, status, actor_id and created_at |
Edits and transitions require expected_revision to guard against changes made since you read the draft. Create and edit need an editor, owner or service role. Approving needs the approver or owner role. These operations need the Optimizer plan (growth). Check each operation’s scopes in the v2 OpenAPI contract.
Next steps
- v2 API reference and the OpenAPI contract for every field.
- Read the results of a change: Brand visibility reporting.