# Reschedule a booking

> **PATCH** `https://api.us.nylas.com/v3/scheduling/bookings/{booking_id}`

Source: https://developer.nylas.com/docs/reference/api/bookings/patch-bookings-id/

Reschedules the specified booking. Nylas also updates the associated event on the provider.

Nylas recommends against changing participants' email addresses while updating a booking, to avoid
confusion.

Nylas validates the provided session ID and uses it to retrieve the related
[Configuration object](/docs/reference/api/configurations/). If you created a public
Configuration, you don't need to include the `Authorization` request header with a session ID, but
you do need to pass the Configuration object ID as a query parameter.

When you make a `PATCH` request, Nylas replaces all data in the nested object with the information
included in your request. For more information, see
[Updating objects](/docs/reference/api/#updating-objects).

**Authentication:** SCHEDULER_SESSION_TOKEN

## Parameters

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `booking_id` | string | Yes | The ID of the booking object to access. |

### Query parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `configuration_id` | string | No | The ID of the Configuration object used for calculating availability. If you're using session authentication (`requires_session_auth: true`), the `configuration_id` isn't required. |
| `slug` | string | No | The Configuration object slug. You can use this with the `client_id` instead of using the `configuration_id`. If you're using session authentication (`requires_session_auth: true`) or using the `configuration_id`, `slug` isn't required. |
| `client_id` | string | No | The client ID that was used to create the Configuration object. Required only if you're using `slug`. |

## Request body

Content-Type: application/json

- **Reschedule standard booking**
  - `start_time` (string) **(required)** - The event's start time, in seconds using the Unix timestamp format.
  - `end_time` (string) **(required)** - The event's end time, in seconds using the Unix timestamp format.
- **Reschedule group booking**
  - `calendar_id` (string) **(required)** - The ID of the calendar to access.
  - `end_time` (integer) **(required)** - The event's end time, in seconds using the Unix timestamp format.\
  - `event_id` (string) **(required)** - The ID of the event to update.
  - `master_event_id` (string) - (Recurring events only) The ID of the master event.
  - `start_time` (integer) **(required)** - The event's start time, in seconds using the Unix timestamp format.

## Responses

### 200 - OK

- `request_id` (string) - ID of the request.

### 400 - Bad Request

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 401 - Unauthorized

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 404 - Not Found

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The raw error from the provider, if available
    - `code` (string)
    - `message` (string)

### 429 - Rate Limit

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

### 504 - Provider Failure

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL (Public)

```bash
curl --compressed --request PATCH \
  --url 'https://api.us.nylas.com/v3/scheduling/bookings/<BOOKING_ID>?configuration_id=<SCHEDULER_CONFIG_ID>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
    "start_time": 1708714800,
    "end_time": 1708722000
  }'
```

### cURL (Private)

```bash
curl --compressed --request PATCH \
  --url 'https://api.us.nylas.com/v3/scheduling/bookings/<BOOKING_ID>' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <SCHEDULER_SESSION_ID>' \
  --header 'Content-Type: application/json' \ 
  --data '{
    "start_time": 1708714800,
    "end_time": 1708722000
  }'
```

### Node.js SDK (Public)

```javascript
import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>",
});

async function rescheduleBooking() {
  try {
    const booking = await nylas.scheduler.bookings.reschedule({
      queryParams: {
        configurationId: "<SCHEDULER_CONFIG_ID>",
      },
      bookingId: "booking-id",
      requestBody: {
        startTime: 1763292600,
        endTime: 1763294400,
      },
    });
    console.log("Rescheduled Booking", booking);
  } catch (error) {
    console.error("Error rescheduling booking", error);
  }
}

rescheduleBooking();

```

### Python SDK

```python
from nylas import Client

nylas = Client(
    "<NYLAS_API_KEY>",
    "<NYLAS_API_URI>",
)

booking = nylas.scheduler.bookings.confirm(
    booking_id="<BOOKING_ID>",
    request_body={
        "salt": "<SALT>",
        "status": "confirmed",
    },
    query_params={
        "configuration_id": "<SCHEDULER_CONFIG_ID>",
    },
)

print("Confirmed booking:", booking)

```

### Node.js SDK (Private)

```javascript
import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<SCHEDULER_SESSION_ID>",
  apiUri: "<NYLAS_API_URI>",
});

async function rescheduleBooking() {
  try {
    const booking = await nylas.scheduler.bookings.reschedule({
      bookingId: "booking-id",
      requestBody: {
        startTime: 1763292600,
        endTime: 1763294400,
      },
    });
    console.log("Rescheduled Booking", booking);
  } catch (error) {
    console.error("Error rescheduling booking", error);
  }
}

rescheduleBooking();

```

### Ruby SDK (Public)

```ruby
# Load gems
require 'nylas'

# Initialize Nylas client
nylas = Nylas::Client.new(
  api_key: "<NYLAS_API_KEY>"
)

request_body = {
  "start_time": 1794828600,
  "end_time": 1794830400,
}
booking, _request_ids = nylas.scheduler.bookings.update(booking_id: "<BOOKING_ID>", request_body: request_body, query_params: {"configuration_id": "<CONFIGURATION_ID>"})

puts booking
```

### Ruby SDK (Private)

```ruby
# Load gems
require 'nylas'

# Initialize Nylas client
nylas = Nylas::Client.new(
  api_key: "<SCHEDULER_SESSION_ID>"
)
  
request_body = {
  "start_time": 1794828600,
  "end_time": 1794830400,
}
booking, _request_ids = nylas.scheduler.bookings.update(booking_id: "<BOOKING_ID>", request_body: request_body)

puts booking
```

### Java SDK (Public)

```java
import com.nylas.NylasClient;
import com.nylas.models.Booking;
import com.nylas.models.NylasApiError;
import com.nylas.models.NylasSdkTimeoutError;
import com.nylas.models.RescheduleBookingQueryParams;
import com.nylas.models.RescheduleBookingRequest;
import com.nylas.models.Response;

public class RescheduleBookingPublic {
  public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError {
    NylasClient nylas = new NylasClient.Builder("<NYLAS_API_KEY>").build();

    RescheduleBookingRequest requestBody = new RescheduleBookingRequest.Builder()
        .startTime(1763292600)
        .endTime(1763294400)
        .build();

    RescheduleBookingQueryParams queryParams = new RescheduleBookingQueryParams(
        "<SCHEDULER_CONFIG_ID>", "<SCHEDULER_CONFIG_SLUG>", "<NYLAS_CLIENT_ID>");

    Response<Booking> booking = nylas.scheduler().bookings().reschedule(
        "<BOOKING_ID>", requestBody, queryParams);

    System.out.println("Rescheduled booking: " + booking.getData());
  }
}

```

### Java SDK (Private)

```java
import com.nylas.NylasClient;
import com.nylas.models.Booking;
import com.nylas.models.NylasApiError;
import com.nylas.models.NylasSdkTimeoutError;
import com.nylas.models.RescheduleBookingRequest;
import com.nylas.models.Response;

public class RescheduleBooking {
  public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError {
    NylasClient nylas = new NylasClient.Builder("<SCHEDULER_SESSION_ID>").build();

    RescheduleBookingRequest requestBody = new RescheduleBookingRequest.Builder()
        .startTime(1763292600)
        .endTime(1763294400)
        .build();

    Response<Booking> booking = nylas.scheduler().bookings().reschedule("<BOOKING_ID>", requestBody);

    System.out.println("Rescheduled booking: " + booking.getData());
  }
}

```

### Kotlin SDK (Public)

```kotlin
import com.nylas.NylasClient
import com.nylas.models.RescheduleBookingQueryParams
import com.nylas.models.RescheduleBookingRequest

fun main() {
  val nylas = NylasClient.Builder("<NYLAS_API_KEY>").build()

  val requestBody = RescheduleBookingRequest.Builder()
      .startTime(1763292600)
      .endTime(1763294400)
      .build()

  val queryParams = RescheduleBookingQueryParams(
      configurationId = "<SCHEDULER_CONFIG_ID>",
      slug = "<SCHEDULER_CONFIG_SLUG>",
      clientId = "<NYLAS_CLIENT_ID>")

  val booking = nylas.scheduler().bookings().reschedule("<BOOKING_ID>", requestBody, queryParams)

  println("Rescheduled booking: ${booking.data}")
}

```

### Kotlin SDK (Private)

```kotlin
import com.nylas.NylasClient
import com.nylas.models.RescheduleBookingRequest

fun main() {
  val nylas = NylasClient.Builder("<SCHEDULER_SESSION_ID>").build()

  val requestBody = RescheduleBookingRequest.Builder()
      .startTime(1763292600)
      .endTime(1763294400)
      .build()

  val booking = nylas.scheduler().bookings().reschedule("<BOOKING_ID>", requestBody)

  println("Rescheduled booking: ${booking.data}")
}

```
