# Create Customer — Orderspace

> Create a new customer. See the documentation

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

## Description

Create a new customer. [See the documentation](https://apidocs.orderspace.com/#create-a-customer)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `companyName` | `string` | Yes | The name of the customer's company |
| `contactName` | `string` | Yes | The contact name for the customer |
| `email` | `string` | Yes | The email address of the customer |
| `addressLine1` | `string` | Yes | The first line of the customer's address |
| `addressLine2` | `string` | No | The second line of the customer's address |
| `city` | `string` | Yes | The city of the customer's address |
| `state` | `string` | Yes | The state of the customer's address |
| `postalCode` | `string` | Yes | The postal code of the customer's address |
| `country` | `string` | Yes | The 2 letter country code of the customer's address |
| `phone` | `string` | No | The phone number of the customer |
| `reference` | `string` | No | Your reference for the customer |
| `internalNote` | `string` | No | An internal note for the customer |
| `taxNumber` | `string` | No | The sales tax number of the customer |
| `minimumSpend` | `string` | No | The minimum spend per order for the customer |
| `paymentTermId` | `string` | No | The ID of a payment term Options are loaded from the connected account. |
| `customerGroupId` | `string` | No | The ID of a customer group Options are loaded from the connected account. |
| `priceListId` | `string` | No | The ID of a price list Options are loaded from the connected account. |

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

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: "orderspace-create-customer",
  arguments: {
    companyName: "Company Name",
    contactName: "Contact Name",
  },
})
```

**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: "orderspace-create-customer",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    orderspace: { authProvisionId: "apn_xxxxxxx" },
    companyName: "Company Name",
    contactName: "Contact Name",
  },
})

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": "orderspace-create-customer",
    "configured_props": {
      "orderspace": { "authProvisionId": "apn_xxxxxxx" },
      "companyName": "Company Name",
      "contactName": "Contact Name"
    }
  }'
```

---

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