> ## Documentation Index
> Fetch the complete documentation index at: https://developer.flabslis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Booking

> Cancels a booking you created, exactly as the lab's CRM does. Its status becomes `Cancelled`, and the reason and source ("Client API") appear in the booking's history.

- **When:** until the sample is collected. Once the booking is `Completed` (sample collected, bill raised) it can no longer be cancelled; a booking `In Progress` (phlebotomist on the way or at the door) can.
- **Assigned phlebotomist:** unassigned and notified that the visit is off.

Errors (the reason is in `error.details`):
- `400`: `reason` missing; or the booking is already cancelled, or completed.
- `404`: no such booking, or it is not one you created through this API.
- `409`: the booking was cancelled or completed while your request was in flight.

A retried cancel never cancels twice: the retry answers `400` or `409`, and `booking.cancelled` is sent once.



## OpenAPI

````yaml PUT /client/crm/booking/{leadId}/cancel
openapi: 3.0.3
info:
  title: Flabs CRM API
  version: 1.0.0
  description: >-
    Branches, corporates, tests, packages, and lead/booking ingestion for the
    Flabs CRM.
servers:
  - url: https://v2.flabs.in
    description: Production
security: []
paths:
  /client/crm/booking/{leadId}/cancel:
    put:
      summary: Cancel booking
      description: >-
        Cancels a booking you created, exactly as the lab's CRM does. Its status
        becomes `Cancelled`, and the reason and source ("Client API") appear in
        the booking's history.


        - **When:** until the sample is collected. Once the booking is
        `Completed` (sample collected, bill raised) it can no longer be
        cancelled; a booking `In Progress` (phlebotomist on the way or at the
        door) can.

        - **Assigned phlebotomist:** unassigned and notified that the visit is
        off.


        Errors (the reason is in `error.details`):

        - `400`: `reason` missing; or the booking is already cancelled, or
        completed.

        - `404`: no such booking, or it is not one you created through this API.

        - `409`: the booking was cancelled or completed while your request was
        in flight.


        A retried cancel never cancels twice: the retry answers `400` or `409`,
        and `booking.cancelled` is sent once.
      parameters:
        - name: leadId
          in: path
          required: true
          schema:
            type: string
          description: >-
            The `leadId` returned by [Create Lead or
            Booking](/crm/endpoint/create_lead).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - reason
              properties:
                reason:
                  type: string
                  description: >-
                    Why the booking is cancelled; shown in the lab's booking
                    history.
                notes:
                  type: string
                  description: Optional notes, shown in the booking history.
            example:
              reason: Patient cancelled
      responses:
        '200':
          description: Booking updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  leadId:
                    type: string
                  bookingStatus:
                    type: string
                    description: Booking status after the change, e.g. `Cancelled`.
                  scheduledAt:
                    type: string
                    format: date-time
              example:
                success: true
                leadId: 6530a4a6f1d2c8b7e9a54321
                bookingStatus: Cancelled
                scheduledAt: '2026-11-28T04:30:00.000Z'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
        - bearerAuth: []
components:
  responses:
    ClientError:
      description: Validation or auth error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            success: false
            status: 400
            message: Bad Request
            error:
              details: first_name is required
    ServerError:
      description: Unexpected server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            success: false
            status: 500
            message: Internal Server Error
            error:
              details: An unexpected error occurred
  schemas:
    ErrorBody:
      type: object
      properties:
        success:
          type: boolean
          example: false
        status:
          type: integer
        message:
          type: string
        error:
          type: object
          properties:
            details:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT obtained from `POST /client/auth/token`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.