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

# Update Trigger

> Update an existing trigger.

Only provided fields are updated. Returns the updated trigger.

Returns:
    Updated trigger.

Raises:
    NotFoundError: If trigger not found in this organization.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json patch /triggers/{trigger_id}
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /triggers/{trigger_id}:
    patch:
      tags:
        - triggers
      summary: Update Trigger
      description: |-
        Update an existing trigger.

        Only provided fields are updated. Returns the updated trigger.

        Returns:
            Updated trigger.

        Raises:
            NotFoundError: If trigger not found in this organization.
      operationId: triggers-update_trigger
      parameters:
        - name: trigger_id
          in: path
          required: true
          schema:
            type: string
            title: Trigger Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentTriggerUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentTrigger'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AgentTriggerUpdate:
      properties:
        target_organization_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Target Organization Id
        event_filters:
          anyOf:
            - items:
                $ref: '#/components/schemas/EventFilter'
              type: array
            - type: 'null'
          title: Event Filters
        cron_expression:
          anyOf:
            - type: string
            - type: 'null'
          title: Cron Expression
        is_main_agent:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Main Agent
        enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enabled
      type: object
      title: AgentTriggerUpdate
      description: |-
        Request body for updating an agent trigger.

        All fields are optional. Only provided fields are updated.

        Attributes:
            target_organization_id: Updated target organization for cross-org event watching.
            event_filters: Updated event filters.
            cron_expression: Updated cron expression.
            is_main_agent: Updated main agent flag.
            enabled: Updated enabled state.
    AgentTrigger:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        target_organization_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Target Organization Id
        agent_resource_id:
          type: string
          title: Agent Resource Id
        runner_resource_id:
          type: string
          title: Runner Resource Id
        trigger_type:
          $ref: '#/components/schemas/TriggerType'
        event_filters:
          anyOf:
            - items:
                $ref: '#/components/schemas/EventFilter'
              type: array
            - type: 'null'
          title: Event Filters
        cron_expression:
          anyOf:
            - type: string
            - type: 'null'
          title: Cron Expression
        is_main_agent:
          type: boolean
          title: Is Main Agent
          default: false
        enabled:
          type: boolean
          title: Enabled
          default: true
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - agent_resource_id
        - runner_resource_id
        - trigger_type
      title: AgentTrigger
      description: >-
        Configuration for triggering an agent via events, schedules, or
        conversations.


        Triggers live inside their owner organization's SurrealDB namespace —

        the namespace is the organization boundary, so no per-record

        ``organization_id`` field is carried on the row. The trigger and the

        agent resource it invokes always live in the same tenant.


        Attributes:
            id: SurrealDB record ID (populated by database).
            target_organization_id: Organization whose events this trigger watches.
                When set, the trigger fires on events from this org but the agent
                resource lives in the owner tenant. When None, the trigger watches
                its owner tenant. Only platform agents may set this.
            agent_resource_id: SurrealDB ID of the agno agent resource.
            runner_resource_id: SurrealDB ID of the agno runner resource.
            trigger_type: How this trigger fires.
            event_filters: Filters for matching lifecycle events (event triggers only).
            cron_expression: Cron schedule expression (schedule triggers only).
            is_main_agent: Whether this is the org's main conversation agent.
            enabled: Whether the trigger is active.
            created_at: When the trigger was created.
            updated_at: When the trigger was last modified.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    EventFilter:
      properties:
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
        resource_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Resource Type
        event_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Event Type
        resource_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Resource Name
      type: object
      title: EventFilter
      description: |-
        Filter for matching NATS lifecycle events.

        All fields are optional. A filter matches when every non-None field
        matches the corresponding value in the event subject. An empty filter
        matches all events.

        Attributes:
            provider: Provider canonical name (e.g. "platform/gcp").
            resource_type: Resource type slug (e.g. "instance").
            event_type: Lifecycle outcome (e.g. "failure", "degraded", "success").
            resource_name: Specific resource name to match.
    TriggerType:
      type: string
      enum:
        - event
        - schedule
        - conversation
      title: TriggerType
      description: Types of agent triggers.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````