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

# Find slots

> Search open appointment slots from SMART Scheduling Links publishers. The answer is a FHIR `searchset` Bundle whose matches are Slots, each as its publisher published it (the guide's Slot profile), in order of start and then id. Each Slot's Schedule, and the Schedule's Location and provider, come in the same Bundle when asked for: `_include=Slot:schedule`, then `_include:iterate=Schedule:actor`, `_include:iterate=PractitionerRole:practitioner` and `_include:iterate=HealthcareService:location`. Each included resource comes once, and `total` counts the Slots only.

With no `status` a search returns `free` Slots, and with no `start` Slots starting from now; the `self` link shows both as applied. A Slot marked as not accepting patients is never served. Follow the `next` link to continue: its cursor belongs to the one search.

Every other parameter is refused by name rather than ignored, so a search never quietly answers a different question than the one asked. `_sort`, `_total`, `_summary`, `_elements` and `_revinclude` are not served.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/fhir/r4/Slot
openapi: 3.1.0
info:
  title: haau3 Platform API
  version: 1.0.0-preview.49
  description: >-
    The haau3 platform API is in preview: it may change as we build, usually to
    add features or improve performance. Endpoints require an API key, sent as
    `Authorization: Bearer <key>`. Requests without a valid key return 401.
    Create a key in the dashboard at https://platform.haau3.com; a new
    organization starts on the free Developer plan. From 2026-11-02 a request
    past one of its plan's limits (requests a minute on every plan, requests a
    month on Developer) returns 429 with `Retry-After`. Every service is on the
    FHIR R4 base at `/v1/fhir/r4`, and every error is a FHIR `OperationOutcome`;
    https://docs.haau3.com/errors lists every status, whether to retry it, and
    what a method a path does not take answers.
servers:
  - url: https://api.haau3.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: FHIR base
    description: >-
      What the FHIR R4 base at `/v1/fhir/r4` answers for every service on it:
      the `CapabilityStatement` that lists them all, and batch Bundles that
      carry several requests to any of them in one round trip.
  - name: Scheduling
    description: >-
      Provider availability from SMART Scheduling Links publishers: Slot and
      Schedule, searched and read, and the Location, Practitioner,
      PractitionerRole and HealthcareService they name.
  - name: Terminology
    description: >-
      FHIR terminology operations over the code systems listed in
      TerminologyCapabilities. Some are resolved from their own source when you
      ask; others are held here at a named release, which that resource also
      names.
  - name: Provider directory
    description: >-
      CMS's National Provider Directory as FHIR R4: practitioners and their
      roles, organizations, payers and insurance networks, network membership,
      healthcare services, locations and endpoints. Every parameter the service
      serves is declared here, and any other is refused by name rather than
      ignored.
  - name: Questionnaires
    description: >-
      FHIR Questionnaire, served as its source publishes it. This service holds
      copies of a curated set and reaches any other questionnaire its source
      publishes by canonical URL, as well as forms published at their own
      address under places this service is set up to reach. Read one by id, and
      build the QuestionnaireResponse in your own application.
  - name: Medical Benefits
    description: >-
      FHIR InsurancePlan: what a Medicare Advantage or ACA Marketplace plan
      covers and what a member pays, read from the files CMS publishes. Every
      plan names the CMS release it was read from. Read a plan by its id, or
      search by identifier, name, state or county, and check whether the CMS
      National Provider Directory lists providers in a plan's network. A
      Medicare Part D formulary and a Part D plan's drug plan are InsurancePlans
      too, read on the same path by their own forms of id, and counted as
      Pharmacy Benefits.
  - name: Pharmacy Benefits
    description: >-
      The CARIN Consumer Real-Time Pharmacy Benefit Check as FHIR messaging:
      what a medication would cost a member under their coverage, or its price
      at pharmacies near a ZIP code, in real time, from the sources this service
      connects to. A member's request receives patient data, so send it only
      under an executed agreement. And Medicare Part D from CMS's monthly file,
      in the shape of HL7's Da Vinci US Drug Formulary guide: which drugs each
      formulary lists, at which tier and with which limits, and each plan's drug
      plan, with what each tier costs.
  - name: MedList
    description: >-
      One reconciled medication list from one patient's FHIR medication records,
      as US Core MedicationRequests with a Provenance for each. This operation
      receives patient data, so send it only under an executed agreement.
  - name: Structured Sig
    description: >-
      A prescription's free-text directions as a FHIR Dosage: the dose, unit,
      route, method and timing coded in SNOMED CT, NCIt and UCUM where the words
      support them, the directions kept verbatim, and a review flag on anything
      a person should check. It takes the directions and the medication's
      codings, never a patient.
  - name: Sandbox
    description: >-
      The FHIR base without production behind it, to build and test against: the
      same paths at `/v1/sandbox/fhir/r4`, answered with synthetic data that
      always gives the same answer. Its first service is the CARIN Consumer
      Real-Time Pharmacy Benefit Check, answered by Example Health Plan, a test
      insurer. It takes a test key (`haau3_sk_test_…`), made on the API keys
      page. A test key's requests count toward its organization's requests a
      minute, apart from its production requests, and never toward the plan's
      month. Send test members only, never a real person.
