# Create or Retrieve Return Label — Zenfulfillment

> Create or retrieve a Return Label for a specific Order. See the documentation

- Key: `zenfulfillment-create-or-retrieve-return-label`
- Type: Action (Write)
- Version: 0.0.2
- App: Zenfulfillment (`zenfulfillment`) — https://pipedream.com/apps/zenfulfillment.md
- This page (HTML): https://pipedream.com/apps/zenfulfillment/actions/create-or-retrieve-return-label
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/zenfulfillment/actions/create-or-retrieve-return-label/create-or-retrieve-return-label.mjs

## Description

Create or retrieve a Return Label for a specific Order. [See the documentation](https://partner.alaiko.com/docs#tag/ReturnLabel/operation/api_partnerreturn-label_post)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `orderId` | `string` | Yes | The ID of the order Options are loaded from the connected account. |
| `carrier` | `string` | Yes | Shipping carrier for the return label. Must be one of the supported carriers: DHL, HERMES, or EXPORTO. |
| `firstName` | `string` | Yes | First name of the return recipient (e.g., Jane). |
| `lastName` | `string` | No | Last name of the return recipient (e.g., Doe). |
| `city` | `string` | Yes | City of the return recipient's address (e.g., Berlin). |
| `company` | `string` | No | Company name at the return address, if applicable (e.g., Acme GmbH). |
| `country` | `string` | Yes | ISO 3166-1 alpha-2 country code for the return recipient's address (e.g., DE for Germany, GB for the United Kingdom, US for the United States). |
| `zip` | `string` | Yes | Postal/ZIP code for the return recipient's address. Format varies by country (e.g., 12345 for Germany, SW1A 1AA for the UK, 10001 for the US). |
| `region` | `string` | Yes | State, province, or region of the return recipient's address (e.g., Bavaria, England, NY). |
| `phone` | `string` | No | Phone number of the return recipient in E.164 format, including country code (e.g., +491701234567 for a German number, +441234567890 for a UK number). |
| `street` | `string` | Yes | Street name of the return recipient's address, without the house number (e.g., Hauptstraße). |
| `streetNumber` | `string` | Yes | House or building number for the return recipient's address. May be numeric or alphanumeric (e.g., 12, 12A, 4B). |
| `apartment` | `string` | No | Apartment, suite, or floor number at the return address, if applicable (e.g., Apt 3, Floor 2). |

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

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: "zenfulfillment-create-or-retrieve-return-label",
  arguments: {
    orderId: "Order ID",
    carrier: "Carrier",
  },
})
```

**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: "zenfulfillment-create-or-retrieve-return-label",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    zenfulfillment: { authProvisionId: "apn_xxxxxxx" },
    orderId: "Order ID",
    carrier: "Carrier",
  },
})

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": "zenfulfillment-create-or-retrieve-return-label",
    "configured_props": {
      "zenfulfillment": { "authProvisionId": "apn_xxxxxxx" },
      "orderId": "Order ID",
      "carrier": "Carrier"
    }
  }'
```

---

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