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

# Get orders

> List mode is available in sandbox for integration testing.

One endpoint, two questions.

**Lookup** — send `orderId` **or** `placerId` (one, not both): the full **OrderStatus** — lifecycle, kit shipping, lab receipt, report readiness, open exceptions, and cancellation information when available. **WIP:** cancellation eligibility and fee preview are not available yet; `cancellation` is currently null except for orders already known to be cancelled. The [Cancel endpoint](/api-reference/orders/cancel) is available.

**List** — send any combination of `patientId` and `from`/`to`, or no filters at all: pages of order summaries for your clinic, **including orders placed through the Vibrant Portal**. Portal-placed rows have `null` `orderId`/`placerId` — anchor on `accessionId`, which is the id the Report endpoint takes.

Mixing lookup and list parameters is a `400`.

**Cancellation:** when the order's top-level `status` is `cancelled`, the whole order is terminal. Stop waiting for or polling results regardless of nested `report.status` or progress counts. The Report endpoint also uses a top-level `cancelled` status; you do not need to query both endpoints to confirm cancellation.

[Webhooks](/concepts/webhooks) notify you of order, kit, and report changes for every order of your clinic, including Portal-created orders. Webhook events use their own status values, not the values returned here, and identify the order only by a string accessionId. **WIP — coming soon:** looking up an order by accessionId, for orders placed through this API. An order placed in the Vibrant Portal returns `403` with `not_placed_via_api`; an order of another clinic returns `404`.

> [!NOTE]
>
> **List mode is available in sandbox.** Query a patient's order history for integration testing.

One endpoint, two questions:

