Skip to main content

Unmatched Lab Results Integration Guide

The Unmatched Results API lets you review a lab result that could not be safely attached to an order automatically. You can accept a proposed match, reject the result, or ask the Junction operations team to review it. This guide covers:
  • receiving review notifications by webhook;
  • listing and retrieving unmatched results;
  • accepting, rejecting, or escalating a result; and
  • understanding the available match cases.
  1. Subscribe your webhook endpoint to labtest.match_review.created.
  2. When the webhook arrives, store its data.id as the unmatched-result ID.
  3. Fetch the full item with GET /v3/unmatched_result/{id}.
  4. Present the result, patient context, and candidate orders to a reviewer.
  5. Display only the actions listed in allowed_actions.
  6. Call the accept or resolve endpoint with the reviewer’s decision.
  7. Use the returned resource as the source of truth for the final state and store its order_transaction.id to track related orders.
You can also poll the list endpoint to reconcile missed or delayed webhook deliveries.

Webhook

Event type

The event is sent when an unmatched result first becomes available for customer review. An item that is only awaiting internal operations review does not emit this event. The webhook is a notification, not the complete review record. Fetch data.id from the API before displaying or resolving the item. Example payload:
Configure this event on your existing webhook destination; it does not require a separate callback URL. Verify each delivery using the signing secret for that destination, return a successful response promptly, and process repeated deliveries idempotently.

API endpoints

List unmatched results

Example:
Query parameters: Without a status filter, the endpoint returns actionable customer items and items that you escalated with unsure. Resolved items are excluded by default. Response:
Pass next_cursor unchanged into the next request. Do not parse or construct cursor values in your application.

Get one unmatched result

The response uses the same unmatched-result shape as an item in the list response. Important fields: Candidate confidence and reason codes are review aids; they do not replace human confirmation. A provenance_order is the order associated with the incoming sample or result history. An order_option is another order that may be a valid target.

Accept a match

Use accept only when it appears in allowed_actions. Request fields: If both user_id and order_id are supplied, the order must belong to that user. Send an empty object only when accepting the system’s unambiguous default target. For ambiguous demographic or no-match cases, explicitly select an order_id or user_id. Example:
The response is the standard lab order object. Depending on the decision case, acceptance may use the selected order or create/recreate an appropriate order. Always persist the order ID returned by this endpoint instead of assuming it is the same as a candidate order ID. An order transaction groups orders that belong to the same order lifecycle. For example, an original order and an order created to replace it can have different order IDs while sharing one order transaction ID. The candidate records expose order_transaction_id when one is available. The order returned by accept includes the authoritative order_transaction. An abridged response looks like:
Use order_transaction.id as the grouping key in your system and keep each individual order ID as a member of that group. Use parent_id to identify the direct predecessor and low_level_status to determine what happened to each order. Do not overwrite the original order ID with the replacement order ID or assume that a candidate order remains the active order after acceptance. You can retrieve all orders in the group with:
Always take the transaction from the order returned by accept. If acceptance creates an order for a different patient, its transaction may differ from the candidate transaction shown before review.

Reject or escalate a result

Request body:
Available actions: Example escalation:
The response is the updated unmatched result. After unsure, its status is pending_ops_review and allowed_actions is empty. After reject, its status is resolved and allowed_actions is empty.

Review statuses

Available decision cases

The decision_code describes why automatic matching stopped. Use the API’s reason, candidates, and allowed_actions together when presenting a case.

Candidate reason codes

Each candidate may include one or more machine-readable reasons:

Error handling

Because another reviewer may act on an item first, re-fetch the item after a failed action before prompting the user to retry. Never attempt to work around a 404 by using an ID from another team.

Integration checklist

  • Enable the unmatched-results review queue for the correct environment and team.
  • Subscribe the existing webhook destination to labtest.match_review.created.
  • Verify webhook signatures and handle repeated deliveries safely.
  • Fetch the full item from the API after receiving a webhook.
  • Use allowed_actions to control available review actions.
  • Require an explicit patient/order selection for ambiguous cases.
  • Store the order and order_transaction.id returned by accept.
  • Group related orders by transaction ID while retaining each individual order ID.
  • Reconcile outstanding items periodically with the list endpoint.