paths:
  /v1/fhir/r4/Slot:
    get:
      tags:
        - Scheduling
      summary: Find slots
      description: >-
        Search open appointment slots from SMART Scheduling Links publishers.
        The answer is a FHIR `searchset` Bundle whose matches are Slots, each as
        its publisher published it (the guide's Slot profile), in order of start
        and then id. Each Slot's Schedule, and the Schedule's Location and
        provider, come in the same Bundle when asked for:
        `_include=Slot:schedule`, then `_include:iterate=Schedule:actor`,
        `_include:iterate=PractitionerRole:practitioner` and
        `_include:iterate=HealthcareService:location`. Each included resource
        comes once, and `total` counts the Slots only.


        With no `status` a search returns `free` Slots, and with no `start`
        Slots starting from now; the `self` link shows both as applied. A Slot
        marked as not accepting patients is never served. Follow the `next` link
        to continue: its cursor belongs to the one search.


        Every other parameter is refused by name rather than ignored, so a
        search never quietly answers a different question than the one asked.
        `_sort`, `_total`, `_summary`, `_elements` and `_revinclude` are not
        served.
      operationId: searchSlot
      parameters:
        - name: status
          in: query
          required: false
          description: >-
            The Slot's status: `free`, `busy`, `busy-unavailable`,
            `busy-tentative` or `entered-in-error`, several separated by commas.
            With no `status`, a search returns `free` Slots, and the `self` link
            shows it.
          schema:
            type: string
        - name: start
          in: query
          required: false
          style: form
          explode: true
          description: >-
            When the Slot starts, with a prefix `ge`, `gt`, `le` or `lt`, or
            none for that day, hour or minute:
            `start=ge2026-12-01&start=lt2026-12-08` for one week. Any precision
            from a year to a second; a value with no time is a day in UTC, and a
            time needs its offset (`Z` or `-05:00`). Send it twice for a window.
            With no `start`, a search returns Slots starting from now, and the
            `self` link shows the moment.
          schema:
            minItems: 1
            maxItems: 2
            type: array
            items:
              type: string
        - name: appointment-type
          in: query
          required: false
          description: >-
            The Slot's appointment type. Any of FHIR's token forms: `code`,
            `system|code`, `|code` (a code with no system) or `system|` (any
            code in that system), several separated by commas for any of them.
          schema:
            type: string
        - name: schedule
          in: query
          required: false
          description: >-
            The Slot's Schedule, as `Schedule/{id}`, its id alone, or its
            address on this base; several separated by commas. Chained once, as
            `schedule.service-type`.
          schema:
            type: string
        - name: service-type
          in: query
          required: false
          description: >-
            The Slot's own service type, FHIR's Slot.serviceType. A Slot that
            names none matches no value: find the Slots of a Schedule offering a
            service with `schedule.service-type`. Any of FHIR's token forms:
            `code`, `system|code`, `|code` (a code with no system) or `system|`
            (any code in that system), several separated by commas for any of
            them.
          schema:
            type: string
        - name: schedule.service-type
          in: query
          required: false
          description: >-
            The service type of the Slot's Schedule, FHIR's chained `schedule`
            and the Schedule's `service-type`: every Slot of a Schedule offering
            it, whether or not the Slot names a service type of its own. Any of
            FHIR's token forms: `code`, `system|code`, `|code` (a code with no
            system) or `system|` (any code in that system), several separated by
            commas for any of them.
          schema:
            type: string
        - name: specialty
          in: query
          required: false
          description: >-
            The Slot's own specialty, FHIR's Slot.specialty. For a specialty its
            Schedule or its provider states, use `provider-specialty`. Any of
            FHIR's token forms: `code`, `system|code`, `|code` (a code with no
            system) or `system|` (any code in that system), several separated by
            commas for any of them.
          schema:
            type: string
        - name: provider-specialty
          in: query
          required: false
          description: >-
            A specialty of the provider, as the Slot states it, as its Schedule
            does (its own `specialty` or the SMART Scheduling Links
            `schedule-specialty` extension), or as the provider itself does (a
            PractitionerRole or HealthcareService the Schedule names). Any of
            FHIR's token forms: `code`, `system|code`, `|code` (a code with no
            system) or `system|` (any code in that system), several separated by
            commas for any of them.
          schema:
            type: string
        - name: provider-identifier
          in: query
          required: false
          description: >-
            An identifier, such as an NPI
            (`http://hl7.org/fhir/sid/us-npi|1234567890`), of the provider the
            Slot's Schedule names: a Practitioner, a PractitionerRole or the
            Practitioner behind it, or a HealthcareService, whichever the
            publisher used. Any of FHIR's token forms: `code`, `system|code`,
            `|code` (a code with no system) or `system|` (any code in that
            system), several separated by commas for any of them.
          schema:
            type: string
          example: http://hl7.org/fhir/sid/us-npi|2900000227
        - name: patient-type
          in: query
          required: false
          description: >-
            Who the Slot accepts, from the SMART Scheduling Links `patient-type`
            extension: `newpt`, `existptonly` and the other codes of
            `http://terminology.hl7.org/CodeSystem/accepting-patients`. A Slot
            that carries none matches no value. A Slot not accepting patients
            (`nopt`) is never served. Any of FHIR's token forms: `code`,
            `system|code`, `|code` (a code with no system) or `system|` (any
            code in that system), several separated by commas for any of them.
          schema:
            type: string
        - name: location-address-city
          in: query
          required: false
          description: >-
            The city of a Location the Slot's Schedule names, or of the Location
            of a HealthcareService it names: the start of the city's name,
            ignoring case and accents: `San Jose` finds San José. Several
            separated by commas.
          schema:
            type: string
        - name: location-address-state
          in: query
          required: false
          description: >-
            The state of a Location the Slot's Schedule names, or of the
            Location of a HealthcareService it names, matched as
            `location-address-city` is.
          schema:
            type: string
        - name: location-physical-type
          in: query
          required: false
          description: >-
            The physicalType of a Location the Slot's Schedule names, or of the
            Location of a HealthcareService it names: `vi` for a virtual one,
            from `http://terminology.hl7.org/CodeSystem/location-physical-type`.
            Any of FHIR's token forms: `code`, `system|code`, `|code` (a code
            with no system) or `system|` (any code in that system), several
            separated by commas for any of them.
          schema:
            type: string
        - name: _source
          in: query
          required: false
          description: >-
            The Slot's `meta.source`: where the publisher published it, its
            feed's address followed by `Slot/` and the publisher's own id.
            Several separated by commas.
          schema:
            type: string
        - name: _source:below
          in: query
          required: false
          description: >-
            The start of the Slot's `meta.source`: a feed's address, for every
            Slot it published. Several separated by commas.
          schema:
            type: string
        - name: _include
          in: query
          required: false
          style: form
          explode: true
          description: >-
            `Slot:schedule` adds each Slot's Schedule to the Bundle. The
            Location and provider it names, and what they reach, come with
            `_include:iterate`.
          schema:
            minItems: 1
            maxItems: 4
            type: array
            items:
              type: string
              enum:
                - Slot:schedule
          example: Slot:schedule
        - name: _include:iterate
          in: query
          required: false
          style: form
          explode: true
          description: >-
            `Schedule:actor` adds each included Schedule's Location,
            PractitionerRole, Practitioner or HealthcareService;
            `PractitionerRole:practitioner` the Practitioner behind each
            included role; `HealthcareService:location` the Location of each
            included HealthcareService. Each needs `_include=Slot:schedule`.
          schema:
            minItems: 1
            maxItems: 4
            type: array
            items:
              type: string
              enum:
                - Slot:schedule
                - Schedule:actor
                - PractitionerRole:practitioner
                - HealthcareService:location
          example:
            - Schedule:actor
            - PractitionerRole:practitioner
            - HealthcareService:location
        - name: _count
          in: query
          required: false
          description: >-
            Page size, 1 to 100, 25 by default. A larger value is refused rather
            than quietly reduced.
          schema:
            default: 25
            type: integer
            minimum: 1
            maximum: 100
          example: 1
        - name: page
          in: query
          required: false
          description: >-
            The next page's cursor, from the `next` link of the page before. It
            is opaque and belongs to the one search; follow the link rather than
            building one.
          schema:
            type: string
        - $ref: '#/components/parameters/XRequestId'
      responses:
        '200':
          description: >-
            A `searchset` Bundle with `total` set: the matching Slots, then the
            resources `_include` asked for.
          content:
            application/fhir+json:
              schema:
                $ref: '#/components/schemas/Bundle'
              examples:
                Slots by a provider's NPI, with each Slot's Schedule, Location and provider:
                  summary: >-
                    Slots by a provider's NPI, with each Slot's Schedule,
                    Location and provider
                  value:
                    resourceType: Bundle
                    type: searchset
                    total: 141
                    link:
                      - relation: self
                        url: >-
                          https://api.haau3.com/v1/fhir/r4/Slot?status=free&start=ge2026-11-24T03%3A07%3A33Z&provider-identifier=http%3A%2F%2Fhl7.org%2Ffhir%2Fsid%2Fus-npi%7C2900000227&_include=Slot%3Aschedule&_include:iterate=Schedule%3Aactor&_include:iterate=PractitionerRole%3Apractitioner&_include:iterate=HealthcareService%3Alocation&_count=1
                      - relation: next
                        url: >-
                          https://api.haau3.com/v1/fhir/r4/Slot?status=free&start=ge2026-11-24T03%3A07%3A33Z&provider-identifier=http%3A%2F%2Fhl7.org%2Ffhir%2Fsid%2Fus-npi%7C2900000227&_include=Slot%3Aschedule&_include:iterate=Schedule%3Aactor&_include:iterate=PractitionerRole%3Apractitioner&_include:iterate=HealthcareService%3Alocation&_count=1&page=eyJ2IjoxLCJrIjpbIjIwMjYtMTEtMjRUMTM6MDA6MDAuMDAwMDAwWiIsIjE0YTQ4OWU4ODg4ZGYzNGQ1MmVjOGUwNDhlNjFiZGM5Il0sInMiOiIzYjQwZmExOTZlOTg1MTkzIn0
                    entry:
                      - fullUrl: >-
                          https://api.haau3.com/v1/fhir/r4/Slot/14a489e8888df34d52ec8e048e61bdc9
                        resource:
                          id: 14a489e8888df34d52ec8e048e61bdc9
                          end: '2026-11-24T09:00:00-05:00'
                          meta:
                            source: >-
                              https://api.haau3.com/scheduling/Slot/slot-haau3-rad-20261124-0800
                            security:
                              - code: HTEST
                                system: >-
                                  http://terminology.hl7.org/CodeSystem/v3-ActReason
                                display: test health data
                            extension:
                              - url: >-
                                  http://hl7.org/fhir/StructureDefinition/lastSourceSync
                                valueDateTime: '2026-11-24T00:01:47.571Z'
                            lastUpdated: '2026-11-23T03:58:56.265Z'
                          start: '2026-11-24T08:00:00-05:00'
                          status: free
                          schedule:
                            reference: Schedule/e859c18cc8cc1a6ab1c9b7b63c5c60a1
                          extension:
                            - url: >-
                                http://hl7.org/fhir/uv/smart-scheduling-links/StructureDefinition/patient-type
                              valueCoding:
                                code: existptonly
                                system: >-
                                  http://terminology.hl7.org/CodeSystem/accepting-patients
                            - url: >-
                                http://hl7.org/fhir/uv/smart-scheduling-links/StructureDefinition/booking-deep-link
                              valueUrl: >-
                                https://docs.haau3.com/scheduling/slot-publisher?slot=slot-haau3-rad-20261124-0800
                            - url: >-
                                http://hl7.org/fhir/uv/smart-scheduling-links/StructureDefinition/booking-phone
                              valueContactPoint:
                                value: +1-617-555-0100
                                system: phone
                          identifier:
                            - value: slot-haau3-rad-20261124-0800
                              system: https://api.haau3.com/scheduling/
                          resourceType: Slot
                        search:
                          mode: match
                      - fullUrl: >-
                          https://api.haau3.com/v1/fhir/r4/Location/Location-scheduling-a6c987ccde51c74f24d100fffbc7124d
                        resource:
                          id: Location-scheduling-a6c987ccde51c74f24d100fffbc7124d
                          meta:
                            source: >-
                              https://api.haau3.com/scheduling/Location/loc-haau3-imaging
                            security:
                              - code: HTEST
                                system: >-
                                  http://terminology.hl7.org/CodeSystem/v3-ActReason
                                display: test health data
                            extension:
                              - url: >-
                                  http://hl7.org/fhir/StructureDefinition/lastSourceSync
                                valueDateTime: '2026-11-24T00:01:47.571Z'
                            lastUpdated: '2026-11-23T03:58:55.936Z'
                          name: haau3 Cambridge Imaging Center
                          status: active
                          address:
                            city: Cambridge
                            line:
                              - 55 Kendall Square
                            state: MA
                            postalCode: '02142'
                          telecom:
                            - value: +1-617-555-0188
                              system: phone
                            - value: https://haau3.com/locations/imaging
                              system: url
                          position:
                            latitude: 42.362611
                            longitude: -71.0876102
                          identifier:
                            - value: loc-haau3-imaging
                              system: https://haau3.com/synthetic/location
                            - value: loc-haau3-imaging
                              system: https://api.haau3.com/scheduling/
                          description: Ground floor, with a step-free entrance.
                          physicalType:
                            coding:
                              - code: ph
                                system: >-
                                  http://hl7.org/fhir/uv/smart-scheduling-links/CodeSystem/temporary
                                display: Physical
                          resourceType: Location
                        search:
                          mode: include
                      - fullUrl: >-
                          https://api.haau3.com/v1/fhir/r4/Practitioner/Practitioner-scheduling-9e042d6421d98d92b6944395e7d1ae8d
                        resource:
                          id: >-
                            Practitioner-scheduling-9e042d6421d98d92b6944395e7d1ae8d
                          meta:
                            source: >-
                              https://api.haau3.com/scheduling/Practitioner/sample-dr-wei-example
                            profile:
                              - >-
                                http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner
                              - >-
                                http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner|6.1.0
                            security:
                              - code: HTEST
                                system: >-
                                  http://terminology.hl7.org/CodeSystem/v3-ActReason
                                display: test health data
                            extension:
                              - url: >-
                                  http://hl7.org/fhir/StructureDefinition/lastSourceSync
                                valueDateTime: '2026-11-24T00:01:47.571Z'
                            lastUpdated: '2026-11-23T03:58:55.936Z'
                          name:
                            - text: Dr. Wei Example
                              given:
                                - Wei
                              family: Example
                              prefix:
                                - Dr.
                          active: true
                          gender: female
                          extension:
                            - url: >-
                                http://hl7.org/fhir/us/core/StructureDefinition/us-core-race
                              extension:
                                - url: ombCategory
                                  valueCoding:
                                    code: 2028-9
                                    system: urn:oid:2.16.840.1.113883.6.238
                                    display: Asian
                                - url: text
                                  valueString: Asian
                            - url: >-
                                http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity
                              extension:
                                - url: ombCategory
                                  valueCoding:
                                    code: 2186-5
                                    system: urn:oid:2.16.840.1.113883.6.238
                                    display: Not Hispanic or Latino
                                - url: text
                                  valueString: Not Hispanic or Latino
                          identifier:
                            - value: sample-dr-wei-example
                              system: https://haau3.com/synthetic/practitioner
                            - value: '2900000227'
                              system: http://hl7.org/fhir/sid/us-npi
                            - value: sample-dr-wei-example
                              system: https://api.haau3.com/scheduling/
                          resourceType: Practitioner
                          communication:
                            - text: English
                              coding:
                                - code: en
                                  system: urn:ietf:bcp:47
                                  display: English
                            - text: Chinese
                              coding:
                                - code: zh
                                  system: urn:ietf:bcp:47
                                  display: Chinese
                          qualification:
                            - code:
                                text: Doctor of Medicine
                                coding:
                                  - code: MD
                                    system: >-
                                      http://terminology.hl7.org/CodeSystem/v2-0360
                                    display: Doctor of Medicine
                        search:
                          mode: include
                      - fullUrl: >-
                          https://api.haau3.com/v1/fhir/r4/PractitionerRole/PractitionerRole-scheduling-c56a5082f9e86dd25a0325e925d6bf82
                        resource:
                          id: >-
                            PractitionerRole-scheduling-c56a5082f9e86dd25a0325e925d6bf82
                          meta:
                            source: >-
                              https://api.haau3.com/scheduling/PractitionerRole/prole-haau3-radiology
                            security:
                              - code: HTEST
                                system: >-
                                  http://terminology.hl7.org/CodeSystem/v3-ActReason
                                display: test health data
                            extension:
                              - url: >-
                                  http://hl7.org/fhir/StructureDefinition/lastSourceSync
                                valueDateTime: '2026-11-24T00:01:47.571Z'
                            lastUpdated: '2026-11-23T03:58:55.936Z'
                          active: true
                          location:
                            - reference: >-
                                Location/Location-scheduling-a6c987ccde51c74f24d100fffbc7124d
                          specialty:
                            - text: Diagnostic Radiology Physician
                              coding:
                                - code: 2085R0202X
                                  system: http://nucc.org/provider-taxonomy
                                  display: Diagnostic Radiology Physician
                          identifier:
                            - value: prole-haau3-radiology
                              system: https://api.haau3.com/scheduling/
                          practitioner:
                            display: Dr. Wei Example
                            reference: >-
                              Practitioner/Practitioner-scheduling-9e042d6421d98d92b6944395e7d1ae8d
                          resourceType: PractitionerRole
                        search:
                          mode: include
                      - fullUrl: >-
                          https://api.haau3.com/v1/fhir/r4/Schedule/e859c18cc8cc1a6ab1c9b7b63c5c60a1
                        resource:
                          id: e859c18cc8cc1a6ab1c9b7b63c5c60a1
                          meta:
                            source: >-
                              https://api.haau3.com/scheduling/Schedule/sched-haau3-radiology
                            security:
                              - code: HTEST
                                system: >-
                                  http://terminology.hl7.org/CodeSystem/v3-ActReason
                                display: test health data
                            extension:
                              - url: >-
                                  http://hl7.org/fhir/StructureDefinition/lastSourceSync
                                valueDateTime: '2026-11-24T00:01:47.571Z'
                            lastUpdated: '2026-11-23T03:58:55.936Z'
                          actor:
                            - reference: >-
                                Location/Location-scheduling-a6c987ccde51c74f24d100fffbc7124d
                            - reference: >-
                                PractitionerRole/PractitionerRole-scheduling-c56a5082f9e86dd25a0325e925d6bf82
                          identifier:
                            - value: sched-haau3-radiology
                              system: https://api.haau3.com/scheduling/
                          serviceType:
                            - text: Diagnostic Radiology/Xray/CT/Fluoroscopy
                              coding:
                                - code: '209'
                                  system: >-
                                    http://terminology.hl7.org/CodeSystem/service-type
                                  display: Diagnostic Radiology/Xray/CT/Fluoroscopy
                          resourceType: Schedule
                        search:
                          mode: include
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            X-Correlation-Id:
              $ref: '#/components/headers/XCorrelationId'
        '400':
          description: >-
            A parameter this service does not serve, a parameter sent more times
            than it takes, a value of the wrong form, an include sent without
            the `:iterate` it needs, or a page that is not this search's. One
            issue per offending parameter, naming it.
          content:
            application/fhir+json:
              schema:
                $ref: '#/components/schemas/OperationOutcome'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            X-Correlation-Id:
              $ref: '#/components/headers/XCorrelationId'
        '401':
          $ref: '#/components/responses/FhirUnauthorized'
        '403':
          $ref: '#/components/responses/FhirForbiddenTestKey'
        '404':
          description: No such interaction on this base.
          content:
            application/fhir+json:
              schema:
                $ref: '#/components/schemas/OperationOutcome'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            X-Correlation-Id:
              $ref: '#/components/headers/XCorrelationId'
        '406':
          $ref: '#/components/responses/FhirNotAcceptable'
        '429':
          $ref: '#/components/responses/FhirTooManyRequests'
        '500':
          $ref: '#/components/responses/FhirServerError'
        '503':
          description: >-
            The scheduling store is down or did not answer in time: send the
            request again after `Retry-After`. Also the answer, with no
            `Retry-After`, when Scheduling is not configured on this deployment.
            Never reported as an empty result. It is also the answer when the
            API key could not be checked just now, with `Retry-After`.
          content:
            application/fhir+json:
              schema:
                $ref: '#/components/schemas/OperationOutcome'
          headers:
            Retry-After:
              description: >-
                Sent when waiting will help: the API key could not be checked
                just now, or the source behind this service is rate limiting
                requests or did not answer. How many seconds to wait before
                sending the request again.
              schema:
                type: integer
                minimum: 0
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            X-Correlation-Id:
              $ref: '#/components/headers/XCorrelationId'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >
            curl
            "https://api.haau3.com/v1/fhir/r4/Slot?provider-identifier=http://hl7.org/fhir/sid/us-npi%7C2900000227&_include=Slot:schedule&_include:iterate=Schedule:actor&_include:iterate=PractitionerRole:practitioner&_include:iterate=HealthcareService:location&_count=1"
            \
              -H "Authorization: Bearer $HAAU3_API_KEY"
        - lang: typescript
          label: TypeScript
          source: >
            import { Haau3 } from "@haau3/sdk";


            const haau3 = new Haau3(); // reads HAAU3_API_KEY

            // Open appointment slots of one provider, found by NPI, each with
            its schedule, location and provider.

            const page = await haau3.searchSlotWithIncludes({
              "provider-identifier": "http://hl7.org/fhir/sid/us-npi|2900000227",
              _count: 1,
            });

            const [view] = haau3.slotViews(page);

            // A name's text, or its given and family names when the publisher
            sent no text.

            const name = view?.practitioners[0]?.name?.[0];

            console.log(
              view
                ? {
                    start: view.slot.start,
                    practitioner: name?.text ?? ([name?.given?.join(" "), name?.family].filter(Boolean).join(" ") || undefined),
                    location: view.locations[0]?.name,
                    bookingLink: view.bookingLink,
                  }
                : "No open slots matched.",
            );
        - lang: python
          label: Python
          source: >
            import json


            from haau3 import Haau3


            client = Haau3()  # reads HAAU3_API_KEY

            # Open appointment slots of one provider, found by NPI, each with
            its schedule, location and provider.

            page =
            client.search_slot_with_includes(provider_identifier="http://hl7.org/fhir/sid/us-npi|2900000227",
            count=1)

            views = client.slot_views(page)

            if views:
                view = views[0]
                # A name's text, or its given and family names when the publisher sent no text.
                names = [
                    name.get("text") or " ".join([*name.get("given", []), name.get("family", "")]).strip() or None
                    for practitioner in view.practitioners
                    for name in practitioner.get("name", [])
                ]
                places = [location.get("name") for location in view.locations]
                print(
                    json.dumps(
                        {
                            "start": view.slot.get("start"),
                            "practitioner": names[0] if names else None,
                            "location": places[0] if places else None,
                            "booking_link": view.booking_link,
                        },
                        indent=2,
                    )
                )
            else:
                print("No open slots matched.")
        - lang: go
          label: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/haau3/haau3-go\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclient, err := haau3.NewClient() // reads HAAU3_API_KEY\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// Open appointment slots of one provider, found by NPI, each with its schedule, location and provider.\n\tpage, err := client.SearchSlotWithIncludes(ctx, haau3.SearchSlotWithIncludesParams{ProviderIdentifier: new(\"http://hl7.org/fhir/sid/us-npi|2900000227\"), Count: new(1)})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tviews, err := haau3.SlotViews(page)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif len(views) == 0 {\n\t\tfmt.Println(\"No open slots matched.\")\n\t\treturn\n\t}\n\tview := views[0]\n\tslot := struct {\n\t\tStart        *string `json:\"start\"`\n\t\tPractitioner *string `json:\"practitioner,omitempty\"`\n\t\tLocation     *string `json:\"location,omitempty\"`\n\t\tBookingLink  string  `json:\"bookingLink,omitempty\"`\n\t}{Start: view.Slot.Start, BookingLink: view.BookingLink}\n\tif len(view.Practitioners) > 0 && len(view.Practitioners[0].Name) > 0 {\n\t\t// A name's text, or its given and family names when the publisher sent no text.\n\t\tname := view.Practitioners[0].Name[0]\n\t\tparts := append([]string{}, name.Given...)\n\t\tif name.Family != nil {\n\t\t\tparts = append(parts, *name.Family)\n\t\t}\n\t\tjoined := strings.TrimSpace(strings.Join(parts, \" \"))\n\t\tswitch {\n\t\tcase name.Text != nil:\n\t\t\tslot.Practitioner = name.Text\n\t\tcase joined != \"\":\n\t\t\tslot.Practitioner = &joined\n\t\t}\n\t}\n\tif len(view.Locations) > 0 {\n\t\tslot.Location = view.Locations[0].Name\n\t}\n\tout := json.NewEncoder(os.Stdout)\n\tout.SetEscapeHTML(false)\n\tout.SetIndent(\"\", \"  \")\n\tif err := out.Encode(slot); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n"
