# Create Shipment — UPS

> Create a new shipment. See the documentation

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

## Description

Create a new shipment. [See the documentation](https://developer.ups.com/tag/Shipping?loc=en_US#operation/Shipment)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `shipperName` | `string` | Yes | The name of the shipper |
| `shipperNumber` | `string` | Yes | Shipper's six digit alphanumeric account number |
| `shipperAddressLine` | `string` | Yes | The address line of the shipper |
| `shipperCity` | `string` | Yes | The city of the shipper |
| `shipperStateProvinceCode` | `string` | Yes | The state province code of the shipper |
| `shipperPostalCode` | `string` | Yes | The postal code of the shipper |
| `shipperCountryCode` | `string` | Yes | The country code of the shipper |
| `shipToName` | `string` | Yes | The name of the ship to |
| `shipToAddressLine` | `string` | Yes | The address line of the ship to |
| `shipToCity` | `string` | Yes | The city of the ship to |
| `shipToStateProvinceCode` | `string` | Yes | The state province code of the ship to |
| `shipToPostalCode` | `string` | Yes | The postal code of the ship to |
| `shipToCountryCode` | `string` | Yes | The country code of the ship to |
| `serviceCode` | `string` | Yes | The code of the service |
| `packagingCode` | `string` | Yes | The code of the packaging |
| `weightUnit` | `string` | Yes | The unit of weight for the package |
| `packageWeight` | `string` | Yes | The weight of the package |

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

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: "ups-create-shipment",
  arguments: {
    shipperName: "Shipper Name",
    shipperNumber: "Shipper Number",
  },
})
```

**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: "ups-create-shipment",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    ups: { authProvisionId: "apn_xxxxxxx" },
    shipperName: "Shipper Name",
    shipperNumber: "Shipper Number",
  },
})

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": "ups-create-shipment",
    "configured_props": {
      "ups": { "authProvisionId": "apn_xxxxxxx" },
      "shipperName": "Shipper Name",
      "shipperNumber": "Shipper Number"
    }
  }'
```

---

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