# Cancel

The Cancel endpoint enables the RentalCover server to cancel a quoted or purchased policy assuming the `FromDate` has not yet passed.

#### Endpoint: `/insurances/cancel`

#### Method: `DELETE` or `POST`

(Using `POST` allows a `CancelReason` to be Posted to the endpoint)

{% tabs %}
{% tab title="DELETE /insurnaces/cancel" %}

```perl
curl -i -X DELETE \
-H "X_API_KEY: [my-api-key]" \
-H "Content-Type: application/json" \
https://api-staging.rentalcover.com/insurances/cancel/AB12-345C-INS
```

{% endtab %}

{% tab title="POST /insurances/cancel" %}

```perl
curl -i -X POST \
-H "X_API_KEY: [my-api-key]" \
-H "Content-Type: application/json" \
-d '{"CancelReason":"I am no longer travelling"}' \
https://api-staging.rentalcover.com/insurances/cancel/AB12-345C-INS
curl -i -X POST \
-H "X_API_KEY: [my-api-key]" \
-H "Content-Type: application/json" \
-d '{"CancelReason":"I am no longer travelling"}' \
https://api-staging.rentalcover.com/insurances/cancel/AB12-345C-INS
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
   "BookingId":"12345",
   "Reference":"AB12-345C-INS",
   "Status":"Cancelled",
   "CancelMessage":"Booking: AB12-345C-INS has been cancelled. A refund for AU$99.00 has been processed."
}
```

{% endtab %}
{% endtabs %}

## **Request Parameters**

|                                                           |                                                                |
| --------------------------------------------------------- | -------------------------------------------------------------- |
| `reference` string **required**                           | The RentalCover.com booking reference (passed in endpoint URL) |
| `CancelReason` string \[500] **required** for POST method | Reason for cancelling the policy                               |


---

# 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/rentalcover/endpoints/cancel.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.
