# Validate Return — Sendcloud

> Validate a return. See the documentation

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

## Description

Validate a return. [See the documentation](https://api.sendcloud.dev/docs/sendcloud-public-api/returns/operations/create-a-return-validate)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `fromAddress` | `object` | Yes | Required fields: name (string): Name associated with the address. Example: John Doe address_line_1 (string): First line of the address. Example: Stadhuisplein postal_code (string): Zip code. Example: 1013 AB city (string): City. Example: Eindhoven country_code (string): ISO 3166-1 alpha-2 code. Example: NL Optional fields: company_name (string): Company name. Example: Sendcloud house_number (string): House number. Example: 50 address_line_2 (string): Additional info. Example: Apartment 17B po_box (string \| null): PO box code state_province_code (string): ISO 3166-2 code. Example: IT-RM email (string): Email. Example: johndoe@gmail.com phone_number (string): Phone number. Example: +319881729999 Example: { "name": "John Doe", "address_line_1": "Stadhuisplein", "postal_code": "1013 AB", "city": "Eindhoven", "country_code": "NL" } |
| `toAddress` | `object` | Yes | Required fields: name (string): Name associated with the address. Example: John Doe address_line_1 (string): First line of the address. Example: Stadhuisplein postal_code (string): Zip code. Example: 1013 AB city (string): City. Example: Eindhoven country_code (string): ISO 3166-1 alpha-2 code. Example: NL Optional fields: company_name (string): Company name. Example: Sendcloud house_number (string): House number. Example: 50 address_line_2 (string): Additional info. Example: Apartment 17B po_box (string \| null): PO box code state_province_code (string): ISO 3166-2 code. Example: IT-RM email (string): Email. Example: johndoe@gmail.com phone_number (string): Phone number. Example: +319881729999 Example: { "name": "John Doe", "address_line_1": "Stadhuisplein", "postal_code": "1013 AB", "city": "Eindhoven", "country_code": "NL" } |
| `shipWith` | `object` | Yes | Shipping specifications chosen for the return. Fields: type (string): How the carrier/method is selected. One of shipping_option_code or shipping_product_code (default is shipping_product_code). shipping_option_code (string): Required if type = shipping_option_code. Example: dpd:return/return shipping_product_code (string): Required if type = shipping_product_code. Example: dpd:return/return functionalities (object): Shipping functionalities. Provide only when type = shipping_product_code. contract (integer): Contract ID to ship the return with. dimensions (object): length (number, >= 0) width (number, >= 0) height (number, >= 0) unit (string): One of cm, mm, m, yd, ft, in weight (object): value (number, > 0) unit (string): One of kg, g, lbs, oz Example: { "type": "shipping_option_code", "shipping_option_code": "dpd:return/return", "contract": 1234, "dimensions": { "length": 15, "width": 20.5, "height": 37, "unit": "mm" }, "weight": { "value": 14.5, "unit": "g" } } |
| `dimensionsLength` | `integer` | No | Length in the specified unit. |
| `dimensionsWidth` | `integer` | No | Width in the specified unit. |
| `dimensionsHeight` | `integer` | No | Height in the specified unit. |
| `dimensionsUnit` | `string` | No | Unit of the dimensions. |
| `weightValue` | `integer` | Yes | Weight value in the specified unit. |
| `weightUnit` | `string` | Yes | Unit of the weight. |

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

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: "sendcloud-validate-return",
  arguments: {
    fromAddress: "From Address",
    toAddress: "To Address",
  },
})
```

**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: "sendcloud-validate-return",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    sendcloud: { authProvisionId: "apn_xxxxxxx" },
    fromAddress: "From Address",
    toAddress: "To Address",
  },
})

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": "sendcloud-validate-return",
    "configured_props": {
      "sendcloud": { "authProvisionId": "apn_xxxxxxx" },
      "fromAddress": "From Address",
      "toAddress": "To Address"
    }
  }'
```

---

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