API ReferenceapiclinicalPOST /v1/webhooks/junction

POST /v1/webhooks/junction

Service: clinical · operationId: (none)

Receive Junction lab result webhooks and ingest parsed biomarkers

Required scopes

(no scope declared — review service config)

Required headers

  • svix-id
  • svix-timestamp
  • svix-signature
  • x-webhook-signature
  • x-junction-signature
  • x-signature

Request body

{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "event_type": {
          "type": "string",
          "enum": [
            "labtest.result.ready",
            "labtest.result.critical"
          ]
        },
        "user_id": {
          "type": "string"
        },
        "client_user_id": {
          "type": "string"
        },
        "team_id": {
          "type": "string"
        },
        "data": {
          "type": "object",
          "properties": {
            "order_id": {
              "type": "string"
            },
            "sample_id": {
              "type": "string"
            },
            "status": {
              "type": "string"
            },
            "interpretation": {
              "type": [
                "string",
                "null"
              ]
            },
            "collected_at": {
              "type": "string",
              "minLength": 1
            },
            "reported_at": {
              "type": "string",
              "minLength": 1
            },
            "marker_count": {
              "type": "integer",
              "minimum": 0
            },
            "critical_marker_count": {
              "type": "integer",
              "minimum": 0
            },
            "markers": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "unit": {
                    "type": "string",
                    "minLength": 1
                  },
                  "value": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "min_range_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "max_range_value": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "interpretation": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 1
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              },
              "default": []
            }
          }
        }
      },
      "required": [
        "event_type",
        "data"
      ]
    },
    {
      "type": "object",
      "properties": {
        "event_type": {
          "type": "string",
          "enum": [
            "order.completed",
            "order.cancelled"
          ]
        },
        "user_id": {
          "type": "string"
        },
        "client_user_id": {
          "type": "string"
        },
        "team_id": {
          "type": "string"
        },
        "data": {
          "type": "object",
          "properties": {
            "order_id": {
              "type": "string",
              "minLength": 1
            },
            "status": {
              "type": "string",
              "minLength": 1
            },
            "cancellation_reason": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "order_id",
            "status"
          ]
        }
      },
      "required": [
        "event_type",
        "data"
      ]
    }
  ]
}

Responses

200 Webhook received and processed

{
  "type": "object",
  "properties": {
    "received": {
      "type": "boolean",
      "enum": [
        true
      ]
    },
    "event_type": {
      "type": "string"
    },
    "ingested_count": {
      "type": "integer",
      "minimum": 0
    },
    "ignored": {
      "type": "boolean"
    }
  },
  "required": [
    "received",
    "event_type"
  ]
}

400 Validation error

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

401 Signature verification failed

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

500 Configuration error

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X POST https://clinical.platform.loop.health/v1/webhooks/junction \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'