Execute workflow

POST/workflows/{id}/execute

Executes a workflow with provided input data and returns results

RequiresBearerauthentication

Path parameters

idstring (uuid)required

ID of the workflow to execute

Body parameters

input_dataobjectrequired

Input data for workflow execution

previewbooleanoptionaldefault false

If true, create operations return mock resources instead of persisting to the FHIR server

Returns  

Successfully executed workflow

Response fields

successbooleanoptional

Whether the workflow execution was successful

messagestringoptional

Status message with execution details

resultsobjectoptional
stepsobjectoptional

Results for each executed workflow step, keyed by step ID

previewbooleanoptional

Whether the workflow was executed in preview mode

POSTRequest
curl -X POST 'https://experiment.app.pheno.ml/workflows/7a8b9c0d-1234-5678-abcd-ef9876543210/execute' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "input_data": {
    "patient_last_name": "Johnson",
    "patient_first_name": "Mary",
    "diagnosis_code": "M79.3",
    "encounter_date": "2024-03-20"
  }
}'
200 OKResponse
{
  "success": true,
  "message": "Workflow executed successfully",
  "results": {
    "steps": {
      "step_1_id": {
        "type": "search_result",
        "original_query": "find patient by first name Mary and last name Johnson",
        "resource_type": "Patient",
        "search_params": {
          "family": "Johnson",
          "given": "Mary"
        },
        "results": [
          {
            "resourceType": "Patient",
            "id": "patient-123",
            "name": [
              {
                "family": "Johnson",
                "given": [
                  "Mary"
                ],
                "use": "usual"
              }
            ],
            "gender": "female",
            "birthDate": "1961-01-01"
          }
        ]
      },
      "step_2_id": {
        "type": "create_result",
        "id": "condition-456",
        "resource_type": "Condition",
        "original_desc": "create condition with diagnosis code M79.3 for the patient from step_1_id",
        "preview": false,
        "created_resource": {
          "resourceType": "Condition",
          "id": "condition-456",
          "clinicalStatus": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
                "code": "active"
              }
            ]
          },
          "code": {
            "coding": [
              {
                "system": "http://hl7.org/fhir/sid/icd-10",
                "code": "M79.3",
                "display": "Panniculitis, unspecified"
              }
            ]
          },
          "subject": {
            "reference": "Patient/patient-123"
          }
        }
      }
    }
  },
  "preview": false
}