# Create Device Return — Retriever

> Creates a device return order. See the documentation

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

## Description

Creates a device return order. [See the documentation](https://app.helloretriever.com/api/v1/docs/#tag/Device-Return-Orders/operation/Submit%20Order)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `requestCharger` | `boolean` | Yes | Whether or not to request a charger with the device return. |
| `employeeInfoEmail` | `string` | No | Optional email address for notifying the employee when a box ships and is delivered, as well as sending reminders. |
| `employeeInfoName` | `string` | Yes | The employee name to print on the shipping label. |
| `employeeInfoAddressLine1` | `string` | Yes | The first line of the employee's address (typically the street address), or a full, comma-separated address. If providing the Employee Info Address Line 1, Employee Info Address City, Employee Info Address State, and Employee Info Address Zip are required (Employee Info Address Line 2 remains optional). If providing a full address, it is best to use the format 1 Main St, New York, NY 10001 or 1 Main St, Apt 200, New York, NY 10001. We will attempt to parse any full address, but cannot guarantee accuracy - especially if other formats are used. It is highly recommended to provide the address in separate fields. |
| `employeeInfoAddressLine2` | `string` | No | Optional second line of the employee's address. |
| `employeeInfoAddressCity` | `string` | No | Optional if a full address is provided in Employee Info Address Line 1. Required otherwise. |
| `employeeInfoAddressState` | `string` | No | Optional if a full address is provided in Employee Info Address Line 1. Required otherwise. |
| `employeeInfoAddressZip` | `string` | No | Optional if a full address is provided in Employee Info Address Line 1. Required otherwise. |
| `companyInfoReturnRecipientName` | `string` | Yes | The return recipient name to print on the shipping label. |
| `companyInfoReturnAddressCompany` | `string` | No | The return recipient company to print on the shipping label. |
| `companyInfoReturnAddressLine1` | `string` | Yes | The first line of the return address (typically the street address), or a full, comma-separated address. If providing the Company Info Return Address Line 1, Company Info Return Address City, Company Info Return Address State, and Company Info Return Address Zip are required (Company Info Return Address Line 2 remains optional). If providing a full address, it is best to use the format 1 Main St, New York, NY 10001 or 1 Main St, Apt 200, New York, NY 10001. We will attempt to parse any full address, but cannot guarantee accuracy - especially if other formats are used. It is highly recommended to provide the address in separate fields. |
| `companyInfoReturnAddressLine2` | `string` | No | Optional second line of the return address. |
| `companyInfoReturnAddressCity` | `string` | No | Optional if a full address is provided in Company Info Return Address Line 1. Required otherwise. |
| `companyInfoReturnAddressState` | `string` | No | Optional if a full address is provided in Company Info Return Address Line 1. Required otherwise. |
| `companyInfoReturnAddressZip` | `string` | No | Optional if a full address is provided in Company Info Return Address Line 1. Required otherwise. |
| `companyInfoDisplayName` | `string` | Yes | Used in email communications with the employee. |
| `companyInfoNotificationEmail` | `string` | No | Optional email address for updates on the status of this device return. |

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

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: "retriever-create-device-return",
  arguments: {
    requestCharger: true,
    employeeInfoEmail: "Employee Info Email",
  },
})
```

**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: "retriever-create-device-return",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    retriever: { authProvisionId: "apn_xxxxxxx" },
    requestCharger: true,
    employeeInfoEmail: "Employee Info Email",
  },
})

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": "retriever-create-device-return",
    "configured_props": {
      "retriever": { "authProvisionId": "apn_xxxxxxx" },
      "requestCharger": true,
      "employeeInfoEmail": "Employee Info Email"
    }
  }'
```

---

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