Example workflow
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",
}
Observe what types of tests you can order
curl --request GET 'https://api.butterflylabs.co/v0.1/order-definitions' \
--header 'x-api-key: <API_KEY>'
{
"data": [
{
"code": "BFLY-F3C9E9",
"encounter_type": "HOME_VISIT_WITH_KIT",
"name": "Men's Health Panel - Home Visit",
"price_in_cents": 25900,
},
{
"code": "BFLY-AB3U8S",
"encounter_type": "WALK_IN_VISIT",
"name": "Men's Health Panel - Walk In",
"price_in_cents": 25900,
}
],
"page": 1,
"total": 2
}
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-F3C9E9",
"patient_id": "pt_DOPl1KA3XOrx9ih5",
"is_stat": false
}'
{
"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": []
}
Updated 4 months ago
Did this page help you?