meta_ads_leads_export_csv
Export Meta Ads lead form leads to a local CSV file. Maintains stable column order and excludes PII from logs for privacy.
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 |
|---|---|---|---|
| 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. | |
| form_id | Yes | Lead form ID whose leads to export. | |
| output_path | Yes | Absolute local path for the CSV file. Parent directory is auto-created if missing; existing file is overwritten. UTF-8 encoded. | |
| limit | No | Max leads per API call. Default 1000, Meta's per-call ceiling. | |
| field_order | No | Optional list of question keys to lock the column order. Overrides the form's declared question order. |