# Cancel Booking

## Cancel Booking

> The Cancel Booking endpoint is used when a customer no longer requires coverage and has contacted the partner directly to cancel the policy. This endpoint handles the cancellation process and calculates any applicable refunds.\
> \
> When \`preview\` is set to \`true\`, the cancellation is not applied but a preview of the refund is returned along with a \`cancellation\_id\` that can be used to confirm the cancellation.\
> \
> When \`preview\` is set to \`false\` (or omitted), the cancellation is applied immediately.

```json
{"openapi":"3.0.0","info":{"title":"Offers API","version":"1.0.0"},"servers":[{"url":"https://api.xcover.com/x"}],"security":[{"CustomAPISignature":[]}],"components":{"securitySchemes":{"CustomAPISignature":{"type":"apiKey","name":"Authorization","in":"header","description":"**Composite Authentication Scheme (Client Key, Date, and Signature)**\n\nThis scheme requires the client to provide **three** mandatory headers in every request:\n\n### 1. X-Api-Key (Client Key)\n* **Purpose:** Public identifier for the API consumer.\n* **Example:** `X-Api-Key: a1b2c3d4e5f6g7h8`\n\n### 2. Date (Timestamp)\n* **Purpose:** Timestamp used for generating the signature and preventing replay attacks.\n* **Format:** RFC 7231 format (e.g., in GMT).\n* **Example:** `Date: Sun, 09 Nov 2025 04:04:00 GMT`\n\n### 3. Authorization (Computed Signature)\n* **Purpose:** The cryptographic signature that verifies the request's authenticity and integrity.\n* **Format:** `SIGNATURE [authHeader]`\n\n**Signature Generation Logic:**\nThe `authHeader` value is derived from a cryptographic hash (e.g., HMAC-SHA256) of canonical request components (HTTP Method, Path, and the contents of the `Date` header), signed with the private **Client Secret**.\n"}}},"paths":{"/partners/{partner_code}/bookings/{booking_id}/cancel":{"post":{"summary":"Cancel Booking","description":"The Cancel Booking endpoint is used when a customer no longer requires coverage and has contacted the partner directly to cancel the policy. This endpoint handles the cancellation process and calculates any applicable refunds.\n\nWhen `preview` is set to `true`, the cancellation is not applied but a preview of the refund is returned along with a `cancellation_id` that can be used to confirm the cancellation.\n\nWhen `preview` is set to `false` (or omitted), the cancellation is applied immediately.","tags":["Cancel Booking"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"preview":{"type":"boolean","description":"When true, returns a preview of the cancellation without applying it. Use the returned cancellation_id to confirm."},"refund_required":{"type":"boolean","description":"Whether a refund is required for this cancellation"},"quotes":{"type":"array","description":"Array of quotes to cancel. Required when preview is true.","items":{"type":"object","properties":{"id":{"type":"string","description":"The quote ID to cancel"},"reason_for_cancellation":{"type":"string","description":"Reason for cancelling this quote"}},"required":["id"]}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"quotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"policy_start_date":{"type":"string","format":"date-time"},"policy_end_date":{"type":"string","format":"date-time"},"policy_cancellation_date":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string"},"price":{"type":"number"},"refund_value":{"type":"number"},"adjustment_fee":{"type":"number"}}}},"policyholder":{"type":"object","properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"country":{"type":"string"}}},"total_price":{"type":"number"},"total_price_formatted":{"type":"string"},"total_refund":{"type":"number"},"total_refund_formatted":{"type":"string"},"currency":{"type":"string"},"cancellation_id":{"type":"string","nullable":true,"description":"Present when preview=true. Use this ID to confirm the cancellation."},"confirm_before":{"type":"string","format":"date-time","nullable":true,"description":"Deadline to confirm the cancellation preview"},"refund_amount":{"type":"number"},"refund_amount_formatted":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"}}}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"errors":{"type":"array","items":{"type":"string"}}}}}}}}}}}}
```

## Cancel Booking - Confirm

> The Confirm Cancellation endpoint finalizes a previewed cancellation. Use the cancellation\_id returned from the Cancel Booking endpoint when preview was set to true.

```json
{"openapi":"3.0.0","info":{"title":"Offers API","version":"1.0.0"},"servers":[{"url":"https://api.xcover.com/x"}],"security":[{"CustomAPISignature":[]}],"components":{"securitySchemes":{"CustomAPISignature":{"type":"apiKey","name":"Authorization","in":"header","description":"**Composite Authentication Scheme (Client Key, Date, and Signature)**\n\nThis scheme requires the client to provide **three** mandatory headers in every request:\n\n### 1. X-Api-Key (Client Key)\n* **Purpose:** Public identifier for the API consumer.\n* **Example:** `X-Api-Key: a1b2c3d4e5f6g7h8`\n\n### 2. Date (Timestamp)\n* **Purpose:** Timestamp used for generating the signature and preventing replay attacks.\n* **Format:** RFC 7231 format (e.g., in GMT).\n* **Example:** `Date: Sun, 09 Nov 2025 04:04:00 GMT`\n\n### 3. Authorization (Computed Signature)\n* **Purpose:** The cryptographic signature that verifies the request's authenticity and integrity.\n* **Format:** `SIGNATURE [authHeader]`\n\n**Signature Generation Logic:**\nThe `authHeader` value is derived from a cryptographic hash (e.g., HMAC-SHA256) of canonical request components (HTTP Method, Path, and the contents of the `Date` header), signed with the private **Client Secret**.\n"}}},"paths":{"/partners/{partner_code}/bookings/{booking_id}/confirm_cancellation/{cancellation_id}/":{"post":{"summary":"Cancel Booking - Confirm","description":"The Confirm Cancellation endpoint finalizes a previewed cancellation. Use the cancellation_id returned from the Cancel Booking endpoint when preview was set to true.","tags":["Cancel Booking"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason_for_cancellation":{"type":"string","description":"Reason for the cancellation"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"quotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"price":{"type":"number"},"refund_value":{"type":"number"},"cancelled_at":{"type":"string","format":"date-time"}}}},"total_refund":{"type":"number"},"total_refund_formatted":{"type":"string"},"refund_amount":{"type":"number"},"refund_amount_formatted":{"type":"string"}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"}}}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"}}}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"errors":{"type":"array","items":{"type":"string"}}}}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://partner-docs.covergenius.com/offers/vertical-examples/travel-accomodation/cancel-booking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
