Export leads to a destination
export_leadsPush leads into a connected destination: 'close' (CRM — uses the account's saved field mapping), 'ghl' (GoHighLevel sub-account), 'google_sheets' (new spreadsheet, or pass spreadsheet_id for one LeadMarina created before), or a file — 'csv' | 'xlsx' | 'json' (emailed to the account owner + download link). Exports EITHER one search's leads (pass search_id) or the whole library (set all=true, optionally narrowed with the same filters as query_leads). LIMITS PER CALL, which differ by destination because CRMs take one API call per lead: csv/xlsx 50,000 · json 25,000 · google_sheets 5,000 · close/ghl 1,000. For a big library going to a CRM, export csv and import the file instead. If more leads match than the limit, the response sets truncated=true — relay that to the user, the export was partial. Previously exported leads are UPDATED in place (matched by Google CID) — never duplicated; the user's own CRM notes/columns are never touched.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| all | No | Export the whole library instead of one search. | |
| filters | No | With all=true: narrow the library using query_leads-style filter rows. | |
| search_id | No | Export this search's leads. | |
| destination | Yes | Where the leads go. | |
| spreadsheet_id | No | google_sheets only: add to this existing LeadMarina-created sheet instead of a new one. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | File exports only: the file name. | |
| note | No | ||
| limit | No | The per-call limit that applied, when truncated. | |
| outcome | Yes | Human-readable result, e.g. added/updated counts. | |
| warning | No | Present when truncated: what happened and how to get the rest. | |
| exported | Yes | Leads sent to the destination. | |
| truncated | No | True when more leads matched than this destination's limit — the export was PARTIAL. | |
| download_url | No | File exports only: 7-day download link. |