> ## Documentation Index
> Fetch the complete documentation index at: https://docs.calseta.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Execute Workflow

> Enqueue a workflow for execution. Returns 202 Accepted immediately.

The trigger source is derived from the API key's `key_type` field —
agent keys always trigger as "agent", human keys as "human". This
cannot be overridden by the request body.

Approval gate (based on workflow.approval_mode):
- If approval_mode="always": all triggers go through approval gate.
- If approval_mode="agent_only": only agent triggers require approval.
- If approval_mode="never": no approval required, immediate execution.

When the approval gate fires, creates an approval request, enqueues a
notification, and returns:
  {"status": "pending_approval", "approval_request_uuid": "...", "expires_at": "..."}

When key_type="agent", both `reason` and `confidence` are required.



## OpenAPI

````yaml POST /v1/workflows/{workflow_uuid}/execute
openapi: 3.1.0
info:
  title: Calseta
  description: SOC data platform for security agent consumption
  version: dev
servers: []
security: []
paths:
  /v1/workflows/{workflow_uuid}/execute:
    post:
      tags:
        - workflows
      summary: Execute Workflow
      description: |-
        Enqueue a workflow for execution. Returns 202 Accepted immediately.

        The trigger source is derived from the API key's `key_type` field —
        agent keys always trigger as "agent", human keys as "human". This
        cannot be overridden by the request body.

        Approval gate (based on workflow.approval_mode):
        - If approval_mode="always": all triggers go through approval gate.
        - If approval_mode="agent_only": only agent triggers require approval.
        - If approval_mode="never": no approval required, immediate execution.

        When the approval gate fires, creates an approval request, enqueues a
        notification, and returns:
          {"status": "pending_approval", "approval_request_uuid": "...", "expires_at": "..."}

        When key_type="agent", both `reason` and `confidence` are required.
      operationId: execute_workflow_v1_workflows__workflow_uuid__execute_post
      parameters:
        - name: workflow_uuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workflow Uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowExecuteAgentRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataResponse_WorkflowExecuteResponse_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    WorkflowExecuteAgentRequest:
      properties:
        indicator_type:
          type: string
          title: Indicator Type
        indicator_value:
          type: string
          title: Indicator Value
        alert_uuid:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Alert Uuid
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
        confidence:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Confidence
      type: object
      required:
        - indicator_type
        - indicator_value
      title: WorkflowExecuteAgentRequest
      description: |-
        Request body for POST /v1/workflows/{uuid}/execute.

        The trigger source is NOT a request field — it is derived server-side
        from the API key's ``key_type`` (``human`` or ``agent``). Agent keys
        must also provide ``reason`` and ``confidence`` for the approval gate.
    DataResponse_WorkflowExecuteResponse_:
      properties:
        data:
          $ref: '#/components/schemas/WorkflowExecuteResponse'
        meta:
          additionalProperties: true
          type: object
          title: Meta
      type: object
      required:
        - data
      title: DataResponse[WorkflowExecuteResponse]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorkflowExecuteResponse:
      properties:
        run_uuid:
          type: string
          format: uuid
          title: Run Uuid
        status:
          type: string
          title: Status
      type: object
      required:
        - run_uuid
        - status
      title: WorkflowExecuteResponse
      description: Response for POST /v1/workflows/{uuid}/execute (202 Accepted).
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````