Skip to content

    Import and search a brand page

    Import page text when your application needs to quote a brand’s own documentation. For example, a service team can look up a shipping policy and open the page that supports its answer.

    Before you start

    Use an Analyzer or Optimizer editor, owner or service key with brands:write and analytics:read in AEO_API_KEY. Set BRAND_ID to the brand’s ID and CONTENT_ID to a UUID you generated for this document. You need the actual page text, its URL on a registered brand domain and permission to use that text.

    1. Save the source text

    In the example below, replace the URL, text and rights reference with your own. Set RIGHTS_EXPIRE_AT to the UTC date-time when your permission expires.

    curl --fail-with-body -X PUT \
      "https://api.aeoapi.dev/v2/brands/$BRAND_ID/evidence/passage_document/$CONTENT_ID" \
      -H "Authorization: Bearer $AEO_API_KEY" \
      -H 'Content-Type: application/json' \
      --data-binary @- <<JSON
    {
      "url": "https://example.com/shipping",
      "text": "Standard shipping takes three working days.",
      "rights_basis": "customer_owned",
      "rights_reference": "shipping-policy-approval",
      "rights_expire_at": "$RIGHTS_EXPIRE_AT"
    }
    JSON

    Save data.content_id and data.revision. The entries in data.chunks identify each passage and its start and end positions in the supplied text.

    2. Search for a passage

    curl --fail-with-body 'https://api.aeoapi.dev/v2/passages/search' \
      -H "Authorization: Bearer $AEO_API_KEY" \
      -H 'Content-Type: application/json' \
      --data-binary @- <<JSON
    {"brand_id":"$BRAND_ID","query":"standard shipping","limit":5}
    JSON

    Read the matching text and url in each row of data. To quote the page you uploaded, choose a row whose content_id and revision match the values you saved in step 1. An empty list means the search found no matching text your key can read.

    3. Keep quotes tied to the reviewed page

    When the policy changes, send the updated document to the same URL as in step 1. Include expected_revision with the last revision you received. Save the new revision with the new text. A conflict means another write changed the document. Review the latest version before replacing it. For a draft that draws on those sources, review the draft before publishing.