Example workflow

This shows our primary workflow, custom panels for Labcorp walk-in visits.

Register a webhook endpoint

Register a webhook endpoint to receive notifications when certain events occur.

curl --request POST 'https://api.butterflylabs.co/v0.1/webhook_endpoints' \
--header 'x-api-key: <API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "<WEBHOOK_ENDPOINT>"
}'
{
        "created_at": "2021-05-19T17:14:47.612Z",
    "id": "we_25UiZczlRuGQhhoy",
    "updated_at": "2021-05-19T17:14:47.612Z",
    "url": "<WEBHOOK_ENDPOINT>"
}

Create a patient

curl --request POST 'https://api.butterflylabs.co/v0.1/patients' \
--header 'x-api-key: <API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "address_line_1": "123 Sunshine Plaza",
  "address_line_2": "Unit 4",
  "city": "Los Angeles",
  "state": "CA",
  "postal_code": "90004",
  "date_of_birth": "2000-12-12",
  "email": "[email protected]",
  "first_name": "Jane",
  "last_name": "Doe",
  "phone_number": "9254073333",
  "sex": "female",
  "external_id": null
}'
{
  "address": {
    "address_line_1": "123 Sunshine Plaza",
    "address_line_2": "Unit 4",
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90004"
  },
  "created_at": "2021-03-08T03:27:36.086Z",
  "date_of_birth": "2000-12-12",
  "email": "[email protected]",
  "external_id": null,
  "first_name": "Jane",
    "last_name": "Doe",
  "id": "pt_DOPl1KA3XOrx9ih5",
  "phone_number": "9254073333",
  "sex": "female",
  "updated_at": "2021-03-08T03:27:36.086Z",
}

Check what tests you can order

curl --request GET 'https://api.butterflylabs.co/v0.1/tests' \
--header 'x-api-key: <API_KEY>'
{
    "total": 3,
    "page": 0,
    "size": 3,
    "data": [
        {
            "id": "TEST-0NTMX",
            "name": "Thyroid Antibodies",
            "lab_id": "LABCORP",
            "lab_test_code": "006684",
            "lab_test_name": "Thyroid Antibodies",
            "requires_fasting": false
        },
        {
            "id": "TEST-0PPJ6",
            "name": "Thyroid Panel",
            "lab_id": "LABCORP",
            "lab_test_code": "000455",
            "lab_test_name": "Thyroid Panel",
            "requires_fasting": false
        },
        {
            "id": "TEST-0TKE9",
            "name": "726778 7+Alc-Unbund",
            "lab_id": "LABCORP",
            "lab_test_code": "726778",
            "lab_test_name": "726778 7+Alc-Unbund",
            "requires_fasting": false
        }
    ]
}

Place an order

curl --request POST 'https://api.butterflylabs.co/v0.1/orders' \
--header 'x-api-key: <API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "order_definition_code": "BFLY-VX1CUF",
  "patient_id": "pt_DOPl1KA3XOrx9ih5",
  "tests": [
    "TEST-0NTMX",
    "TEST-0TKE9"
  ]
}'
{
  "address": {
    "address_line_1": "1400 S Grand Ave",
    "address_line_2": "Ste 612",
    "city": "Los Angeles",
    "state": "CA",
    "postal_code": "90015"
  },
  "created_at": "2021-04-23T18:25:43.511Z",
  "home_visits": [
    {
      "error": null,
      "status": "CONFIRMED",
      "visit_datetime": "2021-04-23T17:00:00.000Z"
    }
  ],
  "id": "ord_zAsm5nErojHjPsU7",
    "is_stat": false,
  "kits": [
    {
      "error": null,
      "return_shipping_tracking_url": "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=92055901755477000460652250",
      "shipping_tracking_url": "https://www.ups.com/track?tracknum=1Z063AX08777363907",
      "status": "SHIPPED_TO_PATIENT",
    }
  ],
  "order_definition": {
    "code": "BFLY-F3C9E9",
        "encounter_type": "HOME_VISIT_WITH_KIT",
    "name": "Men's Health Panel - Home Visit",
  },
  "ordering_physician": {
    "first_name": "Benjamin",
        "last_name": "Franklin",
    "npi": "1234567890"
  },
  "patient": {
        "first_name": "Jane",
    "id": "pt_DOPl1KA3XOrx9ih5",
        "last_name": "Doe",
  },
  "status": "SAMPLE_BEING_COLLECTED",
  "updated_at": "2021-04-23T18:25:43.511Z",
  "walk_in_visits": []
}

Note: custom panels are currently supported for Labcorp walk-in visits. Please use order definition code BFLY-VX1CUF to order a custom panel.