components:
  schemas:
    AIProvider:
      additionalProperties: true
      properties:
        api_key_secret_key:
          description: Global secret key that holds the API key.
          type: string
        auto_triage:
          type: boolean
        base_url:
          description: Empty uses the default URL of the type.
          type: string
        configured:
          type: boolean
        model:
          type: string
        type:
          enum:
            - anthropic
            - openai_compatible
          type: string
      required:
        - configured
        - auto_triage
      type: object
    AIProviderPut:
      additionalProperties: true
      properties:
        api_key_secret_key:
          pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
          type: string
        auto_triage:
          type: boolean
        base_url:
          maxLength: 512
          type: string
        model:
          maxLength: 200
          minLength: 1
          type: string
        type:
          enum:
            - anthropic
            - openai_compatible
          type: string
      required:
        - type
        - model
        - api_key_secret_key
      type: object
    AIStatus:
      additionalProperties: true
      properties:
        auto_triage:
          type: boolean
        enabled:
          type: boolean
      required:
        - enabled
        - auto_triage
      type: object
    AITestResult:
      additionalProperties: true
      properties:
        message:
          type: string
        status:
          enum:
            - ok
            - failed
          type: string
      required:
        - status
      type: object
    Artifact:
      additionalProperties: true
      properties:
        content_type:
          type: string
        created_at:
          format: date-time
          type: string
        id:
          type: string
        name:
          type: string
        size:
          format: int64
          type: integer
        task_key:
          type: string
        task_run_id:
          type: string
      required:
        - id
        - task_run_id
        - task_key
        - name
        - size
        - content_type
        - created_at
      type: object
    ArtifactList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/Artifact"
          type: array
      required:
        - items
      type: object
    Attachment:
      additionalProperties: true
      properties:
        execution_id:
          description: Execution UUID.
          type: string
        flow_id:
          description: Flow ID of a flow.
          type: string
        kind:
          enum:
            - flow
            - execution
            - file
          type: string
        namespace:
          description: Namespace of a flow or a file.
          type: string
        path:
          description: File path of a file.
          type: string
      required:
        - kind
      type: object
    AuditEvent:
      additionalProperties: true
      properties:
        action:
          type: string
        actor_id:
          type: string
        actor_label:
          type: string
        actor_type:
          enum:
            - user
            - token
            - system
            - ai
          type: string
        details:
          additionalProperties: {}
          type: object
        id:
          type: string
        ip:
          type: string
        target_id:
          type: string
        target_type:
          type: string
        ts:
          format: date-time
          type: string
      required:
        - id
        - ts
        - actor_type
        - actor_id
        - actor_label
        - action
        - target_type
        - target_id
        - details
        - ip
      type: object
    AuditList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/AuditEvent"
          type: array
        next_cursor:
          type: string
      required:
        - items
      type: object
    Block:
      additionalProperties: true
      properties:
        input: {}
        is_error:
          type: boolean
        label:
          type: string
        text:
          type: string
        tool_name:
          type: string
        tool_use_id:
          type: string
        type:
          type: string
      required:
        - type
      type: object
    BucketOut:
      additionalProperties: true
      properties:
        cancelled:
          format: int64
          type: integer
        failed:
          format: int64
          type: integer
        p50_ms:
          format: double
          type:
            - number
            - "null"
        p95_ms:
          format: double
          type:
            - number
            - "null"
        skipped:
          format: int64
          type: integer
        start:
          format: date-time
          type: string
        success:
          format: int64
          type: integer
        timed_out:
          format: int64
          type: integer
      required:
        - start
        - success
        - failed
        - timed_out
        - cancelled
        - skipped
        - p50_ms
        - p95_ms
      type: object
    ChangePasswordRequest:
      additionalProperties: true
      properties:
        current_password:
          maxLength: 1024
          type: string
        new_password:
          maxLength: 1024
          minLength: 10
          type: string
      required:
        - current_password
        - new_password
      type: object
    CheckResult:
      additionalProperties: true
      properties:
        message:
          type: string
        status:
          enum:
            - ok
            - not_found
            - access_denied
            - provider_error
          type: string
      required:
        - status
      type: object
    CheckSecretProviderRequest:
      additionalProperties: true
      properties:
        ref:
          maxLength: 512
          minLength: 1
          type: string
      required:
        - ref
      type: object
    Conversation:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        id:
          type: string
        title:
          type: string
      required:
        - id
        - title
        - created_at
      type: object
    ConversationDetail:
      additionalProperties: true
      properties:
        actions:
          items:
            $ref: "#/components/schemas/PendingAction"
          type: array
        created_at:
          format: date-time
          type: string
        id:
          type: string
        messages:
          items:
            $ref: "#/components/schemas/StoredMessage"
          type: array
        title:
          type: string
      required:
        - messages
        - actions
        - id
        - title
        - created_at
      type: object
    ConversationList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/Conversation"
          type: array
      required:
        - items
      type: object
    CountResult:
      additionalProperties: true
      properties:
        count:
          format: int64
          type: integer
      required:
        - count
      type: object
    CreateAIConversationRequest:
      additionalProperties: true
      properties:
        title:
          maxLength: 200
          type: string
      type: object
    CreateGitSourceRequest:
      additionalProperties: true
      properties:
        auth_type:
          enum:
            - none
            - https_token
            - ssh_key
          type: string
        branch:
          maxLength: 255
          minLength: 1
          type: string
        credential_secret_key:
          description: Global secret key with the token or the private key.
          maxLength: 128
          type: string
        known_hosts:
          maxLength: 65536
          type: string
        mappings:
          items:
            $ref: "#/components/schemas/MappingIO"
          maxItems: 100
          minItems: 1
          type: array
        name:
          pattern: ^[a-z0-9][a-z0-9_-]{0,62}$
          type: string
        poll_interval:
          description: Seconds between polls. Default 60.
          format: int64
          maximum: 86400
          minimum: 15
          type: integer
        repo_url:
          description: https or ssh URL.
          maxLength: 2048
          minLength: 1
          type: string
        webhook_secret_key:
          description: Global secret key with the webhook secret.
          maxLength: 128
          type: string
      required:
        - name
        - repo_url
        - branch
        - auth_type
        - mappings
      type: object
    CreateNamespaceRequest:
      additionalProperties: true
      properties:
        description:
          maxLength: 2000
          type: string
        name:
          maxLength: 128
          type: string
      required:
        - name
      type: object
    CreateSecretProviderRequest:
      additionalProperties: true
      properties:
        config:
          additionalProperties: {}
          type: object
        name:
          pattern: ^[a-z0-9][a-z0-9_-]{0,62}$
          type: string
        type:
          enum:
            - kubernetes
            - azure_key_vault
            - vault
          type: string
      required:
        - name
        - type
      type: object
    CreateTokenRequest:
      additionalProperties: true
      properties:
        expires_in_days:
          format: int64
          maximum: 365
          minimum: 1
          type: integer
        name:
          maxLength: 100
          minLength: 1
          type: string
        role:
          enum:
            - viewer
            - operator
            - editor
            - admin
          type: string
      required:
        - name
        - role
      type: object
    CreateUserRequest:
      additionalProperties: true
      properties:
        email:
          format: email
          maxLength: 320
          type: string
        name:
          maxLength: 200
          type: string
        password:
          description: Temporary password. The user must change it at first login.
          maxLength: 1024
          minLength: 10
          type: string
        role:
          enum:
            - viewer
            - operator
            - editor
            - admin
          type: string
      required:
        - email
        - role
        - password
      type: object
    CreatedToken:
      additionalProperties: true
      properties:
        secret:
          type: string
        token:
          $ref: "#/components/schemas/Token"
      required:
        - token
        - secret
      type: object
    DashboardOut:
      additionalProperties: true
      properties:
        bucket_seconds:
          format: int64
          type: integer
        buckets:
          items:
            $ref: "#/components/schemas/BucketOut"
          type: array
        from:
          format: date-time
          type: string
        kpis:
          $ref: "#/components/schemas/KPIsOut"
        range:
          enum:
            - 24h
            - 7d
            - 30d
          type: string
        recent_failures:
          items:
            $ref: "#/components/schemas/ExecutionOut"
          type: array
        running:
          items:
            $ref: "#/components/schemas/ExecutionOut"
          type: array
        to:
          format: date-time
          type: string
      required:
        - range
        - from
        - to
        - bucket_seconds
        - kpis
        - buckets
        - running
        - recent_failures
      type: object
    ErrorBody:
      additionalProperties: true
      properties:
        code:
          type: string
        details: {}
        message:
          type: string
      required:
        - code
        - message
      type: object
    ErrorEnvelope:
      additionalProperties: true
      properties:
        error:
          $ref: "#/components/schemas/ErrorBody"
      required:
        - error
      type: object
    Evidence:
      additionalProperties: true
      properties:
        line:
          format: int64
          type: integer
        task:
          type: string
        text:
          type: string
      required:
        - task
        - line
        - text
      type: object
    ExecutionDetail:
      additionalProperties: true
      properties:
        chain_depth:
          format: int64
          type: integer
        children:
          items:
            $ref: "#/components/schemas/ExecutionRef"
          type: array
        created_at:
          format: date-time
          type: string
        created_by:
          type: string
        duration_ms:
          format: int64
          type:
            - integer
            - "null"
        ended_at:
          format: date-time
          type:
            - string
            - "null"
        error:
          type: string
        flow_id:
          description: Flow ID. Null for file runs.
          type:
            - string
            - "null"
        flow_revision_id:
          type:
            - string
            - "null"
        git_sha:
          type: string
        id:
          type: string
        inputs:
          additionalProperties: {}
          type: object
        labels:
          additionalProperties:
            type: string
          type: object
        namespace:
          type: string
        outputs:
          additionalProperties: {}
          type:
            - object
            - "null"
        parent_execution_id:
          type:
            - string
            - "null"
        reason:
          type: string
        restart_of_id:
          type:
            - string
            - "null"
        secret_keys_used:
          items:
            type: string
          type: array
        snapshot_id:
          type: string
        snapshot_version:
          format: int64
          type:
            - integer
            - "null"
        started_at:
          format: date-time
          type:
            - string
            - "null"
        state:
          enum:
            - QUEUED
            - RUNNING
            - CANCELLING
            - SUCCESS
            - FAILED
            - TIMED_OUT
            - CANCELLED
            - SKIPPED
          type: string
        task_runs:
          items:
            $ref: "#/components/schemas/TaskRun"
          type: array
        trigger_payload:
          additionalProperties: {}
          type: object
        trigger_type:
          type: string
      required:
        - inputs
        - trigger_payload
        - snapshot_id
        - chain_depth
        - secret_keys_used
        - task_runs
        - children
        - id
        - namespace
        - state
        - trigger_type
        - labels
        - created_at
        - error
        - reason
        - created_by
      type: object
    ExecutionList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/ExecutionSummary"
          type: array
        next_cursor:
          type: string
      required:
        - items
      type: object
    ExecutionOut:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        duration_ms:
          format: int64
          type:
            - integer
            - "null"
        ended_at:
          format: date-time
          type:
            - string
            - "null"
        error:
          type: string
        flow_id:
          type: string
        id:
          type: string
        namespace:
          type: string
        started_at:
          format: date-time
          type:
            - string
            - "null"
        state:
          type: string
        triage_summary:
          type:
            - string
            - "null"
        trigger_type:
          type: string
      required:
        - id
        - namespace
        - flow_id
        - state
        - trigger_type
        - created_at
        - error
      type: object
    ExecutionRef:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        id:
          type: string
        state:
          type: string
      required:
        - id
        - state
        - created_at
      type: object
    ExecutionSummary:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        created_by:
          type: string
        duration_ms:
          format: int64
          type:
            - integer
            - "null"
        ended_at:
          format: date-time
          type:
            - string
            - "null"
        error:
          type: string
        flow_id:
          description: Flow ID. Null for file runs.
          type:
            - string
            - "null"
        id:
          type: string
        labels:
          additionalProperties:
            type: string
          type: object
        namespace:
          type: string
        reason:
          type: string
        started_at:
          format: date-time
          type:
            - string
            - "null"
        state:
          enum:
            - QUEUED
            - RUNNING
            - CANCELLING
            - SUCCESS
            - FAILED
            - TIMED_OUT
            - CANCELLED
            - SKIPPED
          type: string
        trigger_type:
          type: string
      required:
        - id
        - namespace
        - state
        - trigger_type
        - labels
        - created_at
        - error
        - reason
        - created_by
      type: object
    FileChange:
      additionalProperties: true
      properties:
        content:
          description: put only. UTF-8 text content.
          type: string
        content_base64:
          description: put only. Binary content as base64. Used instead of content.
          type: string
        executable:
          type: boolean
        new_path:
          description: rename only.
          maxLength: 512
          type: string
        op:
          enum:
            - put
            - delete
            - rename
          type: string
        path:
          maxLength: 512
          type: string
      required:
        - op
        - path
      type: object
    FileDiff:
      additionalProperties: true
      properties:
        binary:
          type: boolean
        diff:
          description: Unified diff for text files.
          type: string
        path:
          type: string
        status:
          enum:
            - added
            - removed
            - modified
          type: string
      required:
        - path
        - status
        - binary
        - diff
      type: object
    FileEntry:
      additionalProperties: true
      properties:
        executable:
          type: boolean
        hash:
          type: string
        path:
          type: string
        size:
          format: int64
          type: integer
      required:
        - path
        - size
        - hash
        - executable
      type: object
    FileList:
      additionalProperties: true
      properties:
        git_sha:
          type: string
        items:
          items:
            $ref: "#/components/schemas/FileEntry"
          type: array
        snapshot_id:
          type:
            - string
            - "null"
        version:
          format: int64
          type:
            - integer
            - "null"
      required:
        - items
      type: object
    FlowDetail:
      additionalProperties: true
      properties:
        description:
          type: string
        disabled:
          type: boolean
        error_count:
          format: int64
          type: integer
        flow_id:
          type: string
        id:
          type: string
        labels:
          additionalProperties:
            type: string
          type: object
        last_execution:
          $ref: "#/components/schemas/ExecutionRef"
        namespace:
          type: string
        path:
          type: string
        revision:
          $ref: "#/components/schemas/Revision"
        triggers:
          items:
            $ref: "#/components/schemas/TriggerInfo"
          type: array
        valid:
          type: boolean
      required:
        - id
        - namespace
        - flow_id
        - path
        - valid
        - disabled
        - description
        - error_count
        - triggers
      type: object
    FlowList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/FlowSummary"
          type: array
        next_cursor:
          type: string
      required:
        - items
      type: object
    FlowMetricsOut:
      additionalProperties: true
      properties:
        names:
          items:
            type: string
          type: array
        series:
          items:
            $ref: "#/components/schemas/MetricSeriesOut"
          type: array
      required:
        - names
        - series
      type: object
    FlowStatsOut:
      additionalProperties: true
      properties:
        recent:
          items:
            $ref: "#/components/schemas/ExecutionOut"
          type: array
      required:
        - recent
      type: object
    FlowSummary:
      additionalProperties: true
      properties:
        description:
          type: string
        disabled:
          type: boolean
        error_count:
          format: int64
          type: integer
        flow_id:
          type: string
        id:
          type: string
        labels:
          additionalProperties:
            type: string
          type: object
        last_execution:
          $ref: "#/components/schemas/ExecutionRef"
        namespace:
          type: string
        path:
          type: string
        valid:
          type: boolean
      required:
        - id
        - namespace
        - flow_id
        - path
        - valid
        - disabled
        - description
        - error_count
      type: object
    Insight:
      additionalProperties: true
      properties:
        confidence:
          enum:
            - ""
            - low
            - medium
            - high
          type: string
        created_at:
          format: date-time
          type: string
        error:
          type: string
        evidence:
          items:
            $ref: "#/components/schemas/Evidence"
          type: array
        execution_id:
          type: string
        id:
          type: string
        kind:
          enum:
            - triage
          type: string
        model:
          type: string
        probable_cause:
          type: string
        status:
          enum:
            - pending
            - running
            - done
            - failed
          type: string
        suggested_fix:
          type: string
        summary:
          type: string
      required:
        - id
        - execution_id
        - kind
        - status
        - summary
        - probable_cause
        - evidence
        - suggested_fix
        - confidence
        - model
        - error
        - created_at
      type: object
    InsightList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/Insight"
          type: array
      required:
        - items
      type: object
    Instance:
      additionalProperties: true
      properties:
        executors:
          items:
            type: string
          type: array
        heartbeat_at:
          format: date-time
          type: string
        hostname:
          type: string
        id:
          type: string
        online:
          type: boolean
        pools:
          items:
            type: string
          type: array
        started_at:
          format: date-time
          type: string
        version:
          type: string
      required:
        - id
        - hostname
        - version
        - pools
        - executors
        - started_at
        - heartbeat_at
        - online
      type: object
    InstanceList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/Instance"
          type: array
      required:
        - items
      type: object
    Issue:
      additionalProperties: true
      properties:
        code:
          type: string
        column:
          format: int64
          type: integer
        line:
          format: int64
          type: integer
        message:
          type: string
        path:
          type: string
      required:
        - code
        - path
        - line
        - column
        - message
      type: object
    KPIsOut:
      additionalProperties: true
      properties:
        cancelled:
          format: int64
          type: integer
        executions:
          description: Executions that ended in the range.
          format: int64
          type: integer
        failed:
          format: int64
          type: integer
        median_duration_ms:
          format: double
          type:
            - number
            - "null"
        running:
          description: Executions that run now.
          format: int64
          type: integer
        skipped:
          format: int64
          type: integer
        succeeded:
          format: int64
          type: integer
        success_rate:
          description: SUCCESS / (SUCCESS + FAILED + TIMED_OUT) in the range.
          format: double
          type:
            - number
            - "null"
        timed_out:
          format: int64
          type: integer
      required:
        - executions
        - succeeded
        - failed
        - timed_out
        - cancelled
        - skipped
        - running
        - success_rate
        - median_duration_ms
      type: object
    LogEntry:
      additionalProperties: true
      properties:
        attempt:
          format: int64
          type: integer
        "n":
          description: 1-based line number in the task run.
          format: int64
          type: integer
        stream:
          enum:
            - stdout
            - stderr
            - system
          type: string
        task_key:
          type: string
        task_run_id:
          type: string
        text:
          type: string
        ts:
          format: date-time
          type: string
      required:
        - task_run_id
        - task_key
        - attempt
        - "n"
        - ts
        - stream
        - text
      type: object
    LogPage:
      additionalProperties: true
      properties:
        done:
          description: True when the execution ended and no more lines follow.
          type: boolean
        lines:
          items:
            $ref: "#/components/schemas/LogEntry"
          type: array
        next_cursor:
          type: string
      required:
        - lines
        - done
      type: object
    LoginRequest:
      additionalProperties: true
      properties:
        email:
          maxLength: 320
          minLength: 3
          type: string
        password:
          maxLength: 1024
          minLength: 1
          type: string
      required:
        - email
        - password
      type: object
    MappingIO:
      additionalProperties: true
      properties:
        namespace:
          maxLength: 128
          type: string
        repo_path:
          description: Directory in the repository. Empty is the repository root.
          maxLength: 512
          type: string
      required:
        - repo_path
        - namespace
      type: object
    Me:
      additionalProperties: true
      properties:
        auth_type:
          enum:
            - session
            - token
          type: string
        email:
          type: string
        id:
          type: string
        must_change_password:
          type: boolean
        name:
          type: string
        role:
          enum:
            - viewer
            - operator
            - editor
            - admin
          type: string
      required:
        - id
        - email
        - name
        - role
        - must_change_password
        - auth_type
      type: object
    MessageIn:
      additionalProperties: true
      properties:
        attachments:
          items:
            $ref: "#/components/schemas/Attachment"
          maxItems: 5
          type: array
        text:
          maxLength: 20000
          minLength: 1
          type: string
      required:
        - text
      type: object
    MetricList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/MetricPoint"
          type: array
      required:
        - items
      type: object
    MetricPoint:
      additionalProperties: true
      properties:
        name:
          type: string
        tags:
          additionalProperties:
            type: string
          type: object
        task_key:
          type: string
        task_run_id:
          type: string
        ts:
          format: date-time
          type: string
        unit:
          type: string
        value:
          format: double
          type: number
      required:
        - task_run_id
        - task_key
        - name
        - value
        - unit
        - tags
        - ts
      type: object
    MetricPointOut:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        execution_id:
          type: string
        value:
          format: double
          type: number
      required:
        - execution_id
        - created_at
        - value
      type: object
    MetricSeriesOut:
      additionalProperties: true
      properties:
        group:
          description: Value of the group-by tag. Empty when the tag is missing or no group-by is set.
          type: string
        points:
          items:
            $ref: "#/components/schemas/MetricPointOut"
          type: array
      required:
        - group
        - points
      type: object
    Namespace:
      additionalProperties: true
      properties:
        description:
          type: string
        git_source_id:
          type:
            - string
            - "null"
        head_git_sha:
          type: string
        head_version:
          format: int64
          type:
            - integer
            - "null"
        implicit:
          description: True for a parent that exists only because of its children.
          type: boolean
        name:
          type: string
        parent:
          type: string
        read_only:
          type: boolean
        source_type:
          enum:
            - managed
            - git
            - implicit
          type: string
      required:
        - name
        - source_type
        - description
        - implicit
      type: object
    NamespaceGit:
      additionalProperties: true
      properties:
        branch:
          type: string
        last_error:
          type: string
        last_sync_at:
          format: date-time
          type:
            - string
            - "null"
        last_sync_status:
          type: string
        last_synced_sha:
          type: string
        repo_path:
          type: string
        repo_url:
          type: string
        source_id:
          type: string
        source_name:
          type: string
      required:
        - source_id
        - source_name
        - repo_url
        - branch
        - repo_path
        - last_synced_sha
        - last_sync_status
        - last_error
      type: object
    NamespaceList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/Namespace"
          type: array
      required:
        - items
      type: object
    PendingAction:
      additionalProperties: true
      properties:
        arguments: {}
        created_at:
          format: date-time
          type: string
        id:
          type: string
        status:
          enum:
            - pending
            - confirmed
            - rejected
          type: string
        tool:
          type: string
        tool_call_id:
          type: string
      required:
        - id
        - tool_call_id
        - tool
        - arguments
        - status
        - created_at
      type: object
    ProviderList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/ProviderOut"
          type: array
      required:
        - items
      type: object
    ProviderOut:
      additionalProperties: true
      properties:
        config:
          additionalProperties: {}
          type: object
        created_at:
          format: date-time
          type: string
        name:
          type: string
        type:
          enum:
            - builtin
            - env
            - kubernetes
            - azure_key_vault
            - vault
          type: string
        updated_at:
          format: date-time
          type: string
      required:
        - name
        - type
        - config
        - created_at
        - updated_at
      type: object
    PushChange:
      additionalProperties: true
      properties:
        content:
          description: put only. UTF-8 text content.
          type: string
        content_base64:
          description: put only. Binary content as base64.
          type: string
        executable:
          type: boolean
        new_path:
          description: rename only.
          maxLength: 512
          type: string
        op:
          enum:
            - put
            - delete
            - rename
          type: string
        path:
          maxLength: 512
          type: string
      required:
        - op
        - path
      type: object
    PushNamespaceBranchRequest:
      additionalProperties: true
      properties:
        changes:
          items:
            $ref: "#/components/schemas/PushChange"
          maxItems: 1000
          minItems: 1
          type: array
        message:
          maxLength: 2000
          minLength: 1
          type: string
      required:
        - message
        - changes
      type: object
    PushResult:
      additionalProperties: true
      properties:
        branch:
          type: string
        sha:
          type: string
      required:
        - branch
        - sha
      type: object
    ResetPasswordRequest:
      additionalProperties: true
      properties:
        password:
          maxLength: 1024
          minLength: 10
          type: string
      required:
        - password
      type: object
    RevertRequest:
      additionalProperties: true
      properties:
        message:
          maxLength: 500
          type: string
        version:
          format: int64
          minimum: 1
          type: integer
      required:
        - version
      type: object
    Revision:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        definition:
          additionalProperties: {}
          type:
            - object
            - "null"
        errors:
          items:
            $ref: "#/components/schemas/Issue"
          type: array
        git_sha:
          type: string
        id:
          type: string
        message:
          type: string
        path:
          type: string
        snapshot_version:
          format: int64
          type:
            - integer
            - "null"
        source:
          type: string
        valid:
          type: boolean
      required:
        - id
        - created_at
        - path
        - source
        - valid
        - errors
      type: object
    RevisionList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/RevisionSummary"
          type: array
      required:
        - items
      type: object
    RevisionSummary:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        error_count:
          format: int64
          type: integer
        git_sha:
          type: string
        id:
          type: string
        message:
          type: string
        snapshot_version:
          format: int64
          type:
            - integer
            - "null"
        valid:
          type: boolean
      required:
        - id
        - created_at
        - valid
        - error_count
      type: object
    RunFileRequest:
      additionalProperties: true
      properties:
        args:
          items:
            type: string
          maxItems: 100
          type: array
        path:
          maxLength: 512
          type: string
      required:
        - path
      type: object
    RunList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/RunOut"
          type: array
      required:
        - items
      type: object
    RunOut:
      additionalProperties: true
      properties:
        ended_at:
          format: date-time
          type:
            - string
            - "null"
        error:
          type: string
        id:
          type: string
        sha:
          type: string
        snapshots_created:
          format: int64
          type: integer
        started_at:
          format: date-time
          type: string
        status:
          enum:
            - running
            - success
            - failed
          type: string
        warnings:
          items:
            type: string
          type: array
      required:
        - id
        - started_at
        - sha
        - status
        - error
        - warnings
        - snapshots_created
      type: object
    RunnerComplete:
      additionalProperties: true
      properties:
        error:
          type: string
        exit_code:
          format: int64
          type: integer
        reason:
          type: string
      required:
        - exit_code
        - error
      type: object
    RunnerEvent:
      additionalProperties: true
      properties:
        key:
          type: string
        name:
          type: string
        tags:
          additionalProperties:
            type: string
          type: object
        ts:
          format: date-time
          type: string
        type:
          enum:
            - output
            - metric
          type: string
        unit:
          type: string
        value: {}
      required:
        - type
      type: object
    RunnerEventBatch:
      additionalProperties: true
      properties:
        events:
          items:
            $ref: "#/components/schemas/RunnerEvent"
          maxItems: 1000
          type: array
        seq:
          format: int64
          minimum: 1
          type: integer
      required:
        - seq
        - events
      type: object
    RunnerHeartbeatResponse:
      additionalProperties: true
      properties:
        cancel:
          type: boolean
      required:
        - cancel
      type: object
    RunnerLimits:
      additionalProperties: true
      properties:
        max_artifact_bytes:
          format: int64
          type: integer
        max_bundle_bytes:
          format: int64
          type: integer
      required:
        - max_artifact_bytes
        - max_bundle_bytes
      type: object
    RunnerLogBatch:
      additionalProperties: true
      properties:
        lines:
          items:
            $ref: "#/components/schemas/RunnerLogLine"
          type: array
        seq:
          format: int64
          minimum: 1
          type: integer
      required:
        - seq
        - lines
      type: object
    RunnerLogLine:
      additionalProperties: true
      properties:
        stream:
          enum:
            - stdout
            - stderr
            - system
          type: string
        text:
          type: string
        ts:
          format: date-time
          type: string
      required:
        - ts
        - stream
        - text
      type: object
    RunnerSpec:
      additionalProperties: true
      properties:
        attempt:
          format: int64
          type: integer
        bundle_hash:
          type: string
        command:
          items:
            type: string
          type: array
        env:
          additionalProperties:
            type: string
          type: object
        execution_id:
          type: string
        files:
          additionalProperties:
            type: string
          type: object
        flow_id:
          type: string
        limits:
          $ref: "#/components/schemas/RunnerLimits"
        mask_values:
          items:
            type: string
          type: array
        namespace:
          type: string
        runtime:
          type: string
        task_id:
          type: string
        task_run_id:
          type: string
        timeout_seconds:
          format: int64
          type: integer
        workdir:
          type: string
      required:
        - task_run_id
        - execution_id
        - namespace
        - flow_id
        - task_id
        - attempt
        - command
        - workdir
        - env
        - timeout_seconds
        - mask_values
        - bundle_hash
        - limits
      type: object
    SaveChangesRequest:
      additionalProperties: true
      properties:
        base_version:
          description: Fails with 409 version_conflict when the head version differs.
          format: int64
          type: integer
        changes:
          items:
            $ref: "#/components/schemas/FileChange"
          maxItems: 1000
          minItems: 1
          type: array
        message:
          maxLength: 500
          minLength: 1
          type: string
      required:
        - message
        - changes
      type: object
    SecretInfo:
      additionalProperties: true
      properties:
        description:
          type: string
        inherited:
          description: True when a parent namespace or the global scope defines the secret.
          type: boolean
        key:
          type: string
        last_resolved_at:
          format: date-time
          type:
            - string
            - "null"
        provider:
          type: string
        provider_type:
          enum:
            - builtin
            - env
            - kubernetes
            - azure_key_vault
            - vault
          type: string
        ref:
          description: Reference of an external secret. Builtin secrets have none.
          type: string
        scope:
          description: global or the namespace name that defines the secret.
          type: string
        updated_at:
          format: date-time
          type: string
        updated_by:
          type: string
      required:
        - key
        - scope
        - provider
        - provider_type
        - description
        - updated_by
        - updated_at
        - inherited
      type: object
    SecretList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/SecretInfo"
          type: array
      required:
        - items
      type: object
    SecretPut:
      additionalProperties: true
      properties:
        description:
          maxLength: 500
          type: string
        provider:
          description: Provider name. Default builtin, or the provider of the existing secret.
          maxLength: 63
          type: string
        ref:
          description: Reference of an external secret, for example path#field for vault.
          maxLength: 512
          type: string
        value:
          description: Value of a builtin secret. Write-only.
          maxLength: 65536
          minLength: 1
          type: string
          writeOnly: true
      type: object
    Snapshot:
      additionalProperties: true
      properties:
        author:
          type: string
        created_at:
          format: date-time
          type: string
        file_count:
          format: int64
          type: integer
        git_sha:
          type: string
        id:
          type: string
        manifest_hash:
          type: string
        message:
          type: string
        version:
          format: int64
          type:
            - integer
            - "null"
      required:
        - id
        - message
        - author
        - created_at
        - manifest_hash
        - file_count
      type: object
    SnapshotList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/Snapshot"
          type: array
      required:
        - items
      type: object
    SourceBody:
      additionalProperties: true
      properties:
        auth_type:
          enum:
            - none
            - https_token
            - ssh_key
          type: string
        branch:
          maxLength: 255
          minLength: 1
          type: string
        credential_secret_key:
          description: Global secret key with the token or the private key.
          maxLength: 128
          type: string
        known_hosts:
          maxLength: 65536
          type: string
        mappings:
          items:
            $ref: "#/components/schemas/MappingIO"
          maxItems: 100
          minItems: 1
          type: array
        poll_interval:
          description: Seconds between polls. Default 60.
          format: int64
          maximum: 86400
          minimum: 15
          type: integer
        repo_url:
          description: https or ssh URL.
          maxLength: 2048
          minLength: 1
          type: string
        webhook_secret_key:
          description: Global secret key with the webhook secret.
          maxLength: 128
          type: string
      required:
        - repo_url
        - branch
        - auth_type
        - mappings
      type: object
    SourceList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/SourceOut"
          type: array
      required:
        - items
      type: object
    SourceOut:
      additionalProperties: true
      properties:
        auth_type:
          type: string
        branch:
          type: string
        credential_secret_key:
          type: string
        id:
          type: string
        known_hosts:
          type: string
        last_error:
          type: string
        last_sync_at:
          format: date-time
          type:
            - string
            - "null"
        last_sync_status:
          type: string
        last_synced_sha:
          type: string
        mappings:
          items:
            $ref: "#/components/schemas/MappingIO"
          type: array
        name:
          type: string
        poll_interval:
          format: int64
          type: integer
        repo_url:
          type: string
        webhook_secret_key:
          type: string
        webhook_url:
          type: string
      required:
        - id
        - name
        - repo_url
        - branch
        - auth_type
        - credential_secret_key
        - known_hosts
        - poll_interval
        - webhook_secret_key
        - webhook_url
        - last_synced_sha
        - last_sync_status
        - last_error
        - mappings
      type: object
    Status:
      additionalProperties: true
      properties:
        driver:
          enum:
            - postgres
            - fs
            - s3
            - azblob
          type: string
        error:
          type: string
        healthy:
          description: The result of a put, get and delete round trip.
          type: boolean
      required:
        - driver
        - healthy
      type: object
    StoredMessage:
      additionalProperties: true
      properties:
        content:
          items:
            $ref: "#/components/schemas/Block"
          type: array
        created_at:
          format: date-time
          type: string
        id:
          type: string
        role:
          enum:
            - user
            - assistant
            - tool
          type: string
      required:
        - id
        - role
        - content
        - created_at
      type: object
    TaskRun:
      additionalProperties: true
      properties:
        attempt:
          format: int64
          type: integer
        child_execution_id:
          type:
            - string
            - "null"
        duration_ms:
          format: int64
          type:
            - integer
            - "null"
        ended_at:
          format: date-time
          type:
            - string
            - "null"
        error:
          type: string
        executor_type:
          type: string
        exit_code:
          format: int64
          type:
            - integer
            - "null"
        id:
          type: string
        outputs:
          additionalProperties: {}
          type:
            - object
            - "null"
        pool:
          type: string
        queued_at:
          format: date-time
          type:
            - string
            - "null"
        reason:
          type: string
        reused_from_id:
          type:
            - string
            - "null"
        started_at:
          format: date-time
          type:
            - string
            - "null"
        state:
          enum:
            - PENDING
            - QUEUED
            - RUNNING
            - SUCCESS
            - FAILED
            - TIMED_OUT
            - CANCELLED
            - SKIPPED
          type: string
        task_key:
          type: string
        task_type:
          type: string
      required:
        - id
        - task_key
        - task_type
        - attempt
        - state
        - reason
        - executor_type
        - pool
        - error
      type: object
    TextDiff:
      additionalProperties: true
      properties:
        diff:
          type: string
      required:
        - diff
      type: object
    Token:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        expires_at:
          format: date-time
          type: string
        id:
          type: string
        last_used_at:
          format: date-time
          type: string
        name:
          type: string
        prefix:
          type: string
        revoked_at:
          format: date-time
          type: string
        role:
          enum:
            - viewer
            - operator
            - editor
            - admin
          type: string
        user_email:
          type: string
        user_id:
          type: string
      required:
        - id
        - user_id
        - user_email
        - name
        - prefix
        - role
        - created_at
      type: object
    TokenList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/Token"
          type: array
        next_cursor:
          type: string
      required:
        - items
      type: object
    TriggerInfo:
      additionalProperties: true
      properties:
        active:
          type: boolean
        config:
          additionalProperties: {}
          type: object
        has_webhook_key:
          type: boolean
        key:
          type: string
        last_fired_at:
          format: date-time
          type:
            - string
            - "null"
        next_fire_at:
          format: date-time
          type:
            - string
            - "null"
        type:
          enum:
            - schedule
            - webhook
            - flow
          type: string
      required:
        - key
        - type
        - active
        - config
        - has_webhook_key
      type: object
    TriggerRequest:
      additionalProperties: true
      properties:
        inputs:
          additionalProperties: {}
          type: object
        labels:
          additionalProperties:
            maxLength: 256
            type: string
          maxProperties: 20
          type: object
      type: object
    UpcomingList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/UpcomingSchedule"
          type: array
      required:
        - items
      type: object
    UpcomingSchedule:
      additionalProperties: true
      properties:
        cron:
          type: string
        flow_id:
          type: string
        namespace:
          type: string
        next_fire_at:
          format: date-time
          type: string
        timezone:
          type: string
        trigger_id:
          type: string
      required:
        - namespace
        - flow_id
        - trigger_id
        - cron
        - timezone
        - next_fire_at
      type: object
    UpdateFlowRequest:
      additionalProperties: true
      properties:
        disabled:
          type: boolean
      required:
        - disabled
      type: object
    UpdateMeRequest:
      additionalProperties: true
      properties:
        name:
          maxLength: 200
          type: string
      required:
        - name
      type: object
    UpdateSecretProviderRequest:
      additionalProperties: true
      properties:
        config:
          additionalProperties: {}
          type: object
      required:
        - config
      type: object
    UpdateUserRequest:
      additionalProperties: true
      properties:
        disabled:
          type: boolean
        name:
          maxLength: 200
          type: string
        role:
          enum:
            - viewer
            - operator
            - editor
            - admin
          type: string
      type: object
    User:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        disabled:
          type: boolean
        email:
          type: string
        id:
          type: string
        last_login_at:
          format: date-time
          type: string
        must_change_password:
          type: boolean
        name:
          type: string
        role:
          enum:
            - viewer
            - operator
            - editor
            - admin
          type: string
      required:
        - id
        - email
        - name
        - role
        - must_change_password
        - disabled
        - created_at
      type: object
    UserList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/User"
          type: array
        next_cursor:
          type: string
      required:
        - items
      type: object
    ValidateFileRequest:
      additionalProperties: true
      properties:
        content:
          type: string
        path:
          maxLength: 512
          type: string
      required:
        - path
        - content
      type: object
    ValidateFileResult:
      additionalProperties: true
      properties:
        errors:
          items:
            $ref: "#/components/schemas/Issue"
          type: array
        flow_id:
          type: string
        kind:
          enum:
            - flow
            - namespace
            - other
          type: string
        valid:
          type: boolean
      required:
        - valid
        - kind
        - errors
      type: object
    VariableInfo:
      additionalProperties: true
      properties:
        inherited:
          description: True when a parent namespace or the global scope defines the variable.
          type: boolean
        key:
          type: string
        scope:
          description: global or the namespace name that defines the variable.
          type: string
        updated_at:
          format: date-time
          type: string
        updated_by:
          type: string
        value:
          type: string
      required:
        - key
        - value
        - scope
        - updated_by
        - updated_at
        - inherited
      type: object
    VariableList:
      additionalProperties: true
      properties:
        items:
          items:
            $ref: "#/components/schemas/VariableInfo"
          type: array
      required:
        - items
      type: object
    VariablePut:
      additionalProperties: true
      properties:
        value:
          maxLength: 65536
          type: string
      required:
        - value
      type: object
    VersionDiff:
      additionalProperties: true
      properties:
        files:
          items:
            $ref: "#/components/schemas/FileDiff"
          type: array
        from:
          format: int64
          type: integer
        to:
          format: int64
          type: integer
      required:
        - from
        - to
        - files
      type: object
    WebhookKey:
      additionalProperties: true
      properties:
        key:
          type: string
        url:
          type: string
      required:
        - key
        - url
      type: object
