> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markifact.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve Leads

> Retrieve leads submitted through LinkedIn lead gen forms for an ad account, flattened to one row per lead with a column per form field

Retrieve leads submitted through LinkedIn lead gen forms for an ad account, flattened to one row per lead with a column per form field. Requires the connection to have LinkedIn's Lead Sync permission (r\_marketing\_leadgen\_automation).

|                     |                               |
| ------------------- | ----------------------------- |
| **App**             | LinkedIn Ads                  |
| **Operation ID**    | `linkedin_ads_retrieve_leads` |
| **Type**            | Action                        |
| **Connection**      | `linkedin_ads` (required)     |
| **Credits per run** | 1                             |

## Inputs

| Field                | Type                 | Required | Default | Description                                                                                                                                                                  |
| -------------------- | -------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account`            | DynamicAccount       | Yes      | -       | LinkedIn Ads account to retrieve leads from.                                                                                                                                 |
| `lead_form`          | string or SelectItem | No       | -       | Optional lead form ID to filter by. Leave empty to retrieve leads from all forms in the account. Use linkedin\_ads\_list\_lead\_forms to find form IDs.                      |
| `date_range`         | DateRange            | No       | -       | Optional submitted-at date range filter. Supports custom date ranges and presets. Note that LinkedIn retains lead data for a limited time, so older leads are not available. |
| `include_test_leads` | boolean              | No       | `False` | If true, include test leads submitted through Campaign Manager's form testing tools. Defaults to false.                                                                      |
| `limit`              | integer              | No       | -       | Maximum number of leads to return. Leave empty to retrieve all available leads.                                                                                              |

### DateRange

| Field     | Type           | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --------- | -------------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `start`   | string         | No       | -       | The start date of the date range to query, format: YYYY-MM-DD or dynamic node reference like \{\{nodeId\_\_data.start\_date}}. Required when preset is 'FIXED' or 'CUSTOM'.                                                                                                                                                                                                                                                                                                   |
| `end`     | string         | No       | -       | The end date of the date range to query, format: YYYY-MM-DD or dynamic node reference like \{\{nodeId\_\_data.end\_date}}. Required when preset is 'FIXED' or 'CUSTOM'.                                                                                                                                                                                                                                                                                                       |
| `preset`  | string         | No       | -       | Predefined date ranges or input modes: - Use 'FIXED' or leave empty when you want to specify exact dates (YYYY-MM-DD format) in start/end fields - Use 'CUSTOM' when you want to use dynamic values from other nodes (\{\{nodeId\_\_data.start\_date}} format) in start/end fields - Use other presets (TODAY, YESTERDAY, LAST\_7\_DAYS, etc.) for predefined date ranges (start/end will be ignored) When using 'FIXED' or 'CUSTOM', both start and end fields are required. |
| `compare` | CompareOptions | No       | -       | Optional comparison date range settings. ALWAYS use this field for comparisons; DO NOT create additional requests or nodes, as the backend returns current, comparison, and delta metrics in a single call.                                                                                                                                                                                                                                                                   |

### SelectItem

| Field   | Type   | Required | Default | Description                                                                                          |
| ------- | ------ | -------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `value` | string | Yes      | -       | The value of the selectable item.                                                                    |
| `label` | string | Yes      | -       | The label of the selectable item, used for display purposes. If not provided, defaults to the value. |

### CompareOptions

| Field                   | Type   | Required | Default      | Description                                                                                                                                                                                                                                               |
| ----------------------- | ------ | -------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `start`                 | string | No       | -            | The start date of the comparison range, format: YYYY-MM-DD. Optional if preset is provided.                                                                                                                                                               |
| `end`                   | string | No       | -            | The end date of the comparison range, format: YYYY-MM-DD. Optional if preset is provided.                                                                                                                                                                 |
| `preset`                | string | No       | -            | Predefined comparison ranges. When provided, start and end will be ignored.                                                                                                                                                                               |
| `comparison_format`     | string | No       | `rows`       | Comparison output layout: 'rows' returns separate rows for current, comparison, and delta along with date ranges; 'columns' returns a single row with delta values only as additional \*\_pct or \*\_change columns depending on comparison\_value\_type. |
| `comparison_value_type` | string | No       | `percentage` | Value type: 'percentage' or 'absolute'                                                                                                                                                                                                                    |

## Output

**Type**: `List[Dict]`

Returns one flat row per lead: the fixed columns above plus one dynamic column per form question (named after the question, e.g. email, first\_name) and consent checkbox.

**Fields**: `lead_id`, `form_id`, `form_name`, `adset_id`, `adset_name`, `creative_id`, `is_test_lead`, `submitted_at`
