# Update Reservation — Mews

> Update an existing reservation in Mews. See the documentation

- Key: `mews-update-reservation`
- Type: Action (Write)
- Version: 0.0.4
- App: Mews (`mews`) — https://pipedream.com/apps/mews.md
- This page (HTML): https://pipedream.com/apps/mews/actions/update-reservation
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/mews/actions/update-reservation/update-reservation.mjs

## Description

Update an existing reservation in Mews. [See the documentation](https://mews-systems.gitbook.io/connector-api/operations/reservations#update-reservations)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `reason` | `string` | No | Reason for updating the reservation. Required when updating the price of the reservation. |
| `reprice` | `boolean` | No | Whether the price should be updated to latest value for date/rate/category combination set in Mews. If not specified, the reservation price is updated. |
| `applyCancellationFee` | `boolean` | No | Whether the cancellation fees should be applied according to rate cancellation policies. If not specified, the cancellation fees are applied. |
| `reservationId` | `string` | Yes | Unique identifier of the reservation. Options are loaded from the connected account. |
| `channelNumber` | `string` | No | Number of the reservation within the Channel (i.e. OTA, GDS, CRS, etc) in case the reservation group originates there (e.g. Booking.com confirmation number) |
| `startUtc` | `string` | No | Reservation start in UTC timezone in ISO 8601 format |
| `endUtc` | `string` | No | Reservation end in UTC timezone in ISO 8601 format |
| `releasedUtc` | `string` | No | Date when the optional reservation is released in UTC timezone in ISO 8601 format |
| `personCounts` | `string[]` | No | Number of people per age category the reservation is for. If supplied, the person counts will be replaced. Each item should contain: AgeCategoryId (string, required): Unique identifier of the Age category Count (integer, required): Number of people of a given age category. Only positive value is accepted Pass an array of person counts or null if the person counts should not be updated. Example: [ { "AgeCategoryId": "12345678-1234-1234-1234-123456789012", "Count": 2 }, { "AgeCategoryId": "87654321-4321-4321-4321-210987654321", "Count": 1 } ] |
| `assignedResourceId` | `string` | No | Identifier of the assigned Resource. If the assigned resource is locked, see AssignedResourceLocked for updating the assigned resource. |
| `requestedCategoryId` | `string` | No | Identifier of the requested ResourceCategory |
| `travelAgencyId` | `string` | No | Identifier of the Travel Agency. (Company with a TravelAgencyContract) Options are loaded from the connected account. |
| `companyId` | `string` | No | Unique identifier of Company. Options are loaded from the connected account. |
| `businessSegmentId` | `string` | No | Unique identifier of BusinessSegment. Options are loaded from the connected account. |
| `purpose` | `string` | No | Purpose of the reservation |
| `rateId` | `string` | No | Identifier of the Rate. See the documentation Options are loaded from the connected account. |
| `creditCardId` | `string` | No | Identifier of CreditCard belonging to Customer who owns the reservation Options are loaded from the connected account. |
| `timeUnitPrices` | `string[]` | No | Prices for time units of the reservation. Each unit should contain: Index (integer, required): Index of the unit starting with 0 (e.g., first night has index 0) Amount (object, optional): Amount parameters including: GrossValue (decimal, optional): Amount including tax (required for Gross Pricing environments) NetValue (decimal, optional): Amount excluding tax (required for Net Pricing environments) Currency (string, required): ISO-4217 code of the currency TaxCodes (array of strings, required): Codes of tax rates to be applied (note: only one tax when using GrossValue, multiple taxes with NetValue) Pass an array of price units or null if the unit amounts should not be updated. Example: [ { "Index": 0, "Amount": { "GrossValue": 100.00, "Currency": "EUR", "TaxCodes": ["VAT"] } }, { "Index": 1, "Amount": { "NetValue": 85.00, "Currency": "EUR", "TaxCodes": ["VAT", "CityTax"] } } ] |
| `bookerId` | `string` | Yes | Identifier of the Customer on whose behalf the reservation was made. Options are loaded from the connected account. |
| `assignedResourceLocked` | `boolean` | No | Whether the reservation should be locked to the assigned Resource. To reassign the reservation to a new Resource, first set AssignedResourceLocked to false to unlock the resource. Then, assign the reservation to a new Resource by setting AssignedResourceId to the new resource ID. |
| `availabilityBlockId` | `string` | No | Unique identifier of the AvailabilityBlock the reservation is assigned to. Options are loaded from the connected account. |
| `optionsOwnerCheckedIn` | `boolean` | No | Whether the owner of the reservation has checked in. |

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

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: "mews-update-reservation",
  arguments: {
    reason: "Reason",
    reprice: true,
  },
})
```

**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: "mews-update-reservation",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    mews: { authProvisionId: "apn_xxxxxxx" },
    reason: "Reason",
    reprice: true,
  },
})

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": "mews-update-reservation",
    "configured_props": {
      "mews": { "authProvisionId": "apn_xxxxxxx" },
      "reason": "Reason",
      "reprice": true
    }
  }'
```

---

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