> ## Documentation Index
> Fetch the complete documentation index at: https://hmis-docs.derrickmugabwa.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Book an appointment

> Derives the patient from the token, rechecks slot capacity under lock, and requires an Idempotency-Key header.



## OpenAPI

````yaml /openapi-patient.yaml post /patient/appointments
openapi: 3.1.0
info:
  title: HMIS Patient Mobile API
  version: 1.0.0
  description: >-
    Patient-owned authentication, appointment, clinical record, and billing
    operations.
servers:
  - url: https://jaliprohmis.derrickmugabwa.dev/api/v1
    description: HMIS staging API
security:
  - bearerAuth: []
tags:
  - name: Patient authentication
  - name: Patient profile
  - name: Patient appointments
  - name: Patient records
  - name: Patient billing
paths:
  /patient/appointments:
    post:
      tags:
        - Patient appointments
      summary: Book an appointment
      description: >-
        Derives the patient from the token, rechecks slot capacity under lock,
        and requires an Idempotency-Key header.
      operationId: createPatientAppointment
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            maxLength: 100
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AppointmentCreateRequest'
      responses:
        '201':
          $ref: '#/components/responses/ObjectResponse'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    AppointmentCreateRequest:
      type: object
      required:
        - clinic_id
        - appointment_date
        - clinic_schedule_slot_id
      properties:
        clinic_id:
          type: integer
        appointment_date:
          type: string
          format: date
        clinic_schedule_slot_id:
          type: integer
        reason:
          type:
            - string
            - 'null'
          maxLength: 2000
    ObjectEnvelope:
      type: object
      properties:
        data:
          type: object
          additionalProperties: true
  responses:
    ObjectResponse:
      description: Patient-owned resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ObjectEnvelope'
    Unauthenticated:
      description: Missing, expired, or invalid bearer token.
    Forbidden:
      description: Token lacks the required patient ability or the account is inactive.
    ValidationError:
      description: Request validation failed.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Sanctum patient device token

````