# Create Or Update Company — Cloze

> Create a new company or enhance an existing company within Cloze. Companies can be created with just a domain name or both a name and another unique identifier such as a phone number and email address. See the documentation.

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

## Description

Create a new company or enhance an existing company within Cloze. Companies can be created with just a domain name or both a name and another unique identifier such as a phone number and email address. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | No | The name of the company. |
| `emails` | `string[]` | No | The emails of the company. Each email should be a JSON object with value key. See the documentation. |
| `phones` | `string[]` | No | The phones of the company. Each phone should be a JSON object with value key. See the documentation. |
| `domains` | `string[]` | No | The domains of the company. |
| `segment` | `string` | No | The segment of the company. |
| `step` | `string` | No | Unique Id of Next Step |
| `stage` | `string` | No | The stage of the company. |
| `assignTo` | `string` | No | Assign this company to this team member. |
| `additionalData` | `object` | No | Additional details for the company in JSON format. See the documentation. |

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

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: "cloze-create-update-company",
  arguments: {
    name: "Company Name",
    emails: ["Emails"],
  },
})
```

**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: "cloze-create-update-company",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    cloze: { authProvisionId: "apn_xxxxxxx" },
    name: "Company Name",
    emails: ["Emails"],
  },
})

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": "cloze-create-update-company",
    "configured_props": {
      "cloze": { "authProvisionId": "apn_xxxxxxx" },
      "name": "Company Name",
      "emails": ["Emails"]
    }
  }'
```

---

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