# Cancel appointment

This endpoint is used to request the cancellation of an appointment in a non-cancelled status. (Non-cancelled statuses include: pending_booking, booking_failed, confirmed, pending_reschedule, reschedule_failed and rescheduled)
Developers must send a valid `appointment_id` as input in the request body and may choose to pass a cancellation reason using the standardized `cancellation_reason_type` field. The optional `cancellation_reason` field should only be used when the cancellation reason type is 'other_patient_reason' or 'other_provider_reason' to provide additional context.
If the appointment was booked with a Zocdoc user credential, only that user will have access to view or modify the appointment. If the appointment was booked with a machine-to-machine credential, the appointment can be viewed and modified by any of the developer's machine-to-machine credentials.

Endpoint: POST /v1/appointments/cancel
Version: 1.182
Security: ClientCredentialsFlow, AuthorizationCodeFlow

## Security:

  - `ClientCredentialsFlow` (unknown)
    oauth2 scopes: external.appointment.write

  - `AuthorizationCodeFlow` (unknown)
    oauth2 scopes: external.appointment.write

## Request fields (application/json):

  - `appointment_id` (string, required)
    The Zocdoc ID of the appointment.
    Example: d04b049a-41b1-4aba-9268-d8973cf72cdd

  - `cancellation_reason` (string)
    Optional free text description for the appointment cancellation. Only use this field when cancellation_reason_type is set to 'other_patient_reason' or 'other_provider_reason'.

  - `cancellation_reason_type` (string)
    Enum field describing why the appointment was cancelled. This field is optional but recommended when known for metrics purposes. If the cancellation reason does not match any predefined enum values, use 'other_patient_reason' or 'other_provider_reason' and provide a free text explanation in the cancellation_reason field.
    Enum: "patient_no_longer_needs_appointment", "patient_no_longer_available", "other_patient_reason", "missing_needed_patient_information", "payment_or_insurance_issue", "patient_or_visit_type_not_accepted", "provider_not_available", "rescheduling_patient", "other_provider_reason"

## Response 200:

  - `200` (unknown)
    Successful

## Response 200 fields (application/json):

  - `request_id` (string, required)
    Unique request identifier for tracing

  - `data` (object, required)
    Data that will be returned upon a sucessful booking request

  - `data.appointment_id` (string, required)
    The Zocdoc ID of the appointment.

  - `data.appointment_status` (string, required)
    The status of the appointment. See [Appointment Status definitions](/guides/glossary).
    Enum: "pending_booking", "confirmed", "booking_failed", "cancelled", "no_show", "pending_reschedule", "rescheduled", "reschedule_failed"

  - `data.developer_patient_id` (string)
    The patient identifier provided by 3P developer. Null if not provided.

## Response 400:

  - `400` (unknown)
    Bad request

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 404:

  - `404` (unknown)
    Not found

## Response 404 fields (application/json):

  - `request_id` (string, required)
    Unique request identifier for tracing

  - `error_type` (string, required)
    Enum: "api_error", "invalid_request"

  - `errors` (array, required)

  - `errors.field` (string)

  - `errors.message` (string, required)

## Response 409:

  - `409` (unknown)
    Conflict

## Response 409 fields (application/json):

  - `request_id` (string, required)
    Unique request identifier for tracing

  - `error_type` (string, required)
    Enum: "api_error", "invalid_request"

  - `errors` (array, required)

  - `errors.field` (string)

  - `errors.message` (string, required)

