# Create Order — Printful

> Creates a new order in your Printful account. See the documentation

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

## Description

Creates a new order in your Printful account. [See the documentation](https://developers.printful.com/docs/#operation/createOrder)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `storeId` | `string` | Yes | Select a store or provide s store ID to use for the request Options are loaded from the connected account. |
| `externalId` | `string` | No | Order ID from the external system |
| `recipientName` | `string` | Yes | The recipient full name |
| `recipientCompanyName` | `string` | No | The recipient company name |
| `address1` | `string` | Yes | The address 1 |
| `address2` | `string` | No | The address 2 |
| `city` | `string` | Yes | The city |
| `stateCode` | `string` | Yes | The state code. E.g. SC |
| `countryCode` | `string` | Yes | The country code. E.g. BR |
| `taxNumber` | `string` | No | TAX number (optional, but in case of Brazil country this field becomes required and will be used as CPF/CNPJ number) |
| `zip` | `string` | Yes | The ZIP/postal code. E.g. 89221525 |
| `phone` | `string` | No | The phone number |
| `email` | `string` | No | The email |
| `giftSubject` | `string` | No | Gift message title |
| `giftMessage` | `string` | No | Gift message text |
| `items` | `string[]` | Yes | Array of items in the order. E.g. [ { "id": 1, "variant_id": 2, "quantity": 3, "price": "13.60", "retail_price": "9.90", "name": "Beauty Poster", "product": { "product_id": 301, "variant_id": 500, "name": "Red T-Shirt" }, "files": [{"url": "https://file.com/060b204a37f.png"}] } ] |

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

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: "printful-create-order",
  arguments: {
    storeId: "Store ID",
    externalId: "External ID",
  },
})
```

**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: "printful-create-order",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    printful: { authProvisionId: "apn_xxxxxxx" },
    storeId: "Store ID",
    externalId: "External ID",
  },
})

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": "printful-create-order",
    "configured_props": {
      "printful": { "authProvisionId": "apn_xxxxxxx" },
      "storeId": "Store ID",
      "externalId": "External ID"
    }
  }'
```

---

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