> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magpipe.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Booking

> Cancel an existing calendar booking

Cancel a previously booked appointment. The attendee will receive a cancellation notification.

## Request Body

<ParamField body="booking_id" type="integer">
  The Cal.com booking ID to cancel. Provide either `booking_id` or `uid`.
</ParamField>

<ParamField body="uid" type="string">
  The unique booking identifier to cancel. Provide either `booking_id` or `uid`.
</ParamField>

<ParamField body="reason" type="string">
  Optional reason for cancellation (included in notification).
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the booking was cancelled successfully.
</ResponseField>

<ResponseField name="booking_id" type="integer">
  The cancelled booking ID.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.magpipe.ai/functions/v1/cal-com-cancel-booking \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "uid": "bkg_a1b2c3d4e5f6",
      "reason": "Customer requested reschedule"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.magpipe.ai/functions/v1/cal-com-cancel-booking',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        uid: 'bkg_a1b2c3d4e5f6',
        reason: 'Customer requested reschedule'
      }),
    }
  );

  const result = await response.json();
  console.log('Cancelled:', result.success);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.magpipe.ai/functions/v1/cal-com-cancel-booking',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json',
      },
      json={
          'uid': 'bkg_a1b2c3d4e5f6',
          'reason': 'Customer requested reschedule'
      }
  )

  result = response.json()
  print(f"Cancelled: {result['success']}")
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "booking_id": 123456
  }
  ```

  ```json Error Response theme={null}
  {
    "error": {
      "code": "booking_not_found",
      "message": "Booking not found or already cancelled"
    }
  }
  ```
</ResponseExample>
