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

# Quickstart

> Place your first lab order and pull the report — end to end.

This walkthrough goes from OAuth2 credentials to a result. It uses **staging**, so nothing here
creates a real order or charge. Each step builds on the previous one.

> [!NOTE]
>
> Prerequisite: a **staging** client ID + secret (see [API credentials](https://developers.vibrant-wellness.com/api-keys.md)). Set them once:
>
> ```bash theme={null}
> export VW_CLIENT_ID="..."
> export VW_CLIENT_SECRET="..."
> export VW_BASE="https://api-sandbox.vibrant-america.com/v1"
> ```

**1. Get an access token**

Exchange your credentials for a short-lived token. Request `result report` so you can read results.

```bash theme={null}
export ACCESS_TOKEN=$(curl -s -X POST "https://api-sandbox.vibrant-america.com/v1/oauth2/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "grant_type=client_credentials" \
  --data-urlencode "client_id=$VW_CLIENT_ID" \
  --data-urlencode "client_secret=$VW_CLIENT_SECRET" \
  --data-urlencode "scope=result report" | jq -r .access_token)
```

**2. Find a product in the catalog**

```bash theme={null}
curl "https://api-sandbox.vibrant-america.com/v1/catalog/products?search=gut" -H "Authorization: Bearer $ACCESS_TOKEN"
```

```json Response theme={null}
{ "data": [ { "code": "GUT_ZOOMER", "subtype": "panel", "name": "Gut Zoomer",
  "price": { "amount": 500.0, "currency": "usd" }, "orderable": true,
  "updatedAt": "2026-05-01T10:00:00Z" } ] }
```

Keep the `code` (`GUT_ZOOMER`) — you'll use it in the quote and the order.

**3. Create a patient**

```bash theme={null}
curl -X POST "https://api-sandbox.vibrant-america.com/v1/patients" \
  -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
  -d '{ "patientFirstName": "Jane", "patientLastName": "Doe",
        "patientGender": "Female", "patientDateOfBirth": "1990-05-21",
        "patientEmail": "jane.doe@example.com", "patientPhoneNumber": "4085550100",
        "address": { "street": "1 Main St", "city": "San Jose",
                     "state": "CA", "zipCode": "95112", "country": "US" } }'
```

```json Response theme={null}
{ "patientId": 750123, "patientFirstName": "Jane", "patientLastName": "Doe", "…": "…" }
```

**4. Quote and check eligibility**

Always quote before ordering — the catalog price is only indicative, and the quote confirms the
patient can order these tests.

```bash theme={null}
curl -X POST "https://api-sandbox.vibrant-america.com/v1/quote" \
  -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
  -d '{ "patientId": 750123, "testCodes": ["GUT_ZOOMER", "VITD_25OH"] }'
```

```json Response theme={null}
{ "quoteId": "Q-1784681889178172779", "currency": "usd", "eligible": true, "isDbs": false,
  "lineItems": [ { "code": "GUT_ZOOMER", "itemType": "test", "name": "Gut Zoomer 5.0",
    "price": 550 } ],
  "bestDealPrice": 550, "total": 550 }
```

> [!WARNING]
>
> If `eligible` is `false`, the response lists every failing reason. Fix and re-quote.

**5. Place the order**

Order the **same codes**. `placerId` is your optional idempotency key — resending it never double-charges (omit it and every call places a new order).

```bash theme={null}
curl -X POST "https://api-sandbox.vibrant-america.com/v1/orders" \
  -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
  -d '{ "placerId": "VENDOR-ORDER-12345", "patientId": 750123,
        "orderingProviderId": "1234567890", "chargeIndicator": "C",
        "testCodes": ["GUT_ZOOMER", "VITD_25OH"] }'
```

```json Response theme={null}
{ "status": "placed", "orderId": "d53f297b-9e2e-45f5-8f00-1b42df2dbde6", "sampleId": 2553966, "accessionId": 2607216002 }
```

Save the **`accessionId`** — it's how you retrieve the report.

**6. Get the report**

Fetch by `accessionId` (or a numeric `sampleId` — auto-detected). You always get `200` with the
report `status`; the result content appears as soon as any report is ready, **including
`preliminary`** (no 404 to poll).

```bash theme={null}
curl "https://api-sandbox.vibrant-america.com/v1/report/fhir/2607216002" -H "Authorization: Bearer $ACCESS_TOKEN"
```

```json Response theme={null}
{ "resourceType": "DiagnosticReport", "status": "final", "code": { "text": "Gut Zoomer" },
  "issued": "2026-06-20T14:03:00Z",
  "identifier": [{ "system": "urn:vibrant:accession", "value": "2607216002" }],
  "presentedForm": [ { "contentType": "application/pdf",
    "url": "https://api.vibrant-america.com/v1/report/fhir/2607216002/pdf" } ] }
```

> [!TIP]
>
> Track progress with the report `status` (`registered` → `preliminary` → `final`) instead of
> polling for a 404.

## What's next

> [card] [API reference](https://developers.vibrant-wellness.com/api-reference/introduction.md)
>
> Every field and error, with a try-it console.

> [card] [Core concepts](https://developers.vibrant-wellness.com/concepts/orders.md)
>
> How orders and reports fit together.


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