# Cancelling booking through API

**URL:** <https://forum.youcanbook.me/t/cancelling-booking-through-api/3005>\
**Category:** API\
**Created:** [September 5, 2024, 3:20pm UTC](https://forum.youcanbook.me/t/cancelling-booking-through-api/3005 "2024-09-05T15:20:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![theapidev](https://avatars.discourse-cdn.com/v4/letter/t/f9ae1b/32.png) [@theapidev](https://forum.youcanbook.me/u/theapidev)\
**Post date:** [September 5, 2024, 3:20pm UTC](https://forum.youcanbook.me/t/cancelling-booking-through-api/3005/1 "2024-09-05T15:20:55Z")

</div>

Unable to cancel booking through the API. It’s also quite confusing in the docs that there are different ways to cancel it. Both PATCH /v1/intents/{intentId}/booking/cancel and PATCH [https://api.youcanbook.me/v1/bookings/{bookingId}](https://api.youcanbook.me/v1/bookings/%7BbookingId%7D)? I tried both and none work. Would love a solution to this.

---

<div class="post-metadata">

**Author:** ![Ben](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.youcanbook.me/ben/32/772_2.png) [@Ben](https://forum.youcanbook.me/u/Ben)\
**Post date:** [September 5, 2024, 6:24pm UTC](https://forum.youcanbook.me/t/cancelling-booking-through-api/3005/2 "2024-09-05T18:24:08Z")

</div>

@theapidev to that URL endpoint ([https://api.youcanbook.me/v1/bookings/{bookingId}](https://api.youcanbook.me/v1/bookings/%7BbookingId%7D)) you should be able to PATCH

```auto
{
  "cancelled" : true
}

```

Is this not working for you?

---

<div class="post-metadata">

**Author:** ![theapidev](https://avatars.discourse-cdn.com/v4/letter/t/f9ae1b/32.png) [@theapidev](https://forum.youcanbook.me/u/theapidev)\
**Post date:** [September 6, 2024, 9:21am UTC](https://forum.youcanbook.me/t/cancelling-booking-through-api/3005/3 "2024-09-06T09:21:51Z")

</div>

No unfortunately I keep getting this error:

```auto
{
  "code": "ycbm_api_booking_forbidden_operation",
  "errors": [],
  "httpCode": 403,
  "httpStatusCode": 403,
  "message": "Booking operation is not allowed",
  "status": "FORBIDDEN",
  "type": "YcbmApiException"
}

```

I’ve double checked the bookingId and the link multiple times, no luck so far… Also tried with new bookings. I can run GET on the same endpoint and it returns:

```auto
{
  "cancelled": false
}

```

But PATCH does not work. I’m including the {“cancelled”:true} body.

---

<div class="post-metadata">

**Author:** ![Ben](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.youcanbook.me/ben/32/772_2.png) [@Ben](https://forum.youcanbook.me/u/Ben)\
**Post date:** [September 6, 2024, 2:24pm UTC](https://forum.youcanbook.me/t/cancelling-booking-through-api/3005/4 "2024-09-06T14:24:55Z")

</div>

@theapidev I will send you a message here so I an more specific information about your requests.

---

<div class="post-metadata">

**Author:** ![mullagatawny](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mullagatawny](https://forum.youcanbook.me/u/mullagatawny)\
**Post date:** [September 12, 2024, 11:57pm UTC](https://forum.youcanbook.me/t/cancelling-booking-through-api/3005/5 "2024-09-12T23:57:32Z")

</div>

Hi @Ben, jumping in here with a similar issue. The docs state “This is an unauthenticated endpoint” but it seems this error is thrown w/o credentials. Could you confirm?

> **[Booking partial update | YouCanBookMe API](https://ycbm.stoplight.io/docs/youcanbookme-api/26aa8f2e181c5-booking-partial-update)**
>
> This is an unauthenticated endpoint Powered by Stoplight.

---

<div class="post-metadata">

**Author:** ![Ben](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.youcanbook.me/ben/32/772_2.png) [@Ben](https://forum.youcanbook.me/u/Ben)\
**Post date:** [September 16, 2024, 2:43pm UTC](https://forum.youcanbook.me/t/cancelling-booking-through-api/3005/6 "2024-09-16T14:43:37Z")

</div>

@mullagatawny anytime you are looking to interact with the booking and not GET the information you will need to authenticated. It is recommended to always use the Basic Authentication for any requests to the API.
