> ## 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.

# Slots and schedules

> Search open appointment slots from SMART Scheduling Links publishers as FHIR R4, each Slot with its Schedule, Location and provider in one Bundle.

Find open appointment slots across every SMART Scheduling Links publisher the platform aggregates:
by provider, place, service, specialty or time. You get back FHIR `Slot` resources, each as its
publisher published it, and, when you ask, each Slot's `Schedule` and the Location and provider the
Schedule names, in the same `Bundle`. To list providers at places instead, search `Schedule`.

Every parameter this service serves is declared in its `CapabilityStatement`. If you send one it
does not serve, you get a `400` naming it, so a search never comes back quietly unfiltered.

The open-source [SDKs](https://docs.haau3.com/sdks.md) for TypeScript, Python and Go call every operation of this service,
and each operation in the [API reference](https://docs.haau3.com/api-reference) has a sample in all three and in cURL.

Each SDK also has a search helper that sends every include a search serves, and a slot view that
hands you each Slot with its Schedule, Locations and provider side by side ([Slots and
schedules](https://docs.haau3.com/sdks.md#slots-and-schedules) on the SDKs page). Calls on this page are shown in cURL.

## Service base

```
https://api.haau3.com/v1/fhir/r4
```

Everything hangs off that base, exactly as the FHIR REST specification describes. `/v1/`
is the version of the haau3 platform API contract, **not** a FHIR version. The FHIR release is
`r4`, and every response says so:

```
Content-Type: application/fhir+json; fhirVersion=4.0
```

You never have to ask for a release. A plain `Accept: application/fhir+json`, or no `Accept`
header at all, works fine. If you do ask for one we do not serve, or for a format other than JSON
(in `Accept` or `_format`), you get a `406` rather than a silent substitution.

Every error on this base is a FHIR `OperationOutcome`, including the `401` you get without a key
and a `429`, so a FHIR client only ever has one error shape to parse.
[Errors, limits and request ids](https://docs.haau3.com/errors.md) lists the statuses every service shares.

> [!NOTE]
>
> The uppercase form `/v1/fhir/R4/...` redirects to the lowercase base with a `308`, which
> preserves the method and body so a POST is not quietly turned into a GET.

The [provider directory](https://docs.haau3.com/provider-directory/provider-directory.md), [Terminology
service](https://docs.haau3.com/terminology/terminology-service.md), [Medical Benefits](https://docs.haau3.com/benefits/medical.md) and the other
services use this same base and the same `CapabilityStatement`. How the aggregator gathers and
checks its publishers' feeds is on [SMART Scheduling Links](https://docs.haau3.com/scheduling/smart-scheduling-links.md).

## What is served

| Resource | Search | Read by id | Profile |
| - | - | - | - |
| `Slot` | yes | yes | SMART Scheduling Links `smart-scheduling-slot` |
| `Schedule` | yes | yes | SMART Scheduling Links `smart-scheduling-schedule` |
| `Location`, `Practitioner`, `PractitionerRole`, `HealthcareService` from a publisher | no | yes, by an id of the form `{Type}-scheduling-` and 32 hexadecimal characters | the publisher's |

A Slot and a Schedule have ids of 32 hexadecimal characters. A publisher's Location, Practitioner,
PractitionerRole or HealthcareService arrives as an included resource in a Slot or Schedule search
and is read by its id; searching those four types is the
[provider directory's](https://docs.haau3.com/provider-directory/provider-directory.md), and a publisher's records are not
merged with the directory's.

## Find slots

Slots of one provider, found by NPI, with each Slot's Schedule, its Location and the provider:

```bash theme={null}
curl -G -H "Authorization: Bearer $HAAU3_API_KEY" \
  "https://api.haau3.com/v1/fhir/r4/Slot" \
  --data-urlencode "provider-identifier=http://hl7.org/fhir/sid/us-npi|2900000227" \
  --data-urlencode "_include=Slot:schedule" \
  --data-urlencode "_include:iterate=Schedule:actor" \
  --data-urlencode "_include:iterate=PractitionerRole:practitioner" \
  --data-urlencode "_include:iterate=HealthcareService:location" \
  --data-urlencode "_count=1"
```

You get a `searchset` `Bundle`: the matching Slots (`search.mode` `match`) in order of start and
then id, then the resources you included (`search.mode` `include`), each once. `total` counts the
Slots only. The NPI above belongs to a test practitioner in haau3's own synthetic feed.

## Search parameters

| Parameter | Matches | Type |
| - | - | - |
| `status` | The Slot's status: `free`, `busy`, `busy-unavailable`, `busy-tentative` or `entered-in-error`. Another value is a `400`. | token |
| `start` | When the Slot starts, with `ge`, `gt`, `le` or `lt`, or none for that day, hour or minute. Send it twice for a window: `start=ge2026-12-01&start=lt2026-12-08`. A value with no time is a day in UTC; a time needs its offset (`Z` or `-05:00`). | date |
| `appointment-type` | The Slot's appointment type. | token |
| `schedule` | The Slot's Schedule: `Schedule/{id}`, its id, or its address on this base. | reference |
| `service-type` | The Slot's own `serviceType`. A Slot that names none matches no value. | token |
| `schedule.service-type` | The service type of the Slot's Schedule: every Slot of a Schedule offering it, whether or not the Slot names one of its own. | token |
| `specialty` | The Slot's own `specialty`. | token |
| `provider-specialty` | A specialty of the provider, wherever it is stated: by the Slot, by its Schedule (its own `specialty` or the SMART Scheduling Links `schedule-specialty` extension), or by the PractitionerRole or HealthcareService the Schedule names. | token |
| `provider-identifier` | Any identifier of the provider the Schedule names: a Practitioner, a PractitionerRole or the Practitioner behind it, or a HealthcareService. That includes an NPI and the publisher's own id for the provider, under its feed's address. | token |
| `patient-type` | 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 without the extension matches no value. | token |
| `location-address-city`, `location-address-state` | The start of the city or state of a Location the Schedule names, or of the Location of a HealthcareService it names, ignoring case and accents: `San Jose` finds San José. | string |
| `location-physical-type` | The `physicalType` of that Location: `vi` for a virtual one. | token |
| `_source` | The Slot's `meta.source`, exactly. `_source:below` matches its start: a feed's address, for every Slot it published. | uri |

A token takes any of FHIR's forms: `code`, `system|code`, `|code` (a code with no system) or
`system|` (any code in that system). Commas separate alternatives within one parameter, at most
100, and different parameters must all match. `_count` sets the page size, from 1 to 100, 25 by
default.

`provider-specialty`, `provider-identifier`, `patient-type`, `location-address-city`,
`location-address-state` and `location-physical-type` are haau3's own parameters, where FHIR R4 has
none or reaches the value by more than one path. The others mean exactly what FHIR R4 defines, and
`schedule.service-type` is FHIR's chained form of `schedule` and the Schedule's `service-type`, the
one chain served. Most publishers state a service type on the Schedule and a specialty on the
provider, not on each Slot, so `schedule.service-type` and `provider-specialty` are usually the ones
to send.

## Codes to search with

Two value sets on the [terminology service](https://docs.haau3.com/terminology/terminology-service.md#scheduling-value-sets)
list every code these searches can be sent, as the publishers send them. Expand one with
`ValueSet/$expand` to fill a pick-list, then send an entry as `system|code`:

| To search | Expand | Send to |
| - | - | - |
| Service types | `https://fhir.haau3.com/platform/ValueSet/scheduling-service-types` | `schedule.service-type` on a Slot search, `service-type` on a Schedule search |
| Specialties | `https://fhir.haau3.com/platform/ValueSet/scheduling-specialties` | `provider-specialty` |

```bash theme={null}
curl -G "https://api.haau3.com/v1/fhir/r4/ValueSet/\$expand" \
  -H "Authorization: Bearer $HAAU3_API_KEY" \
  --data-urlencode "url=https://fhir.haau3.com/platform/ValueSet/scheduling-specialties"
```

Each code stays in its publisher's own code system, and none is mapped to another, so a search
for one publisher's code finds that publisher's Slots. To reach several publishers, send several
codes, separated by commas. Every code comes back when `count` is not sent; a code with no system
is not listed, and a search still finds it as `|code`.

## When you say less

With no `status`, a search returns `free` Slots, and with no `start`, Slots starting from now.
Each applies on its own: `status=busy` still means from now. The `self` link shows both as the
search applied them. A Slot marked as not accepting patients is never served: no search returns
one, and a read of one answers `404`.

## Including the Schedule, Location and provider

| Send | Adds |
| - | - |
| `_include=Slot:schedule` | Each Slot's Schedule. |
| `_include:iterate=Schedule:actor` | Each included Schedule's Location, PractitionerRole, Practitioner or HealthcareService. |
| `_include:iterate=PractitionerRole:practitioner` | The Practitioner behind each included PractitionerRole. |
| `_include:iterate=HealthcareService:location` | The Location of each included HealthcareService. |

A Slot search's matches are Slots, so only `Slot:schedule` applies to them; the other three follow
what the Bundle already holds and are sent with `:iterate`. Sent without it, each returns a `400`
saying so. An include naming its target's type, such as `Schedule:actor:Location`, returns a `400`
naming the include to send, which brings every type. Any other include, and `_revinclude`, is
refused by name.

## Paging

For the next page, follow the `next` link exactly as it is given. Its `page` cursor is opaque and
belongs to the one search: sent with other parameters, it returns a `400`. Pages are cut by the last
Slot's start and id, so a page neither skips nor repeats a Slot when a feed changes between
requests. `_sort`, `_total`, `_summary` and `_elements` are refused by name.

## Find schedules

A `Schedule` is one provider at one place for one service: the thing a publisher's Slots belong to.
Schedules of one provider, found by NPI, with each Schedule's Location and provider:

```bash theme={null}
curl -G -H "Authorization: Bearer $HAAU3_API_KEY" \
  "https://api.haau3.com/v1/fhir/r4/Schedule" \
  --data-urlencode "provider-identifier=http://hl7.org/fhir/sid/us-npi|2900000227" \
  --data-urlencode "_include=Schedule:actor" \
  --data-urlencode "_include:iterate=PractitionerRole:practitioner" \
  --data-urlencode "_include:iterate=HealthcareService:location"
```

You get a `searchset` `Bundle`: the matching Schedules (`search.mode` `match`) in order of id, then
the resources you included, each once. `total` counts the Schedules only. Paging works as for Slots,
cut by the last Schedule's id.

**A Schedule search does not look at its Slots.** A Schedule matches whether or not it has a free
Slot ahead, and there is no slot count or next available time on it. To find open Slots, search
`Slot`, with `_include=Slot:schedule` for each one's Schedule; to list one Schedule's Slots, search
`Slot` with `schedule=Schedule/{id}`. `status`, `start`, `appointment-type`, `patient-type` and
`schedule` are a Slot's parameters, and on a Schedule search each returns a `400` saying so.

| Parameter | Matches | Type |
| - | - | - |
| `service-type` | The Schedule's own `serviceType`. | token |
| `specialty` | The Schedule's own `specialty`. | token |
| `provider-specialty` | A specialty of the provider, wherever it is stated: by the Schedule (its own `specialty` or the SMART Scheduling Links `schedule-specialty` extension), or by the PractitionerRole or HealthcareService it names. | token |
| `provider-identifier` | Any identifier of the provider the Schedule names, as on a Slot search. | token |
| `location-address-city`, `location-address-state` | The start of the city or state of a Location the Schedule names, or of the Location of a HealthcareService it names, ignoring case and accents. | string |
| `location-physical-type` | The `physicalType` of that Location: `vi` for a virtual one. | token |
| `_source` | The Schedule's `meta.source`, exactly. `_source:below` matches its start: a feed's address, for every Schedule it published. | uri |

| Send | Adds |
| - | - |
| `_include=Schedule:actor` | Each Schedule's Location, PractitionerRole, Practitioner or HealthcareService. |
| `_include:iterate=PractitionerRole:practitioner` | The Practitioner behind each included PractitionerRole. |
| `_include:iterate=HealthcareService:location` | The Location of each included HealthcareService. |

`service-type`, `specialty` and `_source` mean exactly what FHIR R4 defines; the others are
haau3's own. `actor`, `active` and `service-category` are not served, and each returns a `400`
saying what to send instead.

## Read one

```bash theme={null}
curl -H "Authorization: Bearer $HAAU3_API_KEY" \
  "https://api.haau3.com/v1/fhir/r4/Schedule/e859c18cc8cc1a6ab1c9b7b63c5c60a1"
```

A Slot is read the same way, at `Slot/{id}`, and a publisher's Location at
`Location/Location-scheduling-{32 hexadecimal characters}`, as an included resource's `fullUrl`
names it. A Slot is served while its publisher lists it, whatever its status or start.

## Several lookups in one request

Slot and Schedule searches and reads can be sent in a batch `Bundle` to the base, beside any other service's,
each entry answered as it would be alone. A batch carries at most 100 entries and has 60 seconds.
An entry's `503` carries no `Retry-After`: send that entry again after a few seconds.

## Errors

Every error is a FHIR `OperationOutcome`.

| Status | Meaning |
| - | - |
| `400` | A parameter this service does not serve (a Slot's own on a Schedule search among them), one sent more times than it takes, a value of the wrong form, an include sent without the `:iterate` it needs, or a `page` cursor from another search. The outcome names the parameter. |
| `404` | No Slot, Schedule or publisher's record has this id, or no such interaction on this base. |
| `503` | The scheduling store is down or did not answer in time: wait the seconds in `Retry-After`, then send the request again. Without `Retry-After`, Scheduling is not configured on this deployment. |

The statuses every service shares, among them `401`, `405`, `406`, `429` and `500`, are on
[Errors, limits and request ids](https://docs.haau3.com/errors.md).

**An empty result means no Slot or Schedule matched.** Its `total` is `0` and it has no `entry`,
as FHIR's JSON has no empty arrays. It never means the store could not be asked: then you get a
`503`.

## Data source

Every resource is a SMART Scheduling Links publisher's own, as it passed the guide's profiles, with
a new id, the publisher's own id kept in `identifier` under the address its feed is published at,
and that address with the type and id in `meta.source`. A reference to a resource not served here,
such as a publisher's Organization, points back to the publisher's feed. Each resource carries
`meta.lastUpdated`, when its content last changed, and the `lastSourceSync` extension on `meta`,
the last time its publisher's feed was confirmed current. Everything else on `meta` is the
publisher's, including a test-data label.

Scheduling data is about providers and their availability, never patients.


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