# Moose / Apis / Trigger Api Documentation – Python ## Included Files 1. moose/apis/trigger-api/trigger-api.mdx ## Trigger APIs Source: moose/apis/trigger-api/trigger-api.mdx Create APIs that trigger workflows and other processes # Trigger APIs ## Overview You can create APIs to initiate workflows, data processing jobs, or other automated processes. ## Basic Usage ```python filename="app/apis/trigger_workflow.py" copy from moose_lib import MooseClient, Api from pydantic import BaseModel, Field from datetime import datetime class WorkflowParams(BaseModel): input_value: str priority: str = Field(default="normal") class WorkflowResponse(BaseModel): workflow_id: str status: str def run(params: WorkflowParams, client: MooseClient) -> WorkflowResponse: # Trigger the workflow with input parameters workflow_execution = client.workflow.execute( workflow="data-processing", params={ "input_value": params.input_value, "priority": params.priority, "triggered_at": datetime.now().isoformat() } ) return WorkflowResponse( workflow_id=workflow_execution.id, status="started" ) api = Api[WorkflowParams, WorkflowResponse]("trigger-workflow", run) ``` ## Using the Trigger API Once deployed, you can trigger workflows via HTTP requests: ```bash filename="Terminal" copy curl "http://localhost:4000/api/trigger-workflow?inputValue=process-user-data&priority=high" ``` Response: ```json { "workflowId": "workflow-12345", "status": "started" } ```