---
title: "Receive managed report webhooks | AEO API"
description: "Register an HTTPS receiver, verify report event signatures and open the monthly report when it is ready."
url: "https://aeoapi.dev/docs/guides/report-webhooks"
canonical: "https://aeoapi.dev/docs/guides/report-webhooks"
last_updated: "2026-11-30"
---

# Receive managed report webhooks

A brand webhook can notify your application when a managed report completes or fails. Register a receiver for the brand whose reports you deliver.

## Before you start

Prepare a public HTTPS receiver on port 443 or 8443. Set `BRAND_ID` to an active brand. Use an owner key with `brands:write` to configure the receiver and `brands:read` to check it afterward. The example loads this key from `AEO_API_KEY`. Keep the receiver’s signing secret separate from the API key.

## 1. Register the receiver

Replace the example URL with the full URL of your receiver. Handle the response in a private terminal or your server’s secret store.

```
curl --fail-with-body -X PATCH "https://api.aeoapi.dev/v2/brands/$BRAND_ID" \
  -H "Authorization: Bearer $AEO_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"section":"connection","provider":"webhook","url":"https://example.com/report-events","event_types":["aeo.report.completed","aeo.report.failed"]}'
```

Save `data.signing_secret` securely for your receiver. A later configuration read shows the state and event types and hides the URL path.

## 2. Check the signature before reading the event

Pass the raw request bytes and your framework’s case-insensitive header mapping to `valid_signature`. The example accepts delivery timestamps within five minutes of the receiver’s clock in either direction. If it returns `False`, reject the request before parsing the JSON or processing the event.

```
import hashlib
import hmac
import re
import time

def valid_signature(body, headers, signing_secret):
    timestamp = headers.get("Aeo-Timestamp", "")
    signature = headers.get("Aeo-Signature", "")
    if not re.fullmatch(r"[1-9][0-9]{0,11}", timestamp):
        return False
    if not re.fullmatch(r"sha256=[0-9a-f]{64}", signature):
        return False
    if abs(int(time.time()) - int(timestamp)) > 300:
        return False

    digest = hmac.new(
        signing_secret.encode(), timestamp.encode("ascii") + b"." + body, hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest("sha256=" + digest, signature)
```

After verification, parse the JSON and record the signed body’s `id` under a unique constraint. Queue the notification in the same transaction only if the ID is new. Return a successful HTTP status once the transaction commits, including for a repeat delivery.

## 3. Confirm the subscription and handle the report

```
curl --fail-with-body --get "https://api.aeoapi.dev/v2/brands/$BRAND_ID" \
  -H "Authorization: Bearer $AEO_API_KEY" \
  --data-urlencode 'view=connection' \
  --data-urlencode 'provider=webhook'
```

Check `data.state` for `configured`. On `aeo.report.completed`, inspect the event’s `status`, `report_status` and `report_id`. A partially completed run can also send this event. When a report ID is present, use it to [read and share the report](https://aeoapi.dev/docs/guides/brand-visibility-reporting). For `aeo.report.failed`, retain `run_id` and `failure_reason` for investigation.