components:
  parameters:
    XRequestId:
      name: X-Request-Id
      in: header
      required: false
      schema:
        type: string
        format: uuid
      description: >-
        An id of your own for this request, as a UUID. It comes back in the
        `X-Correlation-Id` header and is kept with haau3's record of the
        request. Any value that is not a UUID is ignored. See
        https://docs.haau3.com/errors#request-ids.
  schemas:
    Bundle:
      type: object
      description: A FHIR R4 [Bundle](https://hl7.org/fhir/R4/bundle.html).
      properties:
        resourceType:
          type: string
          const: Bundle
        type:
          type: string
        entry:
          type: array
          items:
            type: object
            additionalProperties: true
      required:
        - resourceType
      additionalProperties: true
    OperationOutcome:
      type: object
      description: >-
        A FHIR R4
        [OperationOutcome](https://hl7.org/fhir/R4/operationoutcome.html).
      properties:
        resourceType:
          type: string
          const: OperationOutcome
        issue:
          type: array
          items:
            type: object
            properties:
              severity:
                type: string
                enum:
                  - fatal
                  - error
                  - warning
                  - information
              code:
                type: string
              details:
                type: object
                properties:
                  text:
                    type: string
                additionalProperties: true
              diagnostics:
                type: string
              expression:
                type: array
                items:
                  type: string
            required:
              - severity
              - code
            additionalProperties: true
      required:
        - resourceType
        - issue
  headers:
    XRequestId:
      description: >-
        The id haau3 gave this request, a UUID, on every response. Quote it in a
        question about the response.
      schema:
        type: string
        format: uuid
    XCorrelationId:
      description: The `X-Request-Id` you sent, when it was a UUID.
      schema:
        type: string
        format: uuid
  responses:
    FhirUnauthorized:
      description: Missing or invalid API key.
      content:
        application/fhir+json:
          schema:
            $ref: '#/components/schemas/OperationOutcome'
      headers:
        WWW-Authenticate:
          description: >-
            The scheme to authenticate with: `Bearer realm="api.haau3.com"`,
            with `error="invalid_token"` when a key was sent and not recognised.
          schema:
            type: string
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        X-Correlation-Id:
          $ref: '#/components/headers/XCorrelationId'
    FhirForbiddenTestKey:
      description: >-
        A test key (`haau3_sk_test_…`) works only in the Sandbox, so one sent
        here is refused before the request runs: coded `forbidden`, with
        `test-key-outside-sandbox` from
        `https://haau3.com/fhir/CodeSystem/api-error` in `issue.details.coding`.
        Send a live key.
      headers:
        WWW-Authenticate:
          description: >-
            Sent when the API key works only in the other mode: `Bearer
            realm="api.haau3.com", error="insufficient_scope"`.
          schema:
            type: string
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        X-Correlation-Id:
          $ref: '#/components/headers/XCorrelationId'
      content:
        application/fhir+json:
          schema:
            $ref: '#/components/schemas/OperationOutcome'
          examples:
            A test key outside the Sandbox:
              summary: A test key outside the Sandbox
              value:
                resourceType: OperationOutcome
                issue:
                  - severity: error
                    code: forbidden
                    details:
                      coding:
                        - system: https://haau3.com/fhir/CodeSystem/api-error
                          code: test-key-outside-sandbox
                          display: Test key outside the Sandbox
                      text: >-
                        This is a test key, which works only in the Sandbox
                        (https://api.haau3.com/v1/sandbox/fhir/r4). Send this
                        request with a live key; create one in the dashboard.
                        See
                        https://docs.haau3.com/authentication#test-and-live-keys
    FhirNotAcceptable:
      description: >-
        The request asked for a format other than JSON (`Accept` or `_format`),
        or for a FHIR release this endpoint does not serve (the `fhirVersion`
        media-type parameter).
      content:
        application/fhir+json:
          schema:
            $ref: '#/components/schemas/OperationOutcome'
      headers:
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        X-Correlation-Id:
          $ref: '#/components/headers/XCorrelationId'
    FhirTooManyRequests:
      description: >-
        A limit of the organization's plan was reached: its requests a minute,
        or the Developer plan's requests a month. Send the request again after
        `Retry-After`, which for the monthly limit runs to the 1st of the next
        month (UTC).
      content:
        application/fhir+json:
          schema:
            $ref: '#/components/schemas/OperationOutcome'
      headers:
        Retry-After:
          description: How many seconds to wait before sending the request again.
          schema:
            type: integer
            minimum: 0
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        X-Correlation-Id:
          $ref: '#/components/headers/XCorrelationId'
    FhirServerError:
      description: The server failed to process this request.
      content:
        application/fhir+json:
          schema:
            $ref: '#/components/schemas/OperationOutcome'
      headers:
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        X-Correlation-Id:
          $ref: '#/components/headers/XCorrelationId'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: haau3_sk_live_…
      description: >-
        A live platform API key (`haau3_sk_live_…`), sent as `Authorization:
        Bearer <key>`. It works for every service outside the Sandbox. Create
        one on the API keys page at https://platform.haau3.com.

````

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