info:
  title: Sluice API
  version: "1"
openapi: 3.1.0
paths:
  /api/runner/v1/task-runs/{taskRunId}/artifacts/{name}:
    put:
      operationId: runnerPutArtifact
      parameters:
        - in: path
          name: taskRunId
          required: true
          schema:
            format: uuid
            type: string
        - in: path
          name: name
          required: true
          schema:
            maxLength: 200
            type: string
      requestBody:
        content:
          application/octet-stream:
            schema:
              contentMediaType: application/octet-stream
              format: binary
              type: string
        required: true
      responses:
        "204":
          description: Stored.
  /api/runner/v1/task-runs/{taskRunId}/bundle:
    get:
      operationId: runnerGetBundle
      parameters:
        - in: path
          name: taskRunId
          required: true
          schema:
            format: uuid
            type: string
      responses:
        "200":
          content:
            application/gzip: {}
          description: Bundle.
  /api/runner/v1/task-runs/{taskRunId}/complete:
    post:
      operationId: runnerComplete
      parameters:
        - in: path
          name: taskRunId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RunnerComplete"
        required: true
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/runner/v1/task-runs/{taskRunId}/events:
    post:
      operationId: runnerPostEvents
      parameters:
        - in: path
          name: taskRunId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RunnerEventBatch"
        required: true
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/runner/v1/task-runs/{taskRunId}/heartbeat:
    post:
      operationId: runnerHeartbeat
      parameters:
        - in: path
          name: taskRunId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RunnerHeartbeatResponse"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/runner/v1/task-runs/{taskRunId}/logs:
    post:
      operationId: runnerPostLogs
      parameters:
        - in: path
          name: taskRunId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RunnerLogBatch"
        required: true
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/runner/v1/task-runs/{taskRunId}/spec:
    get:
      operationId: runnerGetSpec
      parameters:
        - in: path
          name: taskRunId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RunnerSpec"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/ai/conversations:
    get:
      operationId: listAIConversations
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConversationList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    post:
      operationId: createAIConversation
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAIConversationRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Conversation"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/ai/conversations/{conversationId}:
    delete:
      operationId: deleteAIConversation
      parameters:
        - in: path
          name: conversationId
          required: true
          schema:
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    get:
      operationId: getAIConversation
      parameters:
        - in: path
          name: conversationId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConversationDetail"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/ai/conversations/{conversationId}/actions/{actionId}/confirm:
    post:
      operationId: confirmAIAction
      parameters:
        - in: path
          name: conversationId
          required: true
          schema:
            format: uuid
            type: string
        - in: path
          name: actionId
          required: true
          schema:
            format: uuid
            type: string
      responses:
        "200":
          content:
            text/event-stream: {}
          description: Events of the continued turn.
  /api/v1/ai/conversations/{conversationId}/actions/{actionId}/reject:
    post:
      operationId: rejectAIAction
      parameters:
        - in: path
          name: conversationId
          required: true
          schema:
            format: uuid
            type: string
        - in: path
          name: actionId
          required: true
          schema:
            format: uuid
            type: string
      responses:
        "200":
          content:
            text/event-stream: {}
          description: Events of the continued turn.
  /api/v1/ai/conversations/{conversationId}/messages:
    post:
      operationId: sendAIMessage
      parameters:
        - in: path
          name: conversationId
          required: true
          schema:
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MessageIn"
        required: true
      responses:
        "200":
          content:
            text/event-stream: {}
          description: "Events of the turn: text, tool_call, tool_result, pending_action, error and done."
  /api/v1/ai/provider:
    delete:
      operationId: deleteAIProvider
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    get:
      operationId: getAIProvider
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AIProvider"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    put:
      operationId: putAIProvider
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AIProviderPut"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AIProvider"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/ai/provider/test:
    post:
      operationId: testAIProvider
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AITestResult"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/ai/status:
    get:
      operationId: getAIStatus
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AIStatus"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/audit:
    get:
      operationId: listAuditEvents
      parameters:
        - explode: false
          in: query
          name: actor
          schema:
            type: string
        - explode: false
          in: query
          name: action
          schema:
            type: string
        - explode: false
          in: query
          name: target
          schema:
            type: string
        - explode: false
          in: query
          name: from
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: to
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: cursor
          schema:
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuditList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/auth/login:
    post:
      operationId: login
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/LoginRequest"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Me"
          description: OK
          headers:
            Set-Cookie:
              schema:
                type: string
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/auth/logout:
    post:
      operationId: logout
      responses:
        "204":
          description: No Content
          headers:
            Set-Cookie:
              schema:
                type: string
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/auth/me:
    get:
      operationId: getMe
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Me"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    patch:
      operationId: updateMe
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateMeRequest"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Me"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/auth/password:
    post:
      operationId: changePassword
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChangePasswordRequest"
        required: true
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/auth/sessions/revoke-others:
    post:
      operationId: revokeOtherSessions
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CountResult"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/executions:
    get:
      operationId: listExecutions
      parameters:
        - description: Comma-separated execution states.
          explode: false
          in: query
          name: state
          schema:
            description: Comma-separated execution states.
            type: string
        - description: Namespace and its children.
          explode: false
          in: query
          name: namespace
          schema:
            description: Namespace and its children.
            type: string
        - description: Flow as <namespace>/<flow_id>.
          explode: false
          in: query
          name: flow
          schema:
            description: Flow as <namespace>/<flow_id>.
            type: string
        - explode: false
          in: query
          name: trigger_type
          schema:
            enum:
              - manual
              - schedule
              - webhook
              - flow
              - file
              - subflow
              - rerun
              - restart
            type: string
        - description: Label filter key=value. Repeat for several labels.
          explode: true
          in: query
          name: label
          schema:
            description: Label filter key=value. Repeat for several labels.
            items:
              type: string
            type: array
        - explode: false
          in: query
          name: from
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: to
          schema:
            format: date-time
            type: string
        - explode: false
          in: query
          name: sort
          schema:
            default: created
            enum:
              - created
              - duration
            type: string
        - description: Opaque cursor from next_cursor of the previous page.
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor from next_cursor of the previous page.
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExecutionList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/executions/{executionId}:
    get:
      operationId: getExecution
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExecutionDetail"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/executions/{executionId}/artifacts:
    get:
      operationId: listExecutionArtifacts
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ArtifactList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/executions/{executionId}/artifacts/{artifactId}:
    get:
      operationId: downloadArtifact
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            format: uuid
            type: string
        - in: path
          name: artifactId
          required: true
          schema:
            format: uuid
            type: string
      responses:
        "200":
          content:
            application/octet-stream: {}
          description: Artifact content.
  /api/v1/executions/{executionId}/cancel:
    post:
      operationId: cancelExecution
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            type: string
      responses:
        "202":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExecutionDetail"
          description: Accepted
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/executions/{executionId}/events:
    get:
      operationId: streamExecutionEvents
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            format: uuid
            type: string
        - in: header
          name: Last-Event-ID
          schema:
            type: string
      responses:
        "200":
          content:
            text/event-stream: {}
          description: Event stream.
  /api/v1/executions/{executionId}/insights:
    get:
      operationId: listExecutionInsights
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InsightList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    post:
      operationId: requestTriage
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            type: string
      responses:
        "202":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InsightList"
          description: Accepted
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/executions/{executionId}/logs:
    get:
      operationId: getExecutionLogs
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            type: string
        - description: Task ID filter.
          explode: false
          in: query
          name: task
          schema:
            description: Task ID filter.
            type: string
        - description: Case-insensitive text filter.
          explode: false
          in: query
          name: search
          schema:
            description: Case-insensitive text filter.
            type: string
        - description: Opaque cursor from next_cursor of the previous page.
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor from next_cursor of the previous page.
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 1000
            format: int64
            maximum: 5000
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LogPage"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/executions/{executionId}/logs/download:
    get:
      operationId: downloadExecutionLogs
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            format: uuid
            type: string
        - in: query
          name: task
          schema:
            type: string
      responses:
        "200":
          content:
            text/plain: {}
          description: Log file.
  /api/v1/executions/{executionId}/logs/stream:
    get:
      operationId: streamExecutionLogs
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            format: uuid
            type: string
        - in: query
          name: task
          schema:
            type: string
        - in: header
          name: Last-Event-ID
          schema:
            type: string
      responses:
        "200":
          content:
            text/event-stream: {}
          description: Event stream.
  /api/v1/executions/{executionId}/metrics:
    get:
      operationId: listExecutionMetrics
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MetricList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/executions/{executionId}/rerun:
    post:
      operationId: rerunExecution
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExecutionDetail"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/executions/{executionId}/restart:
    post:
      operationId: restartExecution
      parameters:
        - in: path
          name: executionId
          required: true
          schema:
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExecutionDetail"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/flows:
    get:
      operationId: listFlows
      parameters:
        - description: Namespace and its children.
          explode: false
          in: query
          name: namespace
          schema:
            description: Namespace and its children.
            type: string
        - description: Opaque cursor from next_cursor of the previous page.
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor from next_cursor of the previous page.
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FlowList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/flows/{namespace}/{flowId}:
    get:
      operationId: getFlow
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: flowId
          required: true
          schema:
            maxLength: 63
            pattern: ^[a-z0-9][a-z0-9-]*$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FlowDetail"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    patch:
      operationId: updateFlow
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: flowId
          required: true
          schema:
            maxLength: 63
            pattern: ^[a-z0-9][a-z0-9-]*$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateFlowRequest"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FlowDetail"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/flows/{namespace}/{flowId}/diff:
    get:
      operationId: diffFlowRevisions
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: flowId
          required: true
          schema:
            maxLength: 63
            pattern: ^[a-z0-9][a-z0-9-]*$
            type: string
        - explode: false
          in: query
          name: from
          required: true
          schema:
            type: string
        - explode: false
          in: query
          name: to
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TextDiff"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/flows/{namespace}/{flowId}/executions:
    post:
      operationId: triggerFlow
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: flowId
          required: true
          schema:
            maxLength: 63
            pattern: ^[a-z0-9][a-z0-9-]*$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TriggerRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExecutionDetail"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/flows/{namespace}/{flowId}/metrics:
    get:
      operationId: getFlowMetrics
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: flowId
          required: true
          schema:
            maxLength: 63
            pattern: ^[a-z0-9][a-z0-9-]*$
            type: string
        - description: Metric name. Empty returns only the names.
          explode: false
          in: query
          name: name
          schema:
            description: Metric name. Empty returns only the names.
            maxLength: 100
            type: string
        - explode: false
          in: query
          name: agg
          schema:
            default: sum
            enum:
              - sum
              - avg
              - max
            type: string
        - description: Tag key. One series per tag value.
          explode: false
          in: query
          name: group_by
          schema:
            description: Tag key. One series per tag value.
            maxLength: 100
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FlowMetricsOut"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/flows/{namespace}/{flowId}/revisions:
    get:
      operationId: listFlowRevisions
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: flowId
          required: true
          schema:
            maxLength: 63
            pattern: ^[a-z0-9][a-z0-9-]*$
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RevisionList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/flows/{namespace}/{flowId}/revisions/{revisionId}:
    get:
      operationId: getFlowRevision
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: flowId
          required: true
          schema:
            maxLength: 63
            pattern: ^[a-z0-9][a-z0-9-]*$
            type: string
        - in: path
          name: revisionId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Revision"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/flows/{namespace}/{flowId}/stats:
    get:
      operationId: getFlowStats
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: flowId
          required: true
          schema:
            maxLength: 63
            pattern: ^[a-z0-9][a-z0-9-]*$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FlowStatsOut"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/flows/{namespace}/{flowId}/triggers/{triggerId}/webhook-key:
    post:
      operationId: rotateWebhookKey
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: flowId
          required: true
          schema:
            maxLength: 63
            pattern: ^[a-z0-9][a-z0-9-]*$
            type: string
        - in: path
          name: triggerId
          required: true
          schema:
            maxLength: 63
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookKey"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/git-sources:
    get:
      operationId: listGitSources
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SourceList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    post:
      operationId: createGitSource
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateGitSourceRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SourceOut"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/git-sources/{sourceId}:
    delete:
      operationId: deleteGitSource
      parameters:
        - in: path
          name: sourceId
          required: true
          schema:
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    get:
      operationId: getGitSource
      parameters:
        - in: path
          name: sourceId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SourceOut"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    put:
      operationId: updateGitSource
      parameters:
        - in: path
          name: sourceId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SourceBody"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SourceOut"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/git-sources/{sourceId}/runs:
    get:
      operationId: listGitSyncRuns
      parameters:
        - in: path
          name: sourceId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RunList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/git-sources/{sourceId}/sync:
    post:
      operationId: syncGitSource
      parameters:
        - in: path
          name: sourceId
          required: true
          schema:
            type: string
      responses:
        "202":
          description: Accepted
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/instances:
    get:
      operationId: listInstances
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InstanceList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces:
    get:
      operationId: listNamespaces
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NamespaceList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    post:
      operationId: createNamespace
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateNamespaceRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Namespace"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}:
    delete:
      operationId: deleteNamespace
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    get:
      operationId: getNamespace
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Namespace"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/changes:
    post:
      operationId: saveChanges
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SaveChangesRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Snapshot"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/diff:
    get:
      operationId: diffVersions
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - explode: false
          in: query
          name: from
          required: true
          schema:
            format: int64
            minimum: 1
            type: integer
        - explode: false
          in: query
          name: to
          required: true
          schema:
            format: int64
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VersionDiff"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/file:
    get:
      operationId: getFile
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            type: string
        - description: File path relative to the namespace root.
          in: query
          name: path
          required: true
          schema:
            maxLength: 512
            minLength: 1
            type: string
        - description: Version number. Default is the head version.
          in: query
          name: version
          schema:
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/octet-stream: {}
          description: File content.
    put:
      operationId: uploadFile
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            type: string
        - description: File path relative to the namespace root.
          in: query
          name: path
          required: true
          schema:
            maxLength: 512
            minLength: 1
            type: string
        - in: query
          name: message
          schema:
            maxLength: 500
            type: string
        - in: query
          name: executable
          schema:
            type: boolean
      requestBody:
        content:
          application/octet-stream:
            schema:
              contentMediaType: application/octet-stream
              format: binary
              type: string
        required: true
      responses:
        "201":
          content:
            application/json: {}
          description: New version.
  /api/v1/namespaces/{namespace}/files:
    get:
      operationId: listFiles
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - description: Version number. Default is the head version.
          explode: false
          in: query
          name: version
          schema:
            description: Version number. Default is the head version.
            format: int64
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/git:
    get:
      operationId: getNamespaceGit
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NamespaceGit"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/git/push:
    post:
      operationId: pushNamespaceBranch
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PushNamespaceBranchRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PushResult"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/revert:
    post:
      operationId: revertVersion
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RevertRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Snapshot"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/run:
    post:
      operationId: runFile
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RunFileRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExecutionDetail"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/secrets:
    get:
      operationId: listNamespaceSecrets
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SecretList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/secrets/{key}:
    delete:
      operationId: deleteNamespaceSecret
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    put:
      operationId: putNamespaceSecret
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SecretPut"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SecretInfo"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/secrets/{key}/check:
    post:
      operationId: checkNamespaceSecret
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CheckResult"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/validate:
    post:
      operationId: validateFile
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ValidateFileRequest"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ValidateFileResult"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/variables:
    get:
      operationId: listNamespaceVariables
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariableList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/variables/{key}:
    delete:
      operationId: deleteNamespaceVariable
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    put:
      operationId: putNamespaceVariable
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VariablePut"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariableInfo"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/namespaces/{namespace}/versions:
    get:
      operationId: listVersions
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 128
            pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SnapshotList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/schedules/upcoming:
    get:
      operationId: listUpcomingSchedules
      parameters:
        - description: Namespace and its children.
          explode: false
          in: query
          name: namespace
          schema:
            description: Namespace and its children.
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 10
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpcomingList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/schemas/flow.json:
    get:
      operationId: getFlowSchema
      responses:
        "200":
          content:
            application/json:
              schema: {}
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/secret-providers:
    get:
      operationId: listSecretProviders
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProviderList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    post:
      operationId: createSecretProvider
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateSecretProviderRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProviderOut"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/secret-providers/{name}:
    delete:
      operationId: deleteSecretProvider
      parameters:
        - in: path
          name: name
          required: true
          schema:
            pattern: ^[a-z0-9][a-z0-9_-]{0,62}$
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    put:
      operationId: updateSecretProvider
      parameters:
        - in: path
          name: name
          required: true
          schema:
            pattern: ^[a-z0-9][a-z0-9_-]{0,62}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateSecretProviderRequest"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProviderOut"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/secret-providers/{name}/check:
    post:
      operationId: checkSecretProvider
      parameters:
        - in: path
          name: name
          required: true
          schema:
            pattern: ^[a-z0-9][a-z0-9_-]{0,62}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CheckSecretProviderRequest"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CheckResult"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/secrets:
    get:
      operationId: listGlobalSecrets
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SecretList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/secrets/{key}:
    delete:
      operationId: deleteGlobalSecret
      parameters:
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    put:
      operationId: putGlobalSecret
      parameters:
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SecretPut"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SecretInfo"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/secrets/{key}/check:
    post:
      operationId: checkGlobalSecret
      parameters:
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CheckResult"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/stats/dashboard:
    get:
      operationId: getDashboard
      parameters:
        - explode: false
          in: query
          name: range
          schema:
            default: 24h
            enum:
              - 24h
              - 7d
              - 30d
            type: string
        - description: Namespace and its children.
          explode: false
          in: query
          name: namespace
          schema:
            description: Namespace and its children.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DashboardOut"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/storage:
    get:
      operationId: getStorageStatus
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Status"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/tokens:
    get:
      operationId: listTokens
      parameters:
        - explode: false
          in: query
          name: cursor
          schema:
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
        - description: All users. Needs admin.
          explode: false
          in: query
          name: all
          schema:
            description: All users. Needs admin.
            type: boolean
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TokenList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    post:
      operationId: createToken
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTokenRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreatedToken"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/tokens/{tokenId}:
    delete:
      operationId: revokeToken
      parameters:
        - in: path
          name: tokenId
          required: true
          schema:
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/users:
    get:
      operationId: listUsers
      parameters:
        - explode: false
          in: query
          name: cursor
          schema:
            type: string
        - explode: false
          in: query
          name: limit
          schema:
            default: 50
            format: int64
            maximum: 200
            minimum: 1
            type: integer
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UserList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    post:
      operationId: createUser
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateUserRequest"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/User"
          description: Created
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/users/{userId}:
    patch:
      operationId: updateUser
      parameters:
        - in: path
          name: userId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateUserRequest"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/User"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/users/{userId}/reset-password:
    post:
      operationId: resetUserPassword
      parameters:
        - in: path
          name: userId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ResetPasswordRequest"
        required: true
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/variables:
    get:
      operationId: listGlobalVariables
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariableList"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /api/v1/variables/{key}:
    delete:
      operationId: deleteGlobalVariable
      parameters:
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      responses:
        "204":
          description: No Content
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
    put:
      operationId: putGlobalVariable
      parameters:
        - in: path
          name: key
          required: true
          schema:
            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,127}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VariablePut"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariableInfo"
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorEnvelope"
          description: Error
  /hooks/git/{sourceId}:
    post:
      operationId: gitWebhook
      parameters:
        - in: path
          name: sourceId
          required: true
          schema:
            type: string
      responses:
        "202":
          content:
            application/json: {}
          description: The call is valid.
      summary: Request a sync of a git source from a push webhook
  /hooks/{key}:
    post:
      operationId: fireWebhook
      parameters:
        - in: path
          name: key
          required: true
          schema:
            type: string
      responses:
        "202":
          content:
            application/json: {}
          description: The execution was created.
      summary: Start the flow of a webhook trigger
