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

# Run several operations in one request (batch)

> POST a FHIR `Bundle` with `type: batch` to send several requests in one round trip. Each entry's `request.url` is relative to this base and may be any read, search or operation of any service on it, except `$reconcile-medications`, which a batch refuses by name. Entries are independent: one that fails, such as a lookup of an unknown code, does not fail the others, and each carries its own status in the `batch-response`. For example, a batch of 50 terminology lookups measured about 4.8 ms per code, against 181 ms each when sent one at a time. Transaction bundles are not accepted: nothing on this base writes, so all or nothing would only turn one bad entry into a wholly failed request. A batch carries at most 100 entries in at most 1 MiB, and has 60 seconds: an entry still running then answers `504` inside the `200`. See https://docs.haau3.com/errors#limits.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/fhir/r4
openapi: 3.1.0
info:
  title: haau3 Platform API
  version: 1.0.0-preview.4
  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-01 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 error under
    `/v1/fhir` is a FHIR `OperationOutcome` and every other error an RFC 9457
    problem; 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: Scheduling
    description: 'Provider availability (SMART Scheduling Links): slots and publishers.'
  - 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: 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: Plan 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.
  - 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.
paths:
  /v1/fhir/r4:
    post:
      tags:
        - FHIR base
      summary: Run several operations in one request (batch)
      description: >-
        POST a FHIR `Bundle` with `type: batch` to send several requests in one
        round trip. Each entry's `request.url` is relative to this base and may
        be any read, search or operation of any service on it, except
        `$reconcile-medications`, which a batch refuses by name. Entries are
        independent: one that fails, such as a lookup of an unknown code, does
        not fail the others, and each carries its own status in the
        `batch-response`. For example, a batch of 50 terminology lookups
        measured about 4.8 ms per code, against 181 ms each when sent one at a
        time. Transaction bundles are not accepted: nothing on this base writes,
        so all or nothing would only turn one bad entry into a wholly failed
        request. A batch carries at most 100 entries in at most 1 MiB, and has
        60 seconds: an entry still running then answers `504` inside the `200`.
        See https://docs.haau3.com/errors#limits.
      operationId: fhirBatch
      parameters:
        - $ref: '#/components/parameters/XRequestId'
      requestBody:
        required: true
        content:
          application/fhir+json:
            schema:
              $ref: '#/components/schemas/Bundle'
            examples:
              Two lookups and a state's counties in one request:
                summary: Two lookups and a state's counties in one request
                value:
                  resourceType: Bundle
                  type: batch
                  entry:
                    - request:
                        method: GET
                        url: >-
                          CodeSystem/$lookup?system=http://loinc.org&code=2345-7&property=SHORTNAME
                    - request:
                        method: GET
                        url: >-
                          CodeSystem/$lookup?system=http://loinc.org&code=8867-4&property=SHORTNAME
                    - request:
                        method: GET
                        url: InsurancePlan/$counties?state=DE
      responses:
        '200':
          description: >-
            A FHIR `Bundle` with `type: batch-response`, one entry per request
            entry.
          content:
            application/fhir+json:
              schema:
                $ref: '#/components/schemas/Bundle'
              examples:
                Two lookups and a state's counties in one request:
                  summary: Two lookups and a state's counties in one request
                  value:
                    resourceType: Bundle
                    type: batch-response
                    entry:
                      - response:
                          status: '200'
                        resource:
                          resourceType: Parameters
                          parameter:
                            - name: code
                              valueCode: 2345-7
                            - name: system
                              valueString: http://loinc.org
                            - name: name
                              valueString: LOINC
                            - name: version
                              valueString: '2.83'
                            - name: display
                              valueString: Glucose [Mass/volume] in Serum or Plasma
                            - name: status
                              valueCode: active
                            - name: property
                              part:
                                - name: code
                                  valueCode: SHORTNAME
                                - name: value
                                  valueString: Glucose SerPl-mCnc
                      - response:
                          status: '200'
                        resource:
                          resourceType: Parameters
                          parameter:
                            - name: code
                              valueCode: 8867-4
                            - name: system
                              valueString: http://loinc.org
                            - name: name
                              valueString: LOINC
                            - name: version
                              valueString: '2.83'
                            - name: display
                              valueString: Heart rate
                            - name: status
                              valueCode: active
                            - name: property
                              part:
                                - name: code
                                  valueCode: SHORTNAME
                                - name: value
                                  valueString: Heart rate
                      - response:
                          status: '200'
                        resource:
                          resourceType: Parameters
                          parameter:
                            - name: county
                              part:
                                - name: code
                                  valueCoding:
                                    system: >-
                                      http://terminology.hl7.org/CodeSystem/FIPS64
                                    code: '10001'
                                    display: Kent County
                                - name: state
                                  valueString: DE
                            - name: county
                              part:
                                - name: code
                                  valueCoding:
                                    system: >-
                                      http://terminology.hl7.org/CodeSystem/FIPS64
                                    code: '10003'
                                    display: New Castle County
                                - name: state
                                  valueString: DE
                            - name: county
                              part:
                                - name: code
                                  valueCoding:
                                    system: >-
                                      http://terminology.hl7.org/CodeSystem/FIPS64
                                    code: '10005'
                                    display: Sussex County
                                - name: state
                                  valueString: DE
                            - name: source
                              valueString: >-
                                U.S. Census Bureau, 2020 FIPS codes for counties
                                and county equivalents:
                                https://www2.census.gov/geo/docs/reference/codes2020/national_county2020.txt
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            X-Correlation-Id:
              $ref: '#/components/headers/XCorrelationId'
        '400':
          description: >-
            The body was not a batch Bundle, it carried more than 100 entries
            (`too-long`), or the request carried a query parameter: a batch
            takes none, and each entry carries its own in its `request.url`.
          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'
        '406':
          $ref: '#/components/responses/FhirNotAcceptable'
        '413':
          description: >-
            The request body is over 1 MiB, the most this base reads from one
            request. Send a large batch as several smaller ones.
          content:
            application/fhir+json:
              schema:
                $ref: '#/components/schemas/OperationOutcome'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            X-Correlation-Id:
              $ref: '#/components/headers/XCorrelationId'
        '415':
          $ref: '#/components/responses/FhirUnsupportedMediaType'
        '429':
          $ref: '#/components/responses/FhirTooManyRequests'
        '500':
          $ref: '#/components/responses/FhirServerError'
        '503':
          $ref: '#/components/responses/FhirUnavailable'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |
            curl -X POST "https://api.haau3.com/v1/fhir/r4" \
              -H "Authorization: Bearer $HAAU3_API_KEY" \
              -H "Content-Type: application/fhir+json" \
              -d '{
                "resourceType": "Bundle",
                "type": "batch",
                "entry": [
                  {
                    "request": {
                      "method": "GET",
                      "url": "CodeSystem/$lookup?system=http://loinc.org&code=2345-7&property=SHORTNAME"
                    }
                  },
                  {
                    "request": {
                      "method": "GET",
                      "url": "CodeSystem/$lookup?system=http://loinc.org&code=8867-4&property=SHORTNAME"
                    }
                  },
                  { "request": { "method": "GET", "url": "InsurancePlan/$counties?state=DE" } }
                ]
              }'
        - lang: typescript
          label: TypeScript
          source: >
            import { Haau3 } from "@haau3/sdk";


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

            const results = await haau3.batch((b) => [
              b.codeSystemLookup({ system: "http://loinc.org", code: "2345-7", property: "SHORTNAME" }),
              b.codeSystemLookup({ system: "http://loinc.org", code: "8867-4", property: "SHORTNAME" }),
              b.listInsurancePlanCounties({ state: "DE" }),
            ]);

            for (const result of results) console.log(result.ok ? result.status
            : result.error.message);
        - lang: python
          label: Python
          source: |
            from haau3 import BatchOk, Haau3, calls

            client = Haau3()  # reads HAAU3_API_KEY
            results = client.batch(
                calls.code_system_lookup(system="http://loinc.org", code="2345-7", property="SHORTNAME"),
                calls.code_system_lookup(system="http://loinc.org", code="8867-4", property="SHORTNAME"),
                calls.list_insurance_plan_counties(state="DE"),
            )
            for result in results:
                print(result.status if isinstance(result, BatchOk) else result.error)
        - lang: go
          label: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\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\tentry1 := haau3.Calls.CodeSystemLookup(haau3.CodeSystemLookupParams{Code: \"2345-7\", System: new(\"http://loinc.org\"), Property: []string{\"SHORTNAME\"}})\n\tentry2 := haau3.Calls.CodeSystemLookup(haau3.CodeSystemLookupParams{Code: \"8867-4\", System: new(\"http://loinc.org\"), Property: []string{\"SHORTNAME\"}})\n\tentry3 := haau3.Calls.ListInsurancePlanCounties(haau3.ListInsurancePlanCountiesParams{State: \"DE\"})\n\tif err := client.Batch(ctx, []haau3.Entry{entry1, entry2, entry3}); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tshow(entry1.Result())\n\tshow(entry2.Result())\n\tshow(entry3.Result())\n}\n\n// show prints that one entry of the batch answered, or why it failed.\nfunc show[T any](_ T, err error) {\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Println(\"ok\")\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. A problem carries the same id as its
        `instance`.
      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'
    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'
    FhirUnsupportedMediaType:
      description: >-
        The request body was not sent as JSON: send `Content-Type:
        application/fhir+json`.
      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'
    FhirUnavailable:
      description: >-
        The API key could not be checked just now. Send the request again after
        `Retry-After`.
      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'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your platform API key (`haau3_sk_…`), sent as `Authorization: Bearer
        <key>`.

````

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