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

# Add Workflow Leads

> Use the add_workflow_leads MCP tool on the DialNexa remote MCP server.

<span data-api-safety-label="billable"><Badge color="yellow" size="sm" shape="pill">Billable - retry unsafe</Badge></span>

Adds leads to a workflow from a small CSV or Excel file — the same upload the dashboard and the REST API accept. This is NOT a read-only action. If the workflow is ACTIVE the new leads start progressing immediately, which can mean real calls and real cost; on a draft or paused workflow they wait. Leads file, in this order of preference: the host-attached `file` when the user attached one in the chat; otherwise create\_upload\_url (kind workflow\_leads) and pass the upload\_id here, for any real file of any size; file\_text only for a few rows the user typed into the conversation (CSV, header row first, a phone\_number column plus any variable columns). Use get\_workflow\_lead\_variable\_keys to see which columns existing leads carry so new rows match.

## Parameters

| Name          | Type     | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `workflow_id` | `string` | Yes      | The workflow ID, e.g. workflow\_abc123                                                                                                                                                                                                                                                                                                                                                                                  |
| `file_name`   | `string` | No       | File name with extension, e.g. leads.csv or leads.xlsx. Required with file\_text/file\_base64; taken from the upload otherwise.                                                                                                                                                                                                                                                                                         |
| `file_text`   | `string` | No       | Only for rows the user TYPED into the conversation, or a small CSV/text file (under \~50 KB) you were given as a path and can read. Plain text, header row first. Not for a file the user attached in the chat: pass that as `file`.                                                                                                                                                                                    |
| `file_base64` | `string` | No       | Only for a small .xlsx (under \~50 KB) given to you as a path on disk. NEVER base64-encode a file the user attached in the chat (pass it as `file`) and never encode anything larger (use create\_upload\_url).                                                                                                                                                                                                         |
| `upload_id`   | `string` | No       | Only for a file on a disk YOU control that is too large for file\_text (over \~50 KB): call create\_upload\_url with reveal\_url: true, PUT the bytes yourself from a machine with open internet access, then pass the upload\_id here. Never for a file the user attached in the chat (pass it as `file`), and never from a hosted chat sandbox such as ChatGPT code interpreter, which cannot reach the storage host. |
| `file`        | `object` | No       | ALWAYS use this when the user attached a file in the chat: pass the attached file here and the host turns it into a download link for the server. Fastest path, any size. NEVER open, convert or base64-encode an attached file yourself.                                                                                                                                                                               |
| `tags`        | `string` | No       | Optional tags applied to every lead in this upload, comma-separated, e.g. "priority,q3-campaign". Normalised to lowercase.                                                                                                                                                                                                                                                                                              |

## Complete input schema

```json theme={null}
{
  "type": "object",
  "properties": {
    "workflow_id": {
      "type": "string",
      "description": "The workflow ID, e.g. workflow_abc123"
    },
    "file_name": {
      "type": "string",
      "description": "File name with extension, e.g. leads.csv or leads.xlsx. Required with file_text/file_base64; taken from the upload otherwise."
    },
    "file_text": {
      "type": "string",
      "description": "Only for rows the user TYPED into the conversation, or a small CSV/text file (under ~50 KB) you were given as a path and can read. Plain text, header row first. Not for a file the user attached in the chat: pass that as `file`."
    },
    "file_base64": {
      "type": "string",
      "description": "Only for a small .xlsx (under ~50 KB) given to you as a path on disk. NEVER base64-encode a file the user attached in the chat (pass it as `file`) and never encode anything larger (use create_upload_url)."
    },
    "upload_id": {
      "type": "string",
      "description": "Only for a file on a disk YOU control that is too large for file_text (over ~50 KB): call create_upload_url with reveal_url: true, PUT the bytes yourself from a machine with open internet access, then pass the upload_id here. Never for a file the user attached in the chat (pass it as `file`), and never from a hosted chat sandbox such as ChatGPT code interpreter, which cannot reach the storage host."
    },
    "file": {
      "type": "object",
      "properties": {
        "file_id": {
          "type": "string",
          "description": "Host-side file id"
        },
        "download_url": {
          "type": "string",
          "description": "Short-lived signed URL the host provides for the attached file"
        },
        "file_name": {
          "type": "string"
        },
        "mime_type": {
          "type": "string"
        },
        "size": {
          "type": "number"
        }
      },
      "required": [
        "file_id",
        "download_url"
      ],
      "additionalProperties": false,
      "description": "ALWAYS use this when the user attached a file in the chat: pass the attached file here and the host turns it into a download link for the server. Fastest path, any size. NEVER open, convert or base64-encode an attached file yourself."
    },
    "tags": {
      "type": "string",
      "description": "Optional tags applied to every lead in this upload, comma-separated, e.g. \"priority,q3-campaign\". Normalised to lowercase."
    }
  },
  "required": [
    "workflow_id"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
```

