# export_leads_csv (/docs/mcp/tools/export-leads-csv)

{/* Generated by scripts/sync-mcp-tools.mjs from happierleads-api. Do not edit: change src/routes/mcp/toolDocs.json there, or add content/mcp-notes/export_leads_csv.mdx. */}

**Export leads to CSV** · Changes data · Acts outside your account

Queue a CSV export of a website's leads whose last visit falls in the date range. The file is built in the background: the user gets an email with the download link and it is listed under Downloads in the dashboard for 30 days; this tool does not return the file itself. Each finished export uses one of the plan's CSV downloads; it fails when the plan has no CSV downloads or none are left. websiteId from list_websites. For leads you want to read in the conversation, use get_leads. Returns status 'queued' and job (id, status, stage, progress, rowCount, fileName, expiresAt).

| Connection | Account URL, team member URL or OAuth |
| --- | --- |

## Parameters [#parameters]

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `websiteId` | `string` | Yes | Website id (24 hex characters) from list_websites. |
| `dateFrom` | `string` | Yes | Start of the range (last visit date). Accepts YYYY-MM-DD, MM/DD/YYYY, ISO 8601 or epoch milliseconds. |
| `dateTo` | `string` | Yes | End of the range, inclusive. Same formats as dateFrom. |

## Tool definition [#tool-definition]

What your assistant receives from `tools/list`:

```json
{
  "name": "export_leads_csv",
  "title": "Export leads to CSV",
  "annotations": {
    "title": "Export leads to CSV",
    "readOnlyHint": false,
    "destructiveHint": false,
    "idempotentHint": false,
    "openWorldHint": true
  },
  "inputSchema": {
    "type": "object",
    "properties": {
      "websiteId": {
        "type": "string",
        "description": "Website id (24 hex characters) from list_websites."
      },
      "dateFrom": {
        "type": "string",
        "description": "Start of the range (last visit date). Accepts YYYY-MM-DD, MM/DD/YYYY, ISO 8601 or epoch milliseconds."
      },
      "dateTo": {
        "type": "string",
        "description": "End of the range, inclusive. Same formats as dateFrom."
      }
    },
    "required": [
      "websiteId",
      "dateFrom",
      "dateTo"
    ]
  }
}
```
