Skip to main content
Documentation

Booking

booking.cancel

Cancel a booking, after the customer verifies with a code
WritesReaches the customerSensitiveSend budget

REST

Shipping
POST /api/v1/booking/cancel

MCP tool

Live
booking.cancel

Exposed on: REST API · Booking MCP server. Part of the Booking domain.

Operating contract

TWO CALLS, ALWAYS, AND THAT IS THE POINT. Call it once with no code: a six-digit code is sent to the contact details on the booking and you get status: "code_sent" with a masked hint of where it went. Ask the customer to read the code back, then call again with code set. A manage token can be forwarded, screenshotted or left in a shared inbox, so it is not on its own enough to take an appointment off a shop's calendar.

status is the whole answer: canceled (done — an already-cancelled booking says this too, so a retry is safe), code_sent, bad_code (wrong, expired or already used — issue a new one by calling again with no code), deposit_paid, locked, unavailable.

deposit_paid IS NOT A FAILURE TO WORK AROUND. A booking with money already down is not cancelled by a machine; it is a conversation with the shop. Give the customer the shop's phone number and stop.

locked means the appointment is inside the shop's cut-off or already under way. Same answer: the shop's phone number.

This sets the booking's status and frees its slot. It deletes nothing and refunds nothing — a deposit that was paid stays a question for the shop.

Rescheduling is often what the customer actually wants. Offer booking.reschedule before cancelling, and note it needs no code.

Who may call it

Permission
NoneThe customer cancelling their own appointment with their own manage token plus a code sent to the number on the booking — the same two-step the manage page runs with no login. Staff cancel from the job board, which is section-gated.
Plan
Every planNo plan gate. Available on every Service VIN plan.
Retries
naturalNaturally idempotent — running it twice leaves the same world as running it once. A retrying integration needs no key.
Rate class
sendCounted against the send budget, the tightest one: what a runaway loop spends here is the shop's own sending reputation.

Input

FieldTypeDescription
manage_tokenrequiredstringmax 512 chars, min 8 chars

The token from the booking's manage_url, as returned by booking.book.

codestringmax 12 chars

The six-digit code the customer read back. Omit on the first call to have one sent.

Output

FieldTypeDescription
statusstring

code_sent_tostring | null

messagestring

Examples

Built from this capability's own schema — required fields and the ones carrying a default, and nothing invented. Paste one and it validates.

curl
export SERVICEVIN_API_KEY=svk_live_…

curl -X POST https://www.servicevin.com/api/v1/booking/cancel \
  -H "Authorization: Bearer $SERVICEVIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"manage_token":"…"}'

TypeScript (fetch)
const res = await fetch("https://www.servicevin.com/api/v1/booking/cancel", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SERVICEVIN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "manage_token": "…"
  }),
});

// Success and failure are both envelopes. Switch on error.code, never
// on error.message — the codes are stable, the messages are for people.
const payload = await res.json();
if (!res.ok) throw new Error(payload.error.code);
const data = payload.data;

Python (requests)
import os, requests

res = requests.post(
    "https://www.servicevin.com/api/v1/booking/cancel",
    headers={"Authorization": f"Bearer {os.environ['SERVICEVIN_API_KEY']}"},
    json={
    "manage_token": "…"
},
    timeout=30,
)
payload = res.json()
if not res.ok:
    raise RuntimeError(payload["error"]["code"])
data = payload["data"]

MCP tools/call — https://www.servicevin.com/api/mcp
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "booking.cancel",
    "arguments": {
      "manage_token": "…"
    }
  }
}

Refusals

The four gates run in this order on every surface, and the order is not arbitrary — see Authentication.

StatusCodeWhen
404not_foundThe id is unknown, or the feature is not enabled for this account. Deliberately the same answer for both.
403insufficient_scopeThe credential is read-only and this capability writes.
422validation_errorAn argument was wrong. The message names the field.
429rate_limitedToo many send calls. Back off and retry.
500internal_errorSomething failed on our side. Nothing was changed.