meta_ads_leads_export_csv
Export Meta Ads lead form leads to a local CSV file with stable column order and row count returned. Avoid PII in logs and export regularly since Meta retains data for only 90 days.
Instructions
Fetches all leads for a lead form and writes them to a local CSV file. Returns the number of rows written. Header row is ["id", "created_time", *question_keys]; question_keys come from the form's declared questions (in declared order) so column order stays stable across exports. Pass field_order to lock a different column order (useful for stable CRM-import schemas). PII never appears in mureo's log output — only the row count. Read-only with respect to Meta, but writes locally. Meta retains lead data for 90 days; export regularly.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max leads per API call. Default 1000, Meta's per-call ceiling. | |
| form_id | Yes | Lead form ID whose leads to export. | |
| account_id | No | Meta Ads account ID in the format 'act_XXXXXXXXXX' (e.g. 'act_1234567890'). Optional — falls back to META_ADS_ACCOUNT_ID from the configured credentials. The leading 'act_' prefix is required. | |
| field_order | No | Optional list of question keys to lock the column order. Overrides the form's declared question order. | |
| output_path | Yes | Absolute local path for the CSV file. Parent directory is auto-created if missing; existing file is overwritten. UTF-8 encoded. |