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

# Create a trigger

> Starts an agent or assistant when the app emits the chosen event. The tool server must be an app integration; provide exactly one of agentId / assistantId.



## OpenAPI

````yaml POST /v1/triggers
openapi: 3.0.0
info:
  title: Devic.ai Public API
  description: >-
    Devic.ai is an AI platform that allows you to create, manage, and use AI
    agents for various tasks.
  version: 1.0.0
  contact:
    name: Devic.ai Support
    url: https://devic.ai
  x-logo:
    url: https://devic.ai/logo.png
    altText: Devic.ai Logo
  x-summary: Public API for interacting with Devic.ai platform
servers:
  - url: https://api.devic.ai
    description: Production server
  - url: https://staging-api.devic.ai
    description: Staging server
security:
  - bearerAuth: []
tags:
  - name: Projects
    description: Group agents, assistants, documents and costs into projects
  - name: Documents
    description: >-
      Knowledge base documents: create, version, attach and index markdown
      content for RAG
  - name: Document Folders
    description: Organise knowledge base documents into folders and attach them in bulk
  - name: Files
    description: Upload files and obtain shareable download URLs to attach to messages
  - name: Agents
    description: Endpoints related to AI agents and their operations
  - name: Assistants
    description: Endpoints for interacting with assistants and their specializations
  - name: Tool Servers
    description: Endpoints for managing tool servers and their tool definitions
  - name: Health
    description: API health check endpoints
  - name: Documentation
    description: Endpoints for retrieving markdown documentation
  - name: Integrations
    description: Connect third-party apps and turn them into tools
  - name: Triggers
    description: Start an agent or an assistant from an app event
  - name: Tenant Integrations
    description: Apps that each end user connects for themselves
  - name: Memory
    description: What an assistant remembers between conversations
  - name: Skills
    description: Reusable instruction packs for agents and assistants
  - name: Speech to Text
    description: Audio transcription
  - name: Tenants
    description: Tenants, subtenants and their usage
  - name: MCP Gateway
    description: One MCP endpoint over many servers, with visibility per user
  - name: Tenant Sessions
    description: Tokens that prove which end user is calling
paths:
  /v1/triggers:
    post:
      tags:
        - Triggers
      summary: Create a trigger
      description: >-
        Starts an agent or assistant when the app emits the chosen event. The
        tool server must be an app integration; provide exactly one of agentId /
        assistantId.
      operationId: createTrigger
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTriggerDto'
      responses:
        '201':
          description: Trigger created
        '401':
          description: Unauthorized - Invalid or missing token
        '429':
          description: Too Many Requests - Rate limit exceeded
        '500':
          description: Internal Server Error
      security:
        - bearerAuth: []
components:
  schemas:
    CreateTriggerDto:
      type: object
      properties:
        toolServerId:
          type: string
          description: The app-integration tool server whose events this listens to
        agentId:
          type: string
          description: Agent to start. Exactly one of agentId / assistantId is required.
        assistantId:
          type: string
          description: >-
            Assistant to start. Exactly one of agentId / assistantId is
            required.
        triggerSlug:
          type: string
          description: Trigger type slug (from GET /integrations/:app/triggers)
          example: GMAIL_NEW_GMAIL_MESSAGE
        triggerConfig:
          type: object
          description: Values for the trigger type's config JSON Schema
        name:
          type: string
        messageTemplate:
          type: string
          description: >-
            Template rendering the event into the message. Empty ⇒ raw event
            JSON.
        chatUidTemplate:
          type: string
          description: >-
            Assistants only: stable chat id template so related events share a
            conversation
        newThreadsState:
          type: string
          description: 'Agents only: initial thread state'
          enum:
            - queued
            - paused
        rateLimitPerMinute:
          type: number
          description: Per-trigger events/minute ceiling
      required:
        - toolServerId
        - triggerSlug
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use JWT token for authentication

````