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

# Update trigger

> Updates an existing trigger. Requires secret key authentication.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/triglit/openapi.documented.yml patch /v1/gateway/triggers/{triggerId}
openapi: 3.0.0
info:
  title: Triglit
  description: Documentação da API do Triglit
  version: '1.0'
  contact: {}
servers: []
security: []
tags: []
paths:
  /v1/gateway/triggers/{triggerId}:
    patch:
      tags:
        - Triggers
      summary: Update trigger
      description: Updates an existing trigger. Requires secret key authentication.
      operationId: publictriggers_updateTrigger_v1
      parameters:
        - name: triggerId
          required: true
          in: path
          description: Trigger identifier
          schema:
            example: trg_abc123def456
            type: string
        - name: X-API-Key
          in: header
          description: Chave de API do tenant (publishable key ou secret key)
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTriggerDto'
      responses:
        '200':
          description: Trigger updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriggerResponseDto'
        '401':
          description: API key não fornecida, inválida ou não encontrada.
        '403':
          description: Tipo de chave não permitido para este endpoint.
        '404':
          description: Trigger not found
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Triglit from 'triglit';

            const client = new Triglit({
              apiKey: 'My API Key',
            });

            const trigger = await client.triggers.update('trg_abc123def456');

            console.log(trigger.id);
components:
  schemas:
    UpdateTriggerDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        config:
          type: object
          properties:
            rateLimit:
              type: object
              properties:
                maxRequests:
                  type: number
                  minimum: 1
                windowMs:
                  type: number
                  minimum: 1000
              required:
                - maxRequests
                - windowMs
            timeoutMs:
              type: number
              minimum: 1000
            retryPolicy:
              type: object
              properties:
                maxRetries:
                  type: number
                  minimum: 0
                  maximum: 10
                backoffMs:
                  type: number
                  minimum: 100
                maxBackoffMs:
                  type: number
                  minimum: 1000
              required:
                - maxRetries
                - backoffMs
                - maxBackoffMs
            webhookConfig:
              anyOf:
                - type: object
                  properties:
                    event:
                      type: string
                - nullable: true
            scheduleConfig:
              type: object
              properties:
                cron:
                  type: string
                intervalMs:
                  type: number
                  minimum: 60000
                timezone:
                  type: string
        isActive:
          type: boolean
    TriggerResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Unique trigger identifier
          example: trg_abc123def456
        tenantId:
          type: string
          description: Tenant identifier
          example: tenant_123
        subTenantId:
          type: string
          description: Sub-tenant identifier
          example: sub_tenant_456
        workflowVersionId:
          type: string
          description: Workflow version identifier
          example: wfv_abc123def456
        name:
          type: string
          description: Trigger name
          example: User Registration Webhook
        type:
          type: string
          description: Trigger type
          enum:
            - schedule
            - webhook
          example: webhook
        config:
          type: object
          description: Trigger configuration
          additionalProperties: true
        isActive:
          type: boolean
          description: Whether the trigger is active
          example: true
        createdAt:
          type: string
          description: Creation timestamp
          example: '2024-01-15T10:30:00.000Z'
        updatedAt:
          type: string
          description: Last update timestamp
          example: '2024-01-15T10:30:00.000Z'
      required:
        - id
        - tenantId
        - workflowVersionId
        - name
        - type
        - config
        - isActive
        - createdAt
        - updatedAt
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Chave de API do tenant (publishable key ou secret key)

````