# Create Lead — Agiliron

> Establishes a new lead within Agiliron. See the documentation

- Key: `agiliron-create-lead`
- Type: Action (Write)
- Version: 0.0.2
- App: Agiliron (`agiliron`) — https://pipedream.com/apps/agiliron.md
- This page (HTML): https://pipedream.com/apps/agiliron/actions/create-lead
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/agiliron/actions/create-lead/create-lead.mjs

## Description

Establishes a new lead within Agiliron. [See the documentation](https://api.agiliron.com/docs/add-lead-1)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `lastname` | `string` | Yes | The last name of the lead. |
| `company` | `string` | Yes | The company of the lead |
| `salutation` | `string` | No | The salutation of the lead |
| `firstName` | `string` | No | The first name of the lead |
| `designation` | `string` | No | The designation of the lead |
| `phone` | `string` | No | The phone number of the lead |
| `mobile` | `string` | No | The mobile number of the lead |
| `fax` | `string` | No | The fax number of the lead |
| `email` | `string` | No | The email address of the lead |
| `website` | `string` | No | The website of the lead. Without http:// or https:// |
| `industry` | `string` | No | The industry of the lead |
| `sicCode` | `string` | No | The SIC code of the lead |
| `annualRevenue` | `string` | No | The annual revenue of the lead. (US Dollar : $) |
| `numberOfEmployees` | `string` | No | The number of employees of the lead |
| `contactType` | `string` | No | The contact type of the lead |
| `leadSource` | `string` | No | The lead source of the lead |
| `leadStatus` | `string` | No | The lead status of the lead |
| `rating` | `string` | No | The rating of the lead |
| `emailOptOut` | `string` | No | The email opt-out status of the lead |
| `yahooId` | `string` | No | The Yahoo ID of the lead |
| `street` | `string` | No | The street address of the lead |
| `city` | `string` | No | The city of the lead |
| `state` | `string` | No | The state of the lead |
| `zip` | `string` | No | The zip code of the lead |
| `country` | `string` | No | The country of the lead |
| `description` | `string` | No | The description of the lead |
| `assignedTo` | `string` | No | The user to whom the lead is assigned |
| `assignedGroupName` | `string` | No | The group to which the contact or lead is assigned |
| `customFields` | `object` | No | An object of custom fields for the lead. Format: {customFieldName01: "Value 01"} |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "agiliron",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "agiliron-create-lead",
  arguments: {
    lastname: "Last Name",
    company: "Company",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "agiliron-create-lead",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    agiliron: { authProvisionId: "apn_xxxxxxx" },
    lastname: "Last Name",
    company: "Company",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "agiliron-create-lead",
    "configured_props": {
      "agiliron": { "authProvisionId": "apn_xxxxxxx" },
      "lastname": "Last Name",
      "company": "Company"
    }
  }'
```

---

- App: https://pipedream.com/apps/agiliron.md · All apps: https://pipedream.com/apps
