# Create Lead — Close

> Creates a lead. See the documentation

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

## Description

Creates a lead. [See the documentation](https://developer.close.com/resources/leads/#create-a-new-lead)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | Yes | Name of the lead |
| `url` | `string` | No | Url |
| `description` | `string` | No | Description of the lead |
| `statusId` | `string` | No | Lead Statuses represent a Lead's current relationship to your company. See the docs Options are loaded from the connected account. |
| `contacts` | `string[]` | No | Please provide an object structure for each row. e.g.:, { "name": "Gob", "title": "Sr. Vice President", "emails": [ { "type": "office", "email": "gob@example.com" } ], "phones": [ { "type": "office", "phone": "8004445555" } ] } |
| `addresses` | `string[]` | No | Please provide an object structure for each row. e.g.:, { "label": "business", "address_1": "747 Howard St", "address_2": "Room 3", "city": "San Francisco", "state": "CA", "zipcode": "94103", "country":"US", } |
| `moreFields` | `object` | No | Additional properties not listed as props |

## 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": "close",
      },
    },
  },
)

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: "close-create-lead",
  arguments: {
    name: "Name",
    url: "Url",
  },
})
```

**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: "close-create-lead",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    close: { authProvisionId: "apn_xxxxxxx" },
    name: "Name",
    url: "Url",
  },
})

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": "close-create-lead",
    "configured_props": {
      "close": { "authProvisionId": "apn_xxxxxxx" },
      "name": "Name",
      "url": "Url"
    }
  }'
```

---

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