AdlyseAdlyseMCP Docs
⌘K
Overview
adlyse-insights
list_ad_accountsget_dashboard_snapshotget_impact_analysislist_guidelinesget_guideline
adlyse-reports
list_report_templateslist_reportsget_reportgenerate_reportlist_report_targets
adlyse-ads
list_campaignsget_performancelist_adsget_ad_performancelist_change_eventsupdate_campaign_statusupdate_campaign_budget
adlyse-workflows
list_workflowsget_workflowrun_workflowget_run_status
  1. Overview/
  2. adlyse-reports

generate_report

Trigger generation of a report. Generation is asynchronous — poll with get_report until status is "ready" or "failed".

The created report is tagged created_via="ai" to distinguish it from UI-initiated ("human") and scheduled ("scheduled") reports.

Parameters#

NameTypeRequiredDefaultDescription
template_keystringyesTemplate key from list_report_templates
ad_account_idsstring[]yes1–10 ad account ids; must belong to your org
period_startstringyesYYYY-MM-DD, inclusive
period_endstringyesYYYY-MM-DD, inclusive; ≥ period_start, ≤ 31 days span
titlestring?noautoDefaults to "{template name} ({period_start} – {period_end})"; max 200 chars
sectionsstring[]?nonullOverride the template’s default section list; must be a subset of registry keys
template_versioninteger?nolatestPin to a specific template version; defaults to the active version

Returns#

json
{
  "report_id": "ad_rpt_abc",
  "status": "pending",
  "title": "Weekly Check-In (2026-04-15 – 2026-04-21)",
  "template": { "key": "weekly_check_in", "version": 1, "name": "Weekly Check-In" },
  "period_start": "2026-04-15",
  "period_end": "2026-04-21",
  "ad_account_ids": ["ad_acct_abc"],
  "poll_with": "get_report(report_id)",
  "source": "adlyse.reports@v1"
}

Errors#

error_typeWhen
auth_errorMissing / invalid API key
not_foundTemplate key unknown; or any ad_account_id not in your org
validation_errorEmpty ad_account_ids, bad date format, period_end < period_start, period > 31 days

Example#

Request:

json
{
  "template_key": "weekly_check_in",
  "ad_account_ids": ["ad_acct_abc"],
  "period_start": "2026-04-15",
  "period_end": "2026-04-21"
}

Response:

json
{
  "report_id": "ad_rpt_xyz",
  "status": "pending",
  "title": "Weekly Check-In (2026-04-15 – 2026-04-21)",
  "template": { "key": "weekly_check_in", "version": 1, "name": "Weekly Check-In" },
  "period_start": "2026-04-15",
  "period_end": "2026-04-21",
  "ad_account_ids": ["ad_acct_abc"],
  "poll_with": "get_report(report_id)",
  "source": "adlyse.reports@v1"
}

Then poll get_report with report_id=ad_rpt_xyz until status="ready".

Notes#

  • Idempotency: Adlyse hashes (org, user, period, template_version, params) into an idempotency key on the underlying row. Repeated identical calls within a short window deduplicate.
  • Approval lane: if the template requires review, the status path is pending → rendering → pending_review → approved/rejected → ready. The initial generate_report response is the same; poll for the final state.

See also#

  • list_report_templates — discover available template keys
  • get_report — poll for completion and fetch PDF
←Previous
get_report
Next→
list_report_targets