Create new workflow

POST/workflows

Creates a new workflow definition with graph generation from workflow instructions

RequiresBearerauthentication

Query parameters

verbosebooleanoptionaldefault false

If true, includes full workflow implementation details in workflow_details field

Body parameters

namestringrequired

Human-readable name for the workflow

workflow_instructionsstringrequired

Natural language instructions that define the workflow logic

sample_dataobjectrequired

Sample data to use for workflow graph generation

fhir_provider_idoneOfrequired

FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers

dynamic_generationbooleanoptional

Enable dynamic lang2fhir calls instead of pre-populated templates

Returns  

Successfully created workflow

Response fields

successbooleanoptional

Whether the workflow was created successfully

messagestringoptional

Status message

workflow_idstring (uuid)optional

ID of the created workflow

workflowobjectoptional

Simplified workflow representation without implementation details

idstring (uuid)optional

Unique identifier for the workflow

namestringoptional

Human-readable name for the workflow

workflow_instructionsstringoptional

Natural language instructions that define the workflow logic

sample_dataobjectoptional

Sample data used for workflow graph generation

configobjectoptional
fhir_provider_idsstring (uuid)[]optional

FHIR provider IDs for executing workflow steps

dynamic_generationbooleanoptional

Whether to use dynamic lang2fhir generation instead of pre-populated templates

graphobjectoptional
stepsobject[]optional

Simplified list of workflow steps without operation details

created_atstring (date-time)optional

Timestamp when the workflow was created

updated_atstring (date-time)optional

Timestamp when the workflow was last updated

workflow_detailsobjectoptional

Only included when verbose=true - contains full implementation details including operation definitions and placeholders

idstring (uuid)optional

Unique identifier for the workflow

namestringoptional

Human-readable name for the workflow

workflow_instructionsstringoptional

Natural language instructions that define the workflow logic

sample_dataobjectoptional

Sample data used for workflow graph generation

configobjectoptional
fhir_provider_idsstring (uuid)[]optional

FHIR provider IDs for executing workflow steps

dynamic_generationbooleanoptional

Whether to use dynamic lang2fhir generation instead of pre-populated templates

graphobjectoptional
stepsobject[]optional

Ordered list of workflow execution steps

created_atstring (date-time)optional

Timestamp when the workflow was created

updated_atstring (date-time)optional

Timestamp when the workflow was last updated

POSTRequest
curl -X POST 'https://experiment.app.pheno.ml/workflows' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Patient Data Mapping Workflow",
  "workflow_instructions": "Given diagnosis data, find the patient and create a condition record linked to their encounter",
  "sample_data": {
    "patient_last_name": "Rippin",
    "patient_first_name": "Clay",
    "diagnosis_code": "I10",
    "encounter_date": "2024-01-15"
  },
  "fhir_provider_id": "550e8400-e29b-41d4-a716-446655440000"
}'
200 OKResponse
{
  "success": true,
  "message": "Workflow created successfully",
  "workflow_id": "7a8b9c0d-1234-5678-abcd-ef9876543210",
  "workflow": {
    "id": "7a8b9c0d-1234-5678-abcd-ef9876543210",
    "name": "Patient Data Mapping Workflow",
    "workflow_instructions": "Given diagnosis data, find the patient and create a condition record linked to their encounter",
    "sample_data": {
      "patient_last_name": "Rippin",
      "patient_first_name": "Clay",
      "diagnosis_code": "I10",
      "encounter_date": "2024-01-15"
    },
    "created_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-01-15T09:30:00Z"
  }
}