> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morf.health/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Order

> Event payload details and trigger documentation for Order data from Junction

<img src="https://mintlify.s3.us-west-1.amazonaws.com/morfhealth/images/junction.svg" alt="images/junction.svg" />

# Events

## Triggering Webhook Types

The following event types are associated with the Order event payload from Junction.

* `Junction Lab Order Status Update`

<RequestExample>
  ```json Example theme={null}
  {
    "created_at": "2023-09-08T13:40:25.443240+00:00",
    "details": {
      "created_at": "2023-09-08T13:40:36.605770+00:00",
      "id": "4d22e665-b845-436d-ae01-fe00f100bc1c",
      "type": "walk_in_test",
      "updated_at": "2023-09-08T13:40:36.605770+00:00"
    },
    "events": [
      {
        "created_at": "2023-09-08T13:40:36.628095+00:00",
        "id": 4182,
        "status": "received.walk_in_test.ordered"
      }
    ],
    "id": "ac1162da-0b10-4a64-9d81-30080cc919b3",
    "is_labcorp_stat_order": false,
    "lab_test": {
      "id": "1508b669-b653-41c5-9a6d-866c65848137",
      "is_active": true,
      "is_delegated": false,
      "lab": {
        "city": "San Francisco",
        "first_line_address": "123 Lab Street",
        "id": 12345,
        "name": "LabCorp",
        "sample_types": "serum",
        "slug": "labcorp",
        "zipcode": "94105"
      },
      "markers": [
        {
          "id": 1481,
          "name": "Hemoglobin A1c",
          "slug": "hemoglobin-a1c",
          "type": "quantity",
          "unit": "%"
        }
      ],
      "method": "walk_in_test",
      "name": "Women's Hormones Panel",
      "sample_type": "serum",
      "slug": "womens_hormones_panel"
    },
    "notes": "This is a note",
    "patient_details": {
      "email": "patient@gmail.com",
      "first_name": "John",
      "last_name": "Doe",
      "phone_number": "+5551231234"
    },
    "physician": {
      "first_name": "Joseph",
      "last_name": "Lister",
      "npi": "1093125863"
    },
    "sample_id": "QDWYKK7PAP23",
    "status": "completed",
    "updated_at": "2023-09-08T13:42:51.206896+00:00",
    "user_id": "a8dcc7e1-f47a-4c0c-89be-88d3d4f15834"
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Description theme={null}
  {
    "created_at": "When this order was created",
    "details": {
      "created_at": "When these order details were created",
      "id": "Unique identifier for the order details",
      "type": "Type of the order",
      "updated_at": "When these order details were last updated"
    },
    "events": {
      "created_at": "When this event occurred",
      "id": "Unique identifier for the event",
      "status": "Status update from this event"
    },
    "id": "Unique identifier for the order",
    "is_labcorp_stat_order": "Whether this is a STAT (urgent) LabCorp order",
    "lab_test": {
      "id": "Unique identifier for the lab test",
      "is_active": "Whether this lab test is currently active",
      "is_delegated": "Whether this lab test is delegated",
      "lab": {
        "city": "City where the lab is located",
        "first_line_address": "First line of the lab's address",
        "id": "Unique identifier for the lab",
        "name": "Name of the laboratory",
        "sample_types": "Types of samples this lab can process",
        "slug": "URL-friendly identifier for the lab",
        "zipcode": "ZIP code of the lab's location"
      },
      "markers": {
        "id": "Unique identifier for the marker",
        "name": "Name of the marker",
        "slug": "URL-friendly identifier for the marker",
        "type": "Type of the marker measurement",
        "unit": "Unit of measurement for the marker"
      },
      "method": "Method of sample collection",
      "name": "Name of the lab test",
      "sample_type": "Type of sample required",
      "slug": "URL-friendly identifier for the lab test"
    },
    "notes": "Additional notes about the order",
    "patient_details": {
      "email": "Email address of the patient",
      "first_name": "Patient's first name",
      "last_name": "Patient's last name",
      "phone_number": "Patient's phone number"
    },
    "physician": {
      "first_name": "Physician's first name",
      "last_name": "Physician's last name",
      "npi": "National Provider Identifier"
    },
    "sample_id": "Unique identifier for the sample",
    "status": "Current status of the order",
    "updated_at": "When this order was last updated",
    "user_id": "ID of the user this order belongs to"
  }
  ```
</ResponseExample>

### Payload Field Details

