Skip to content

    Recommendations and visibility analyst

    Approve a follow-up action

    Approve a proposed content draft or collection check. An approved check starts in the background.

    PATCH /v2/recommendations

    • Body section is decide.
    • Body action_id starts with analyst_action:.

    Authentication and access

    Authentication
    Bearer API key
    Scopes
    analytics:read
    Roles
    approver, owner
    Plans
    Optimizer, Analyzer
    Credits
    This operation can use credits.
    Billing access
    Required

    Check your account's credit usage for the reporting period.

    • Action kind content_draft. Scopes analytics:read, optimizations:write. Plans Optimizer.
    • FAQ drafts also require this permission. Scope prompts:read.
    • Action kind fresh_check. Scopes analytics:read, collections:write. Plans Optimizer, Analyzer.
    • To approve a fresh check, use an owner key or an approver key that also has the editor or service role.

    Parameters

    Request parameters
    NameWhereTypeRequiredDescription
    Idempotency-KeyheaderstringYes

    Request body

    For a content draft, copy data.draft_fingerprint from the proposal you reviewed and set max_credits to 0. For an organization_jsonld draft, check the organization facts and add "confirm_organization_facts": true.

    {
      "section": "decide",
      "decision": "approve",
      "brand_id": "00000000-0000-4000-8000-000000000001",
      "action_id": "analyst_action:00000000-0000-4000-8000-000000000001",
      "draft_fingerprint": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "max_credits": 0
    }

    For a fresh check, read data.maximum_credits on the proposal. This example accepts a quote of 10 credits. Set max_credits to the cap you accept. The API returns HTTP 409 if the cap is below the quote.

    {
      "section": "decide",
      "decision": "approve",
      "brand_id": "00000000-0000-4000-8000-000000000001",
      "action_id": "analyst_action:00000000-0000-4000-8000-000000000001",
      "max_credits": 10
    }
    Request body fields 1
    NameTypeRequiredDescription
    action_idstringYes
    brand_idstring (uuid)Yes
    confirm_organization_factsbooleanConditionalSet to true after checking the facts in an organization_jsonld draft. Omit it for other approvals.
    decision"approve"Yes
    draft_fingerprintstring | nullConditionalFor a content draft, send the fingerprint from the reviewed proposal. Omit it for a fresh check.
    max_creditsintegerYes
    section"decide"Yes

    Request examples

    Set AEO_API_BASE_URL to https://api.aeoapi.dev and AEO_API_KEY to your server-side API key. Set the other environment variables to the values for your request.

    Save the JSON request body as request.json. Replace sample IDs, revisions and other values with your own.

    curl --fail-with-body -X PATCH "$AEO_API_BASE_URL/v2/recommendations" \
      -H "Authorization: Bearer $AEO_API_KEY" \
      -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
      -H "Content-Type: application/json" \
      --data-binary @request.json
    import json
    from pathlib import Path
    from os import environ
    from aeo_sdk import AeoClient
    
    body = json.loads(Path("request.json").read_text())
    
    with AeoClient(environ["AEO_API_KEY"], base_url=environ["AEO_API_BASE_URL"]) as client:
        response = client.v2_patch_recommendations(
            body=body,
            idempotency_key=environ["IDEMPOTENCY_KEY"],
        )
        print(response.body)
    import { AeoClient } from "@aeoapi/aeo-sdk";
    import { readFile } from "node:fs/promises";
    
    const client = new AeoClient(process.env.AEO_API_KEY!, {
      baseUrl: process.env.AEO_API_BASE_URL!,
    });
    const body = JSON.parse(await readFile("request.json", "utf8"));
    const response = await client.v2PatchRecommendations(
      body,
      {
        idempotencyKey: process.env.IDEMPOTENCY_KEY!,
      },
    );
    console.log(response.body);

    Responses

    HTTP 200

    Draft approved

    application/json

    Response fields are listed below.

    HTTP 200 response fields 1
    NameTypeRequiredDescription
    dataobjectYesThe requested result. See the fields below for its contents.
    data.action_idstringYes
    data.analyst_run_idstringYes
    data.approved_atstringYes
    data.approved_bystringYes
    data.approved_max_credits0Yes
    data.brand_idstringYesIdentifies the brand this result belongs to.
    data.draftobjectYes
    data.draft_fingerprintstringYes
    data.estimated_credits0YesThe expected credit cost for this selection.
    data.finding_idstringYes
    data.kind"content_draft"Yes
    data.maximum_credits0YesThe upper credit estimate for this selection.
    data.organization_facts_status"partner_confirmed" | nullYes
    data.passage_idstring | nullYes
    data.proposed_atstringYes
    data.proposed_bystringYes
    data.quotenullYes
    data.runnullYes
    data.run_idnullYesApproving a draft does not start a run.
    data.status"approved"Yes
    data.v2_action_idstringNo
    metaobjectYesInformation about this response, including any warnings or pagination details.

    HTTP 202

    Fresh check accepted

    application/json

    Response fields are listed below.

    HTTP 202 response fields 1
    NameTypeRequiredDescription
    dataobjectYesThe requested result. See the fields below for its contents.
    data.action_idstringYes
    data.analyst_run_idstringYes
    data.approved_atstringYes
    data.approved_bystringYes
    data.approved_max_creditsintegerYes
    data.brand_idstringYesIdentifies the brand this result belongs to.
    data.draftnullYes
    data.draft_fingerprintnullYes
    data.estimated_creditsintegerYesThe expected credit cost for this selection.
    data.finding_idstringYes
    data.kind"fresh_check"Yes
    data.maximum_creditsintegerYesThe upper credit estimate for this selection.
    data.organization_facts_statusnullYes
    data.passage_idnullYes
    data.proposed_atstringYes
    data.proposed_bystringYes
    data.quoteobjectYes
    data.runobjectYes
    data.run.brand_idstringYes
    data.run.charged_creditsintegerYes
    data.run.check_idstring | nullYes
    data.run.check_urlstring | nullYes
    data.run.citation_status"in_progress" | "completed"NoCitation preparation status for this run, when applicable.
    data.run.created_atstringYes
    data.run.estimated_creditsintegerYes
    data.run.failure_reasonsarray of "access_restricted" | "limit_reached" | "input_missing" | "approval_expired" | "cancelled" | "check_failed" | "check_incomplete"Yes
    data.run.hold_reasonsarray of "retry_pending" | "under_review"Yes
    data.run.phasestring | nullYes
    data.run.progressobjectYes
    data.run.progress.by_locationarray of objectNo
    data.run.progress.by_location[].by_sourcearray of objectConditional
    data.run.progress.by_location[].completed_stepsintegerConditional
    data.run.progress.by_location[].expected_stepsintegerConditional
    data.run.progress.by_location[].location_idstring (uuid)Conditional
    data.run.progress.by_sourcearray of objectYes
    data.run.progress.completed_stepsintegerYes
    data.run.progress.expected_stepsintegerYes
    data.run.prompt_set_revisionstringYes
    data.run.released_creditsintegerYes
    data.run.report_idstring | nullYes
    data.run.report_status"pending" | "ready" | "not_available"Yes
    data.run.report_urlstring | nullYes
    data.run.reserved_creditsintegerYes
    data.run.run_idstringYes
    data.run.statusstringYes
    data.run.updated_atstringYes
    data.run.websitestring | nullYes
    data.run_idstringYesIdentifies the run. Keep any prefix when using it in a request.
    data.status"approved"Yes
    data.v2_action_idstringNo
    metaobjectYesInformation about this response, including any warnings or pagination details.

    Errors

    Read code and message in the error response. Keep request_id when you contact support.

    Recommendations and visibility analyst reference