| Mode | You send | You get |
| :- | :- | :- |
| **[Lookup](#look-up-one-order)** | `?orderId=` **or** `?placerId=` | The full [order status](#one-status-four-things) — one object |
| **[List](#list-orders)** | `?patientId=`, `?from=`/`?to=`, any mix — or nothing | Pages of order summaries — one patient's history, or the whole clinic |

Mixing lookup and list parameters is a `400`.

## Look up one order

Look up an order's lifecycle, kit shipping details, lab receipt, report readiness, and open
exceptions. Cancellation information is returned when available; see
[Cancellation preview](#cancellation-preview).

The identifier is the `orderId` from [Place an order](https://developers.vibrant-wellness.com/api-reference/orders/place.md) **or your own
`placerId`** — auto-detected, the same way the Report endpoint accepts a barcode or a `sampleId`.

### Why this exists

Use a lookup to track an existing order or check its state after a placement request times out.
If you retry placement, reuse the same `placerId`.

### Look up by `accessionId`

> [!NOTE]
>
> **WIP — coming soon.** This lookup is not available yet, and its shape may change.

`GET /orders?accessionId=2508088888` will look up an order by the `accessionId` that
[webhook](https://developers.vibrant-wellness.com/concepts/webhooks.md) events carry. Send exactly one of `orderId`, `placerId`, or
`accessionId`.

For now, it covers only orders placed through this API:

| The order | Response |
| :- | :- |
| Placed through this API, in your clinic | `200` with the order status, the same as an `orderId` or `placerId` lookup |
| Placed in the Vibrant Portal, in your clinic | `403` with `error.code: "not_placed_via_api"` |
| In another clinic, or not found | `404`, the same as the other lookups |

```json 403 theme={null}
{
  "error": {
    "code": "not_placed_via_api",
    "message": "This order was not placed through the API. Only orders placed through the API can be looked up or cancelled with the API.",
    "requestId": "req_01JQ8ZC5X9K2MN"
  }
}
```

For an order placed in the Portal, use its `accessionId` with the
[Report endpoint](https://developers.vibrant-wellness.com/api-reference/reports/get.md).

### One status, four things

| Block | Answers |
| :- | :- |
| `status` | Where the order is: `placed` → `kit_shipped` → `kit_delivered` → `sample_in_transit` → `sample_received` → `analyzing` → `report_available` (or `cancelled`). |
| `kit` | Kit shipping status, carrier, tracking number, and scan times. `null` when shipping details are unavailable. |
| `lab` | Has the lab received the sample? **`sample_received` is the point of no return** for cancellation. |
| `report` | Report readiness: `registered`, `preliminary`, `final`, or `unknown`, plus generated and total report counts. Use the order's top-level `status` for cancellation. |
| `exceptions` | Anything holding it up — redraw, waiver, questionnaire. Vibrant resolves these automatically; see [Exceptions](https://developers.vibrant-wellness.com/concepts/exceptions.md). |
| `cancellation` | Cancellation information when available. Eligibility and fee preview remain WIP; see [Cancellation preview](#cancellation-preview). |

### Placement status

A lookup can also return these values in the order's top-level `status`:

| Status | Meaning and next step |
| :- | :- |
| `processing` | Placement has not completed. Query again; if you retry placement, reuse the same `placerId`. |
| `rejected` | The placement request was rejected. Correct the request and retry with the same `placerId`. |
| `failed` | Placement failed. Retry with the same `placerId`. |
| `dry_run` | A placement record created in dry-run mode. |

### Kit shipping details

When available, `kit` contains these five fields:

| Field | Meaning |
| :- | :- |
| `status` | `not_shipped`, `shipped`, `in_transit`, or `delivered`. |
| `carrier` | Carrier name, e.g. FedEx or DHL. |
| `trackingNumber` | Tracking number for the shipment. |
| `shippedAt` | UTC timestamp of the carrier's pickup scan. |
| `deliveredAt` | UTC timestamp of the carrier's delivery scan; `null` until delivered. |

When `kit.status` is `not_shipped`, `carrier`, `shippedAt`, and `deliveredAt` are `null`.
If carrier tracking details are unavailable, `carrier` and `deliveredAt` may also be `null`.

> [!NOTE]
>
> Shipping details are not available in sandbox, so `kit` is always `null`. Coming soon: orders
> moved by the [order simulator](https://developers.vibrant-wellness.com/platform/sandbox-simulator.md) will include them.

### Cancellation status

When the order's top-level `status` is `cancelled`, the whole order is terminal. Stop waiting for
or polling results, regardless of the nested `report.status` or progress counts. For example,
`report.status: "registered"` does not mean that results are still pending on a cancelled order.

The [Report endpoint](https://developers.vibrant-wellness.com/api-reference/reports/get.md) also indicates cancellation in its top-level
`DiagnosticReport.status`. Use the top-level status of the endpoint you call; you do not need to
query both endpoints to confirm cancellation or wait for nested report statuses to change.

### Cancellation preview

> [!NOTE]
>
> **WIP — coming soon:** cancellation eligibility and fee preview are not available yet.
> `cancellation` is currently `null`, except when an order is already known to be cancelled;
> that case can return `cancellable: false` with `reason: "already_cancelled"`.
> A `null` value does not indicate whether cancellation is allowed or free.

The [Cancel endpoint](https://developers.vibrant-wellness.com/api-reference/orders/cancel.md) is available. Cancellation is free before
the kit ships, costs **\$25** after shipment, and is not allowed once the lab receives the sample.

### Shipping exceptions and carrier tracking

Delivery exceptions do not have a separate order lifecycle value. An exception on the outbound
kit is reported as `kit_shipped`; an exception on the return shipment is reported as
`sample_in_transit`. These stages do not distinguish routine transit from a carrier delivery
exception.

When a tracking number is available, use `kit.trackingNumber` with the appropriate carrier's
tracking API for more complete, current carrier-reported scan events and exception details,
including weather delays and failed delivery attempts. Track the shipment identified by that
number.

See [FedEx tracking API](https://developer.fedex.com/api/en-us/catalog/track/docs.html) or
[DHL shipment tracking API](https://developer.dhl.com/tracking). Carrier APIs have their own
authentication requirements.

> [!NOTE]
>
> [Webhooks](https://developers.vibrant-wellness.com/concepts/webhooks.md) notify you of order, kit, and report changes for every order of
> your clinic, including Portal-created orders. Webhook events use their own status values, not
> the values on this page, and identify the order only by a string `accessionId`. See
> [Look up by `accessionId`](#look-up-by-accessionid) (coming soon).

## List orders

Every order in your clinic — placed through this API **or through the Vibrant Portal**. All filters
are optional and combine (AND):

| Filter | Effect |
| :- | :- |
| *(none)* | The whole clinic, newest first — one paginated sweep is a full backfill. |
| `patientId` | One patient's complete order history. Outside your clinic → `404`; no orders yet → `200` with an empty list. |
| `from` / `to` | Window on `orderedAt`, half-open (`from <= orderedAt < to`), each usable alone. One sweep's `to` is the next sweep's `from` — incremental syncs never miss or double-count an order. |

Dates are ISO 8601, UTC; a bare date means `00:00:00Z` that day. An empty range (`from >= to`) is a
`400` rather than a silently empty result.

Pagination and sorting work exactly as on [List patients](https://developers.vibrant-wellness.com/api-reference/patients/list.md): `page`
(default 1), `perPage` (default 20, max 100), `sortBy` (`orderedAt`), `sortOrder` (default `desc`).
Values of `perPage` above 100 are capped at 100. The response's `perPage` shows the effective page size.
`count` is the total match count, not the page size.

```json theme={null}
{
  "orders": [
    {
      "orderId": "bf8de4d9-31c2-4c8e-9f01-7a2d64e15b09",
      "placerId": "VENDOR-ORDER-12345",
      "sampleId": 2553977,
      "accessionId": "2607276003",
      "patientId": 750123,
      "status": "report_available",
      "orderedAt": "2026-08-08T17:21:04Z",
      "testCodes": ["GUT_ZOOMER"]
    },
    {
      "orderId": null,
      "placerId": null,
      "sampleId": 2201456,
      "accessionId": "2503011234",
      "patientId": 750123,
      "status": "report_available",
      "orderedAt": "2025-03-01T09:12:00Z",
      "testCodes": null
    }
  ],
  "count": 2,
  "page": 1,
  "perPage": 20
}
```

Rows are summaries: identity plus the order's lifecycle status. For what's happening *inside*
an order — kit, lab, report, cancellation —
[look it up](#look-up-one-order).

> [!NOTE]
>
> **Portal-placed orders have `null` for both `orderId` and `placerId`** — those two ids exist only
> for orders placed through this API. Anchor on `accessionId` (or `sampleId`), which every order
> has. In list responses, `accessionId` is a string; pass it unchanged to
> [Get report](https://developers.vibrant-wellness.com/api-reference/reports/get.md). `testCodes`
> is `null` where a Portal order's items have no catalog-code equivalent.

### From history to reports

A patient's past results are two steps: list their orders here, then fetch each row's `accessionId`
from the [Report endpoint](https://developers.vibrant-wellness.com/api-reference/reports/get.md). For a whole-clinic backfill, sweep the
unfiltered list once, then pace the report pulls — report fetching is rate-limited (`429` with
`Retry-After`), and it, not the sweep, is the long pole.


## OpenAPI

````yaml GET /orders
openapi: 3.1.0
info:
  title: Vibrant Wellness Portal API
  version: 2026-07-01-draft
  description: >-
    Order lab tests and retrieve results programmatically. Authenticate once
    with OAuth2 client credentials, browse the catalog, quote and
    eligibility-check an order, create patients, place orders, and pull results
    with their report status and issues.


    This reference documents the target external contract (v1).
  contact:
    name: Vibrant Wellness Developer Support
    email: portal-api@vibrant-wellness.com
    url: https://developers.vibrant-wellness.com
  license:
    name: Proprietary
servers:
  - url: https://api.vibrant-america.com/v1
    description: Production
  - url: https://api-sandbox.vibrant-america.com/v1
    description: Staging (sandbox)
security:
  - oauth2: []
tags:
  - name: Catalog
    description: Browse orderable tests and panels.
  - name: Pricing
    description: Get an authoritative price and eligibility check before ordering.
  - name: Patients
    description: Create patients.
  - name: Orders
    description: Place lab orders.
  - name: Reports
    description: Retrieve results, report status, and issues.
paths:
  /orders:
    get:
      tags:
        - Orders
      summary: Get orders
      description: >-
        List mode is available in sandbox for integration testing.


        One endpoint, two questions.


        **Lookup** — send `orderId` **or** `placerId` (one, not both): the full
        **OrderStatus** — lifecycle, kit shipping, lab receipt, report
        readiness, open exceptions, and cancellation information when available.
        **WIP:** cancellation eligibility and fee preview are not available yet;
        `cancellation` is currently null except for orders already known to be
        cancelled. The [Cancel endpoint](/api-reference/orders/cancel) is
        available.


        **List** — send any combination of `patientId` and `from`/`to`, or no
        filters at all: pages of order summaries for your clinic, **including
        orders placed through the Vibrant Portal**. Portal-placed rows have
        `null` `orderId`/`placerId` — anchor on `accessionId`, which is the id
        the Report endpoint takes.


        Mixing lookup and list parameters is a `400`.


        **Cancellation:** when the order's top-level `status` is `cancelled`,
        the whole order is terminal. Stop waiting for or polling results
        regardless of nested `report.status` or progress counts. The Report
        endpoint also uses a top-level `cancelled` status; you do not need to
        query both endpoints to confirm cancellation.


        [Webhooks](/concepts/webhooks) notify you of order, kit, and report
        changes for every order of your clinic, including Portal-created orders.
        Webhook events use their own status values, not the values returned
        here, and identify the order only by a string accessionId. **WIP —
        coming soon:** looking up an order by accessionId, for orders placed
        through this API. An order placed in the Vibrant Portal returns `403`
        with `not_placed_via_api`; an order of another clinic returns `404`.
      operationId: getOrderStatus
      parameters:
        - name: orderId
          in: query
          required: false
          schema:
            type: string
          description: >-
            Lookup mode: the `orderId` returned by `POST /orders`. Send this or
            `placerId`, not both.
        - name: placerId
          in: query
          required: false
          schema:
            type: string
          description: >-
            Lookup mode: the `placerId` the order was placed with. Send this or
            `orderId`, not both.
        - name: patientId
          in: query
          required: false
          schema:
            type: integer
          description: >-
            List mode: only this patient’s orders. A `patientId` outside your
            clinic is a `404`; a patient with no orders is a `200` with an empty
            list.
        - name: from
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: >-
            List mode: `orderedAt >= from`. ISO 8601, UTC; a bare date means
            `00:00:00Z` that day.
        - name: to
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: >-
            List mode: `orderedAt < to` (half-open, so one sweep’s `to` is the
            next sweep’s `from`). An empty range (`from >= to`) is a `400`.
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
          description: 'List mode: page number.'
        - name: perPage
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            default: 20
          description: >-
            List mode: requested rows per page. Values above 100 are capped at
            100; the response's perPage shows the effective page size.
        - name: sortBy
          in: query
          required: false
          schema:
            type: string
            enum:
              - orderedAt
            default: orderedAt
          description: 'List mode: sort field.'
        - name: sortOrder
          in: query
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
          description: 'List mode: sort direction.'
      responses:
        '200':
          description: >-
            Lookup: the order’s current state. List: one page of order
            summaries.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/OrderStatus'
                  - $ref: '#/components/schemas/OrderList'
              examples:
                kit_delivered:
                  summary: Kit delivered — shipping details available
                  value:
                    orderId: bf8de4d9-31c2-4c8e-9f01-7a2d64e15b09
                    placerId: VENDOR-ORDER-12345
                    accessionId: 2508088888
                    patientId: 750123
                    status: kit_delivered
                    kit:
                      status: delivered
                      carrier: FedEx
                      trackingNumber: '123456789012'
                      shippedAt: '2026-06-11T17:20:00Z'
                      deliveredAt: '2026-06-14T15:02:00Z'
                    lab:
                      sampleReceived: false
                    report:
                      status: registered
                      generatedReportCount: 0
                      totalReportCount: 3
                    cancellation: null
                    exceptions: []
                    updatedAt: '2026-06-14T15:02:10Z'
                sample_analyzing:
                  summary: Sample at the lab — questionnaire pending
                  value:
                    orderId: bf8de4d9-31c2-4c8e-9f01-7a2d64e15b09
                    placerId: VENDOR-ORDER-12345
                    accessionId: 2508088888
                    patientId: 750123
                    status: analyzing
                    kit:
                      status: delivered
                      carrier: FedEx
                      shippedAt: '2026-06-11T17:20:00Z'
                      deliveredAt: '2026-06-14T15:02:00Z'
                      trackingNumber: '123456789012'
                    lab:
                      sampleReceived: true
                      receivedAt: '2026-06-16T09:00:00Z'
                    report:
                      status: preliminary
                      generatedReportCount: 2
                      totalReportCount: 3
                    cancellation: null
                    exceptions:
                      - type: questionnaire_pending
                        name: Questionnaire pending
                        blocksReport: false
                        detail: >-
                          Questionnaire emailed to the patient; reference ranges
                          are provisional until answered.
                    updatedAt: '2026-06-18T14:03:00Z'
                sandbox_order:
                  summary: Sandbox — shipping details unavailable
                  value:
                    orderId: bf8de4d9-31c2-4c8e-9f01-7a2d64e15b09
                    placerId: VENDOR-ORDER-12345
                    accessionId: 2508088888
                    patientId: 750123
                    status: kit_delivered
                    kit: null
                    lab:
                      sampleReceived: false
                    report:
                      status: registered
                      generatedReportCount: 0
                      totalReportCount: 3
                    cancellation: null
                    exceptions: []
                    updatedAt: '2026-06-14T15:02:10Z'
                patient_history:
                  summary: List mode — a patient’s order history
                  value:
                    orders:
                      - orderId: bf8de4d9-31c2-4c8e-9f01-7a2d64e15b09
                        placerId: VENDOR-ORDER-12345
                        sampleId: 2553977
                        accessionId: '2607276003'
                        patientId: 750123
                        status: report_available
                        orderedAt: '2026-08-08T17:21:04Z'
                        testCodes:
                          - GUT_ZOOMER
                      - orderId: null
                        placerId: null
                        sampleId: 2201456
                        accessionId: '2503011234'
                        patientId: 750123
                        status: report_available
                        orderedAt: '2025-03-01T09:12:00Z'
                        testCodes: null
                    count: 2
                    page: 1
                    perPage: 20
                cancelled_order:
                  summary: >-
                    Cancelled order — stop waiting despite registered report
                    readiness
                  value:
                    orderId: bf8de4d9-31c2-4c8e-9f01-7a2d64e15b09
                    placerId: VENDOR-ORDER-12345
                    accessionId: 2508088888
                    patientId: 750123
                    status: cancelled
                    kit: null
                    lab:
                      sampleReceived: false
                    report:
                      status: registered
                      generatedReportCount: 0
                      totalReportCount: 3
                    cancellation:
                      cancellable: false
                      fee: null
                      reason: already_cancelled
                    exceptions: []
                    updatedAt: '2026-06-15T10:00:00Z'
        '400':
          description: >-
            Lookup and list parameters mixed, both lookup ids sent, or an
            invalid filter value (`AMBIGUOUS_ORDER_IDENTIFIER`,
            `INVALID_FIELD_TYPE`, `INVALID_DATE_RANGE`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: AMBIGUOUS_ORDER_IDENTIFIER
                  message: Send orderId or placerId alone, without list filters.
                  requestId: req_01JQ8ZC5X9K2MN
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    OrderStatus:
      type: object
      description: >-
        Order lifecycle, kit shipping, lab receipt, report readiness,
        cancellation information when available, and exceptions.
        [Webhooks](/concepts/webhooks) report order changes with their own
        status values; they are not the values of this object.
      properties:
        orderId:
          type: string
          example: bf8de4d9-31c2-4c8e-9f01-7a2d64e15b09
          description: UUID assigned at placement.
        placerId:
          type: string
          description: Your own id for the order.
          example: VENDOR-ORDER-12345
        accessionId:
          type: integer
          description: Barcode — use it to fetch the report.
          example: '2508088888'
        patientId:
          type: integer
          example: 750123
        status:
          type: string
          enum:
            - processing
            - rejected
            - failed
            - dry_run
            - placed
            - kit_shipped
            - kit_delivered
            - sample_in_transit
            - sample_received
            - analyzing
            - report_available
            - cancelled
          description: >-
            Order lifecycle. A lookup can return processing (placement not
            completed), rejected (correct the request before retrying), failed
            (retry placement), or dry_run (a placement record created in dry-run
            mode). Reuse the same placerId when retrying placement.
            kit_delivered means the outbound kit has reached the patient.
            sample_received is lab receipt, after which the order can no longer
            be cancelled. A top-level cancelled status is terminal for the whole
            order: stop waiting for or polling results regardless of nested
            report readiness or progress counts.
          example: sample_received
        kit:
          type:
            - object
            - 'null'
          description: >-
            Kit shipping details, or null when unavailable. Shipping details are
            not available in sandbox, so kit is always null.
          properties:
            status:
              type: string
              enum:
                - not_shipped
                - shipped
                - in_transit
                - delivered
              example: delivered
            carrier:
              type:
                - string
                - 'null'
              example: FedEx
              description: >-
                Carrier name, e.g. FedEx or DHL. Null before shipment or when
                carrier details are unavailable.
            trackingNumber:
              type: string
              example: '123456789012'
              description: Tracking number for the shipment.
            shippedAt:
              type:
                - string
                - 'null'
              format: date-time
              example: '2026-06-11T17:20:00Z'
              description: UTC timestamp of the carrier pickup scan. Null before shipment.
            deliveredAt:
              type:
                - string
                - 'null'
              format: date-time
              example: '2026-06-14T15:02:00Z'
              description: >-
                UTC timestamp of the carrier delivery scan. Null until
                delivered, or when delivery details are unavailable.
        lab:
          type: object
          description: Lab receipt of the patient's sample.
          properties:
            sampleReceived:
              type: boolean
              example: true
            receivedAt:
              type: string
              format: date-time
              example: '2026-06-16T09:00:00Z'
        report:
          type: object
          description: >-
            Report readiness and progress counts. Use the order's top-level
            status to determine cancellation.
          properties:
            status:
              type: string
              enum:
                - registered
                - preliminary
                - final
                - unknown
              example: preliminary
              description: >-
                Report readiness. When the order's top-level status is
                cancelled, the whole order is terminal: stop waiting for or
                polling results regardless of this field. This readiness status
                may remain registered; you do not need to wait for it to change.
            generatedReportCount:
              type: integer
              example: 2
            totalReportCount:
              type: integer
              example: 3
        cancellation:
          $ref: '#/components/schemas/CancellationWindow'
        exceptions:
          type: array
          items:
            $ref: '#/components/schemas/OrderException'
          description: Open exceptions. Empty array when there are none.
        updatedAt:
          type: string
          format: date-time
          example: '2026-06-16T09:00:03Z'
    OrderList:
      type: object
      description: One page of order summaries.
      properties:
        orders:
          type: array
          items:
            $ref: '#/components/schemas/OrderSummary'
        count:
          type: integer
          description: Total matches across all pages, not the page size.
          example: 2
        page:
          type: integer
          example: 1
        perPage:
          type: integer
          description: Effective page size, capped at 100.
          example: 20
      required:
        - orders
        - count
        - page
        - perPage
    Error:
      type: object
      description: >-
        🚧 Working in progress — this envelope is the contract; not yet returned
        by every endpoint.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Stable machine-readable error code.
            message:
              type: string
              description: Human-readable explanation.
            requestId:
              type: string
              description: >-
                Identifier for this request. Include it when contacting support.
                Also returned on every response as the X-Request-Id header.
              example: req_01JQ8ZC5X9K2MN
            details:
              type: array
              items:
                type: object
                additionalProperties: true
              description: Optional structured context.
          required:
            - code
            - message
            - requestId
    CancellationWindow:
      type:
        - object
        - 'null'
      description: >-
        WIP — cancellation eligibility and fee preview are not available yet.
        This block is currently null, except when an order is already known to
        be cancelled; that case can return cancellable: false and reason:
        already_cancelled. Null does not indicate whether cancellation is
        allowed or free.
      properties:
        cancellable:
          type: boolean
          example: true
        fee:
          anyOf:
            - $ref: '#/components/schemas/Price'
            - type: 'null'
          description: >-
            Cancellation fee that would be charged. `null` before the kit ships
            (free) and when not cancellable.
        reason:
          type: string
          enum:
            - free_before_kit_ships
            - fee_after_kit_ships
            - sample_received
            - already_cancelled
          description: >-
            Why this window is what it is. `sample_received` = past the point of
            no return.
          example: fee_after_kit_ships
    OrderException:
      type: object
      description: >-
        Something holding up the order. Resolved automatically by Vibrant — see
        the Exceptions guide.
      properties:
        type:
          type: string
          enum:
            - redraw_needed
            - waiver_missing
            - questionnaire_pending
            - address_missing
            - billing_issue
          description: Machine-readable exception type.
        name:
          type: string
          example: Questionnaire pending
        blocksReport:
          type: boolean
          description: Whether this withholds the result until resolved.
          example: false
        detail:
          type: string
          example: >-
            Questionnaire emailed to the patient; ranges are provisional until
            answered.
    OrderSummary:
      type: object
      description: >-
        One row of an order list. Identity plus coarse state; for kit, lab,
        report and cancellation detail, look the order up by `orderId`.
      properties:
        orderId:
          type:
            - string
            - 'null'
          description: >-
            UUID assigned at placement. `null` for orders placed through the
            Vibrant Portal rather than this API.
        placerId:
          type:
            - string
            - 'null'
          description: Your own id for the order. `null` for Portal-placed orders.
        sampleId:
          type: integer
        accessionId:
          type: string
          description: >-
            Barcode as a string — every order has one. Pass it unchanged to `GET
            /report/fhir/{id}`.
        patientId:
          type: integer
        status:
          type: string
          enum:
            - placed
            - kit_shipped
            - kit_delivered
            - sample_in_transit
            - sample_received
            - analyzing
            - report_available
            - cancelled
          description: >-
            Order lifecycle status for a row in the historical order list. A
            cancelled order is terminal; stop waiting for or polling its
            results.
        orderedAt:
          type: string
          format: date-time
        testCodes:
          type:
            - array
            - 'null'
          items:
            type: string
          description: >-
            `null` when a Portal-placed order’s items have no catalog-code
            equivalent.
      required:
        - sampleId
        - accessionId
        - patientId
        - status
        - orderedAt
    Price:
      type: object
      properties:
        amount:
          type: number
          example: 300
        currency:
          type: string
          example: usd
  responses:
    Unauthorized:
      description: Not authenticated. See Authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Not authenticated.
              requestId: req_01JQ8ZC5X9K2MN
    NotFound:
      description: >-
        The accession is unknown, or it isn't within your account's access
        scope. Returned as 404 (not 403) so sample existence isn't leaked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: report_not_found
              message: No accessible report for this accession.
              requestId: req_01JQ8ZC5X9K2MN
    RateLimited:
      description: Rate limit exceeded.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds to wait before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Too many requests. Retry after 2s.
              requestId: req_01JQ8ZC5X9K2MN
    InternalError:
      description: >-
        Something went wrong on our side. Safe to retry (idempotent endpoints:
        reuse the same placerId).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: internal_error
              message: Unexpected error.
              requestId: req_01JQ8ZC5X9K2MN
  securitySchemes:
    oauth2:
      type: oauth2
      description: >-
        OAuth2 client credentials. Generate a client ID and client secret in the
        Portal, exchange them for an access token, then send `Authorization:
        Bearer <access_token>`. Request the `result` and `report` scopes to read
        results.
      flows:
        clientCredentials:
          tokenUrl: https://api.vibrant-america.com/v1/oauth2/token
          scopes:
            result: Read finalized lab results
            report: Read report status and issues

````

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