---
title: "Cancels a booked call before it ends, freeing its slot: what the customer paid goes back inside the call's refund window, or as `refund` says, with an optional message for the customer."
---

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

Path: Sherpo merchant API › transaction

`POST /v1/stores/{store}/call_bookings/{booking}/cancel`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `transaction:write`

## Path parameters

- `store` (`cancelCallBooking.path.store`; string, required) — The store's id.
- `booking` (`cancelCallBooking.path.booking`; string, required)
  - minLength 1

## Header parameters

- `Idempotency-Key` (`cancelCallBooking.header.Idempotency-Key`; string, optional) — Repeats within 24 hours answer the first result; the same key with other arguments is a conflict.
  - minLength 1; maxLength 255; pattern `^[\x21-\x7E]+$`

## Request body

_Optional._

- `text_format` (`cancelCallBooking.text_format`; string, optional) — The format the rich text fields are written in: the rich text format’s HTML, or Markdown converted into it before it is validated. A text already stored in the format (starting with `<rich-text`) is kept as it is either way.
  - one of `"html"`, `"markdown"`; default `"html"`
- `refund` (`cancelCallBooking.refund`; any of, optional) — Whether what the customer paid for it goes back; inside its refund window (`refund_until`) when left out. A call that charged nothing owes none.
  - any of: `boolean`, `null`
- `message` (`cancelCallBooking.message`; any of, optional) — The seller's words to the customer, for the mail telling them: a rich text with no blocks, at most 4096 characters, stored in its canonical form within 16 KiB of UTF-8; empty sends none.
  - any of: `string`, `null`

## Example request