## Registered output schema

```json theme={null}
{
  "type": "object",
  "properties": {
    "workflow_id": {
      "type": "string",
      "description": "The workflow the leads were added to, prefixed workflow_"
    },
    "leads_added": {
      "type": "number",
      "description": "How many leads were created"
    },
    "file_source": {
      "type": "string",
      "description": "How the file arrived: 'text', 'base64', 'upload' (Azure staging) or 'attachment' (host-provided)"
    },
    "lead_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Created lead ids (prefixed lead_), capped at 50"
    },
    "truncated": {
      "type": "boolean",
      "description": "True when more leads were created than lead_ids lists"
    },
    "errors": {
      "type": "array",
      "description": "Rows that failed validation, with the reason"
    },
    "unused_columns": {
      "type": "array",
      "description": "Columns in the file that were not applied, when any"
    },
    "allowed_columns": {
      "type": "array",
      "description": "Columns the workflow accepts, present when unused_columns is"
    },
    "tags": {
      "type": "array",
      "description": "Tags applied to the upload"
    },
    "note": {
      "type": "string",
      "description": "Whether the leads start progressing now or wait for activation"
    }
  },
  "required": [
    "workflow_id",
    "leads_added",
    "file_source",
    "lead_ids",
    "truncated",
    "errors",
    "tags",
    "note"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
```

## Before you call

* Connect and initialize the MCP client with OAuth or an API key for the intended workspace.
* Provide the required parameters: `workflow_id`.
* Provide one file source: a host attachment, a completed upload\_id, or supported inline content. The optional file fields are alternatives; omitting all of them does not submit a file. See [MCP file uploads](/docs/mcp-tools/quickstart#mcp-file-uploads).
* Confirm the exact target and intended effect with the user before calling.

## Example MCP request

Send `tools/call` after your client completes MCP initialization. Replace placeholder values with IDs and inputs from your workspace. For object and array parameters, follow the nested requirements in the parameter description instead of treating an empty value as complete.

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "add_workflow_leads",
    "arguments": {
      "workflow_id": "workflow_abc123",
      "upload_id": "COMPLETED_UPLOAD_ID"
    }
  }
}
```

Successful results include `structuredContent` and a text content block containing the same JSON. Check `isError` first, then read `structuredContent` or parse `content[0].text`. See [MCP responses and errors](/docs/mcp-tools/errors) for the full envelope and failure behavior.

## Verify the result

Store the returned resource ID and confirm the response is not marked `isError`. Call [Get Workflow Lead Variable Keys](/docs/mcp-tools/workflows/get-workflow-lead-variable-keys) to read the affected resource. Verify the call, batch, or purchase state before retrying.

## Retry safety

This tool can spend wallet balance or start real calls. After a timeout, inspect the relevant resource before retrying so you do not duplicate the action.

## Related MCP tools

* [Create Upload URL](/docs/mcp-tools/uploads/create-upload-url): `create_upload_url`
* [Get Workflow Lead Variable Keys](/docs/mcp-tools/workflows/get-workflow-lead-variable-keys): `get_workflow_lead_variable_keys`
* [List Workflows](/docs/mcp-tools/workflows/list-workflows): `list_workflows`
* [Get Workflow](/docs/mcp-tools/workflows/get-workflow): `get_workflow`

## Related guides

* [Connect to the DialNexa MCP server](/docs/mcp-tools/overview)
* [Workflows MCP tools](/docs/mcp-tools/workflows/overview)
* [MCP responses and errors](/docs/mcp-tools/errors)
