{
 "openapi": "3.1.0",
 "info": {
  "title": "Workflows (Platform)",
  "version": "20261030b",
  "description": "A trigger, a condition and a list of steps. Run one by hand to see exactly what it would do before letting an event drive it."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "workflows": {
    "type": "object",
    "required": [
     "code",
     "name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "code": {
      "type": "string",
      "description": "Workflow code"
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "description": {
      "type": "string",
      "description": "What it does"
     },
     "category": {
      "type": "string",
      "description": "Category",
      "enum": [
       "automation",
       "approval",
       "integration",
       "notification",
       "data_quality",
       "escalation"
      ]
     },
     "trigger_type": {
      "type": "string",
      "description": "Trigger"
     },
     "trigger_event": {
      "type": "string",
      "description": "Event"
     },
     "trigger_module": {
      "type": "string",
      "description": "Module",
      "enum": [
       "accounting",
       "crm",
       "hrms",
       "scm",
       "mfg",
       "ehr",
       "slcm",
       "ats",
       "platform"
      ]
     },
     "schedule_cron": {
      "type": "string",
      "description": "Schedule (cron)"
     },
     "condition": {
      "type": "object",
      "description": "Condition"
     },
     "status": {
      "type": "string",
      "description": "Status",
      "enum": [
       "draft",
       "active",
       "paused",
       "archived"
      ]
     },
     "run_count": {
      "type": "integer",
      "description": "Run count",
      "readOnly": true
     },
     "success_count": {
      "type": "integer",
      "description": "Success count",
      "readOnly": true
     },
     "failure_count": {
      "type": "integer",
      "description": "Failure count",
      "readOnly": true
     },
     "last_run_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last run at",
      "readOnly": true
     },
     "owner_id": {
      "type": "string",
      "format": "uuid",
      "description": "Owner"
     },
     "max_retries": {
      "type": "integer",
      "description": "Maximum retries"
     },
     "timeout_seconds": {
      "type": "integer",
      "description": "Timeout (seconds)"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "next_due_at": {
      "type": "string",
      "format": "date-time",
      "description": "Next due at",
      "readOnly": true
     },
     "schedule_zone": {
      "type": "string",
      "description": "Schedule zone",
      "readOnly": true
     },
     "schedule_claimed_by": {
      "type": "string",
      "description": "Schedule claimed by",
      "readOnly": true
     },
     "schedule_claimed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Schedule claimed at",
      "readOnly": true
     },
     "schedule_error": {
      "type": "string",
      "description": "Schedule error",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/platform/workflows": {
   "get": {
    "summary": "list workflows",
    "operationId": "list_workflows_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create workflows",
    "operationId": "create_workflows_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/workflows/{id}": {
   "get": {
    "summary": "get workflows",
    "operationId": "get_workflows_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change workflows",
    "operationId": "change_workflows_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete workflows",
    "operationId": "delete_workflows_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/workflows/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_workflows_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/workflows/{parentId}/steps": {
   "get": {
    "summary": "Steps",
    "operationId": "action_workflows_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Steps",
    "operationId": "action_workflows_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/workflows/{parentId}/steps/{lineId}": {
   "put": {
    "summary": "Steps",
    "operationId": "action_workflows_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Steps",
    "operationId": "action_workflows_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/workflows/{id}/run": {
   "post": {
    "summary": "Run",
    "operationId": "action_workflows_0_6",
    "description": "Body keys: input",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/workflows/dispatch": {
   "post": {
    "summary": "Dispatch",
    "operationId": "action_workflows_0_5",
    "description": "Body keys: eventType*, payload",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}