```json
{
  "text_format": "html",
  "refund": true,
  "message": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/call_bookings/<booking>/cancel' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text_format": "html",
  "refund": true,
  "message": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/call_bookings/<booking>/cancel';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({text_format: 'html', refund: true, message: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/merchant/v1/stores/<store>/call_bookings/<booking>/cancel"

payload = {
    "text_format": "html",
    "refund": True,
    "message": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Cancels a booked call before it ends, freeing its slot: what the customer paid goes back inside the call's refund window, or as `refund` says, with an optional message for the customer.

#### Example

```json
{
  "meeting": {
    "kind": "string",
    "url": "string",
    "status": "ready"
  },
  "customer_id": "string",
  "order_id": "string",
  "order_item_id": "string",
  "amount": 0,
  "refundable": 0,
  "currency": "string",
  "exponent": 0,
  "cancel_message": "string",
  "conflict": true,
  "refund": {
    "id": "string",
    "product_id": "string",
    "customer_id": "string",
    "order_id": "string",
    "settlement_id": "string",
    "status": "string",
    "amount": 0,
    "currency": "string",
    "exponent": 0,
    "failure": "string",
    "refund_id": "string",
    "processor_ref": "string",
    "refunded_at": "string",
    "created_at": "string",
    "customer": {
      "id": "string",
      "name": "string",
      "email": "string",
      "phone": "string",
      "erased": true
    }
  },
  "refunds": [
    {
      "id": "string",
      "product_id": "string",
      "customer_id": "string",
      "order_id": "string",
      "settlement_id": "string",
      "status": "string",
      "amount": 0,
      "currency": "string",
      "exponent": 0,
      "failure": "string",
      "refund_id": "string",
      "processor_ref": "string",
      "refunded_at": "string",
      "created_at": "string",
      "customer": {
        "id": "string",
        "name": "string",
        "email": "string",
        "phone": "string",
        "erased": true
      }
    }
  ],
  "customer": {
    "id": "string",
    "name": "string",
    "email": "string",
    "phone": "string",
    "erased": true
  },
  "id": "string",
  "product_id": "string",
  "status": "string",
  "starts_at": "string",
  "ends_at": "string",
  "time_zone": "string",
  "change_until": "string",
  "reschedules": 0,
  "reschedules_left": 0,
  "rescheduled_from": "string",
  "refund_until": "string",
  "cancel_reason": "string",
  "canceled_at": "string",
  "refund_owed": true,
  "created_at": "string",
  "updated_at": "string"
}
```

- `meeting` (`cancelCallBooking.response.200.meeting`; any of, required) — Where the call is joined; null once it isn't booked, or with no link to join.
  - any of: `object`, `object`, `null`
- `customer_id` (`cancelCallBooking.response.200.customer_id`; string, required)
- `order_id` (`cancelCallBooking.response.200.order_id`; any of, required)
  - any of: `string`, `null`
- `order_item_id` (`cancelCallBooking.response.200.order_item_id`; any of, required)
  - any of: `string`, `null`
- `amount` (`cancelCallBooking.response.200.amount`; any of, required) — What its order line charged, after discounts; null without `revenue:read`.
  - any of: `number`, `null`
- `refundable` (`cancelCallBooking.response.200.refundable`; any of, required) — What a cancel with a refund would give back now: `amount` less what the order already refunded of it; null once canceled or without `revenue:read`.
  - any of: `number`, `null`
- `currency` (`cancelCallBooking.response.200.currency`; any of, required)
  - any of: `string`, `null`
- `exponent` (`cancelCallBooking.response.200.exponent`; any of, required)
  - any of: `number`, `null`
- `cancel_message` (`cancelCallBooking.response.200.cancel_message`; any of, required) — The seller's words to the customer when they canceled it; null otherwise.
  - any of: `string`, `null`
- `conflict` (`cancelCallBooking.response.200.conflict`; boolean, required) — Whether money that came after its hold lapsed booked it over another call, for the seller to move.
- `refund` (`cancelCallBooking.response.200.refund`; any of, required) — What its cancel gives back and where it stands, the worst of `refunds` (`retryEventRefund` tries a failed one again; `manual` is the seller's to pay by hand); null when none was made, which with `refund_owed` means nothing was left to give back.
  - any of: `object`, `null`
- `refunds` (`cancelCallBooking.response.200.refunds`; array<object>, required) — One refund per payment of its order, worst first.
  - `id` (`cancelCallBooking.response.200.refunds.id`; string, required)
  - `product_id` (`cancelCallBooking.response.200.refunds.product_id`; string, required)
  - `customer_id` (`cancelCallBooking.response.200.refunds.customer_id`; string, required)
  - `order_id` (`cancelCallBooking.response.200.refunds.order_id`; string, required)
  - `settlement_id` (`cancelCallBooking.response.200.refunds.settlement_id`; string, required)
  - `status` (`cancelCallBooking.response.200.refunds.status`; string, required) — `pending` while owed, `refunded` once given back, `failed` for the seller to retry, `manual` for the seller to refund (a sale paid outside the store, or one its payment has no room left for).
  - `amount` (`cancelCallBooking.response.200.refunds.amount`; any of, required)
    - any of: `number`, `null`
  - `currency` (`cancelCallBooking.response.200.refunds.currency`; string, required)
  - `exponent` (`cancelCallBooking.response.200.refunds.exponent`; any of, required)
    - any of: `number`, `null`
  - `failure` (`cancelCallBooking.response.200.refunds.failure`; any of, required) — Why the last try failed: `processor_refused`, `account_gone`, `processor_failed`, `processor_unavailable`, `nothing_left`, `order_unreconciled` or `internal`; null unless failed.
    - any of: `string`, `null`
  - `refund_id` (`cancelCallBooking.response.200.refunds.refund_id`; any of, required) — The refund recorded on the order once it landed, or once a refund naming it gave it back.
    - any of: `string`, `null`
  - `processor_ref` (`cancelCallBooking.response.200.refunds.processor_ref`; any of, required)
    - any of: `string`, `null`
  - `refunded_at` (`cancelCallBooking.response.200.refunds.refunded_at`; any of, required)
    - any of: `string`, `null`
  - `created_at` (`cancelCallBooking.response.200.refunds.created_at`; string, required)
  - `customer` (`cancelCallBooking.response.200.refunds.customer`; any of, required) — Who it gives back to, `erased` once their details are wiped.
    - any of: `object`, `null`
- `customer` (`cancelCallBooking.response.200.customer`; any of, required)
  - any of: `object`, `null`
- `id` (`cancelCallBooking.response.200.id`; string, required)
- `product_id` (`cancelCallBooking.response.200.product_id`; string, required)
- `status` (`cancelCallBooking.response.200.status`; string, required)
- `starts_at` (`cancelCallBooking.response.200.starts_at`; any of, required)
  - any of: `string`, `null`
- `ends_at` (`cancelCallBooking.response.200.ends_at`; any of, required)
  - any of: `string`, `null`
- `time_zone` (`cancelCallBooking.response.200.time_zone`; any of, required) — The host's time zone, which the call's hours are set in.
  - any of: `string`, `null`
- `change_until` (`cancelCallBooking.response.200.change_until`; any of, required) — Until when its customer may still move or cancel it.
  - any of: `string`, `null`
- `reschedules` (`cancelCallBooking.response.200.reschedules`; number, required) — How many times its customer moved it; a seller's moves spend none.
- `reschedules_left` (`cancelCallBooking.response.200.reschedules_left`; number, required)
- `rescheduled_from` (`cancelCallBooking.response.200.rescheduled_from`; any of, required) — Where it started before its latest move, by the seller or the customer; null if it never moved.
  - any of: `string`, `null`
- `refund_until` (`cancelCallBooking.response.200.refund_until`; any of, required) — Until when a cancel refunds it; null when none does.
  - any of: `string`, `null`
- `cancel_reason` (`cancelCallBooking.response.200.cancel_reason`; any of, required)
  - any of: `string`, `null`
- `canceled_at` (`cancelCallBooking.response.200.canceled_at`; any of, required)
  - any of: `string`, `null`
- `refund_owed` (`cancelCallBooking.response.200.refund_owed`; any of, required) — Whether its cancel owed what was paid back, never for a call that charged nothing; null while it is booked.
  - any of: `boolean`, `null`
- `created_at` (`cancelCallBooking.response.200.created_at`; any of, required)
  - any of: `string`, `null`
- `updated_at` (`cancelCallBooking.response.200.updated_at`; any of, required)
  - any of: `string`, `null`

### default

A problem; see https://api.sherpo.io/merchant/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`cancelCallBooking.response.default.type`; string, required)
  - format `uri`
- `title` (`cancelCallBooking.response.default.title`; string, required)
- `status` (`cancelCallBooking.response.default.status`; integer, required)
- `detail` (`cancelCallBooking.response.default.detail`; string, required)
- `code` (`cancelCallBooking.response.default.code`; string, optional)
- `context` (`cancelCallBooking.response.default.context`; object, optional)
- `reached_core` (`cancelCallBooking.response.default.reached_core`; boolean, optional)
- `core_answer` (`cancelCallBooking.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/merchant-api/reference/cancel-call-booking/index.md