<ResponseField name="Order" type="Event Payload">
  <Expandable title="fields" defaultOpen="true">
    <ResponseField name="id" type="string" required>
      Unique identifier for the order

      ```json CEL theme={null}
      id
      ```

      ```json Example theme={null}
      "ac1162da-0b10-4a64-9d81-30080cc919b3"
      ```
    </ResponseField>

    <ResponseField name="user_id" type="string" required>
      ID of the user this order belongs to

      ```json CEL theme={null}
      user_id
      ```

      ```json Example theme={null}
      "a8dcc7e1-f47a-4c0c-89be-88d3d4f15834"
      ```
    </ResponseField>

    <ResponseField name="lab_test" type="object" required>
      *Description coming soon*

      ```json CEL theme={null}
      lab_test
      ```

      ```json Example theme={null}
      {
      "id": "1508b669-b653-41c5-9a6d-866c65848137",
      "is_active": true,
      "is_delegated": false,
      "lab": {
      "city": "San Francisco",
      "first_line_address": "123 Lab Street",
      "id": 12345,
      "name": "LabCorp",
      "sample_types": "serum",
      "slug": "labcorp",
      "zipcode": "94105"
      },
      "markers": [
      {
      "id": 1481,
      "name": "Hemoglobin A1c",
      "slug": "hemoglobin-a1c",
      "type": "quantity",
      "unit": "%"
      }
      ],
      "method": "walk_in_test",
      "name": "Women's Hormones Panel",
      "sample_type": "serum",
      "slug": "womens_hormones_panel"
      }
      ```
    </ResponseField>

    <ResponseField name="lab_test.id" type="string" required>
      Unique identifier for the lab test

      ```json CEL theme={null}
      lab_test.id
      ```

      ```json Example theme={null}
      "1508b669-b653-41c5-9a6d-866c65848137"
      ```
    </ResponseField>

    <ResponseField name="lab_test.name" type="string" required>
      Name of the lab test

      ```json CEL theme={null}
      lab_test.name
      ```

      ```json Example theme={null}
      "Women's Hormones Panel"
      ```
    </ResponseField>

    <ResponseField name="lab_test.slug" type="string" required>
      URL-friendly identifier for the lab test

      ```json CEL theme={null}
      lab_test.slug
      ```

      ```json Example theme={null}
      "womens_hormones_panel"
      ```
    </ResponseField>

    <ResponseField name="lab_test.sample_type" type="string">
      Type of sample required

      ```json CEL theme={null}
      lab_test.sample_type
      ```

      ```json Example theme={null}
      "serum"
      ```
    </ResponseField>

    <ResponseField name="lab_test.is_active" type="bool" required>
      Whether this lab test is currently active

      ```json CEL theme={null}
      lab_test.is_active
      ```

      ```json Example theme={null}
      true
      ```
    </ResponseField>

    <ResponseField name="lab_test.is_delegated" type="bool" required>
      Whether this lab test is delegated

      ```json CEL theme={null}
      lab_test.is_delegated
      ```

      ```json Example theme={null}
      false
      ```
    </ResponseField>

    <ResponseField name="lab_test.lab" type="object">
      *Description coming soon*

      ```json CEL theme={null}
      lab_test.lab
      ```

      ```json Example theme={null}
      {
      "city": "San Francisco",
      "first_line_address": "123 Lab Street",
      "id": 12345,
      "name": "LabCorp",
      "sample_types": "serum",
      "slug": "labcorp",
      "zipcode": "94105"
      }
      ```
    </ResponseField>

    <ResponseField name="lab_test.lab.id" type="int64">
      Unique identifier for the lab

      ```json CEL theme={null}
      lab_test.lab.id
      ```

      ```json Example theme={null}
      12345
      ```
    </ResponseField>

    <ResponseField name="lab_test.lab.name" type="string">
      Name of the laboratory

      ```json CEL theme={null}
      lab_test.lab.name
      ```

      ```json Example theme={null}
      "LabCorp"
      ```
    </ResponseField>

    <ResponseField name="lab_test.lab.slug" type="string">
      URL-friendly identifier for the lab

      ```json CEL theme={null}
      lab_test.lab.slug
      ```

      ```json Example theme={null}
      "labcorp"
      ```
    </ResponseField>

    <ResponseField name="lab_test.lab.sample_types" type="[]string">
      Types of samples this lab can process

      ```json CEL theme={null}
      lab_test.lab.sample_types
      ```

      ```json Example theme={null}
      "serum"
      ```
    </ResponseField>

    <ResponseField name="lab_test.lab.first_line_address" type="string">
      First line of the lab's address

      ```json CEL theme={null}
      lab_test.lab.first_line_address
      ```

      ```json Example theme={null}
      "123 Lab Street"
      ```
    </ResponseField>

    <ResponseField name="lab_test.lab.city" type="string">
      City where the lab is located

      ```json CEL theme={null}
      lab_test.lab.city
      ```

      ```json Example theme={null}
      "San Francisco"
      ```
    </ResponseField>

    <ResponseField name="lab_test.lab.zipcode" type="string">
      ZIP code of the lab's location

      ```json CEL theme={null}
      lab_test.lab.zipcode
      ```

      ```json Example theme={null}
      "94105"
      ```
    </ResponseField>

    <ResponseField name="lab_test.markers" type="[]object" required>
      *Description coming soon*

      ```json CEL theme={null}
      lab_test.markers
      ```

      ```json Example theme={null}
      [
      {
      "id": 1481,
      "name": "Hemoglobin A1c",
      "slug": "hemoglobin-a1c",
      "type": "quantity",
      "unit": "%"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="lab_test.markers.map(x, x.id)" type="[]int64" required>
      Mapped array of: Unique identifier for the marker

      ```json CEL theme={null}
      lab_test.markers.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      1481
      ]
      ```
    </ResponseField>

    <ResponseField name="lab_test.markers.map(x, x.name)" type="[]string" required>
      Mapped array of: Name of the marker

      ```json CEL theme={null}
      lab_test.markers.map(x, x.name)
      ```

      ```json Example theme={null}
      [
      "Hemoglobin A1c"
      ]
      ```
    </ResponseField>

    <ResponseField name="lab_test.markers.map(x, x.slug)" type="[]string" required>
      Mapped array of: URL-friendly identifier for the marker

      ```json CEL theme={null}
      lab_test.markers.map(x, x.slug)
      ```

      ```json Example theme={null}
      [
      "hemoglobin-a1c"
      ]
      ```
    </ResponseField>

    <ResponseField name="lab_test.markers.map(x, x.type)" type="[]string" required>
      Mapped array of: Type of the marker measurement

      ```json CEL theme={null}
      lab_test.markers.map(x, x.type)
      ```

      ```json Example theme={null}
      [
      "quantity"
      ]
      ```
    </ResponseField>

    <ResponseField name="lab_test.markers.map(x, x.unit)" type="[]string" required>
      Mapped array of: Unit of measurement for the marker

      ```json CEL theme={null}
      lab_test.markers.map(x, x.unit)
      ```

      ```json Example theme={null}
      [
      "%"
      ]
      ```
    </ResponseField>

    <ResponseField name="lab_test.method" type="string" required>
      Method of sample collection

      ```json CEL theme={null}
      lab_test.method
      ```

      ```json Example theme={null}
      "walk_in_test"
      ```
    </ResponseField>

    <ResponseField name="details" type="object" required>
      *Description coming soon*

      ```json CEL theme={null}
      details
      ```

      ```json Example theme={null}
      {
      "created_at": "2023-09-08T13:40:36.605770+00:00",
      "id": "4d22e665-b845-436d-ae01-fe00f100bc1c",
      "type": "walk_in_test",
      "updated_at": "2023-09-08T13:40:36.605770+00:00"
      }
      ```
    </ResponseField>

    <ResponseField name="details.id" type="string" required>
      Unique identifier for the order details

      ```json CEL theme={null}
      details.id
      ```

      ```json Example theme={null}
      "4d22e665-b845-436d-ae01-fe00f100bc1c"
      ```
    </ResponseField>

    <ResponseField name="details.type" type="string" required>
      Type of the order

      ```json CEL theme={null}
      details.type
      ```

      ```json Example theme={null}
      "walk_in_test"
      ```
    </ResponseField>

    <ResponseField name="details.created_at" type="timing.v1.Timestamp">
      When these order details were created

      ```json CEL theme={null}
      details.created_at
      ```

      ```json Example theme={null}
      "2023-09-08T13:40:36.605770+00:00"
      ```
    </ResponseField>

    <ResponseField name="details.updated_at" type="timing.v1.Timestamp">
      When these order details were last updated

      ```json CEL theme={null}
      details.updated_at
      ```

      ```json Example theme={null}
      "2023-09-08T13:40:36.605770+00:00"
      ```
    </ResponseField>

    <ResponseField name="notes" type="string">
      Additional notes about the order

      ```json CEL theme={null}
      notes
      ```

      ```json Example theme={null}
      "This is a note"
      ```
    </ResponseField>

    <ResponseField name="patient_details" type="object">
      *Description coming soon*

      ```json CEL theme={null}
      patient_details
      ```

      ```json Example theme={null}
      {
      "email": "patient@gmail.com",
      "first_name": "John",
      "last_name": "Doe",
      "phone_number": "+5551231234"
      }
      ```
    </ResponseField>

    <ResponseField name="patient_details.email" type="string">
      Email address of the patient

      ```json CEL theme={null}
      patient_details.email
      ```

      ```json Example theme={null}
      "patient@gmail.com"
      ```
    </ResponseField>

    <ResponseField name="patient_details.first_name" type="string">
      Patient's first name

      ```json CEL theme={null}
      patient_details.first_name
      ```

      ```json Example theme={null}
      "John"
      ```
    </ResponseField>

    <ResponseField name="patient_details.last_name" type="string">
      Patient's last name

      ```json CEL theme={null}
      patient_details.last_name
      ```

      ```json Example theme={null}
      "Doe"
      ```
    </ResponseField>

    <ResponseField name="patient_details.phone_number" type="string">
      Patient's phone number

      ```json CEL theme={null}
      patient_details.phone_number
      ```

      ```json Example theme={null}
      "+5551231234"
      ```
    </ResponseField>

    <ResponseField name="physician" type="object">
      *Description coming soon*

      ```json CEL theme={null}
      physician
      ```

      ```json Example theme={null}
      {
      "first_name": "Joseph",
      "last_name": "Lister",
      "npi": "1093125863"
      }
      ```
    </ResponseField>

    <ResponseField name="physician.first_name" type="string">
      Physician's first name

      ```json CEL theme={null}
      physician.first_name
      ```

      ```json Example theme={null}
      "Joseph"
      ```
    </ResponseField>

    <ResponseField name="physician.last_name" type="string">
      Physician's last name

      ```json CEL theme={null}
      physician.last_name
      ```

      ```json Example theme={null}
      "Lister"
      ```
    </ResponseField>

    <ResponseField name="physician.npi" type="string">
      National Provider Identifier

      ```json CEL theme={null}
      physician.npi
      ```

      ```json Example theme={null}
      "1093125863"
      ```
    </ResponseField>

    <ResponseField name="is_labcorp_stat_order" type="bool" required>
      Whether this is a STAT (urgent) LabCorp order

      ```json CEL theme={null}
      is_labcorp_stat_order
      ```

      ```json Example theme={null}
      false
      ```
    </ResponseField>

    <ResponseField name="sample_id" type="string">
      Unique identifier for the sample

      ```json CEL theme={null}
      sample_id
      ```

      ```json Example theme={null}
      "QDWYKK7PAP23"
      ```
    </ResponseField>

    <ResponseField name="status" type="string">
      Current status of the order

      ```json CEL theme={null}
      status
      ```

      ```json Example theme={null}
      "completed"
      ```
    </ResponseField>

    <ResponseField name="events" type="[]object" required>
      *Description coming soon*

      ```json CEL theme={null}
      events
      ```

      ```json Example theme={null}
      [
      {
      "created_at": "2023-09-08T13:40:36.628095+00:00",
      "id": 4182,
      "status": "received.walk_in_test.ordered"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="events.map(x, x.id)" type="[]int64" required>
      Mapped array of: Unique identifier for the event

      ```json CEL theme={null}
      events.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      4182
      ]
      ```
    </ResponseField>

    <ResponseField name="events.map(x, x.created_at)" type="[]timing.v1.Timestamp" required>
      Mapped array of: When this event occurred

      ```json CEL theme={null}
      events.map(x, x.created_at)
      ```

      ```json Example theme={null}
      [
      "2023-09-08T13:40:36.628095+00:00"
      ]
      ```
    </ResponseField>

    <ResponseField name="events.map(x, x.status)" type="[]string" required>
      Mapped array of: Status update from this event

      ```json CEL theme={null}
      events.map(x, x.status)
      ```

      ```json Example theme={null}
      [
      "received.walk_in_test.ordered"
      ]
      ```
    </ResponseField>

    <ResponseField name="created_at" type="timing.v1.Timestamp" required>
      When this order was created

      ```json CEL theme={null}
      created_at
      ```

      ```json Example theme={null}
      "2023-09-08T13:40:25.443240+00:00"
      ```
    </ResponseField>

    <ResponseField name="updated_at" type="timing.v1.Timestamp" required>
      When this order was last updated

      ```json CEL theme={null}
      updated_at
      ```

      ```json Example theme={null}
      "2023-09-08T13:42:51.206896+00:00"
      ```
    </ResponseField>
  </Expandable>
</ResponseField>
