> ## Documentation Index
> Fetch the complete documentation index at: https://microstrate-1133-notifications-prefs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a stream trigger

> Creates a new stream trigger for data processing and routing. A stream trigger connects a data source to a target, enabling real-time data flow between components.

**Usage Notes:**
- The system automatically creates necessary import/export pairs
- Stream triggers define both source and target configurations
- The source configuration specifies where data originates
- The target configuration specifies where data should be delivered
- Response types can be Singleton (single response), Stream (continuous), or Chunked (paginated)
- Source and target types determine how data flows through the system
- The trigger is active immediately after creation
- Both synchronous and asynchronous data processing patterns are supported



## OpenAPI

````yaml /api-reference/endpoint/trigger/openapi.json post /trigger/stream
openapi: 3.0.3
info:
  title: quiva.ai Gateway
  description: >-
    # Bellerophon Trigger Service API


    The Trigger Service is a Bellerophon API service that provides an interface
    for managing various types of triggers through a subject-based messaging
    system.


    This API allows you to create, retrieve, and delete different types of
    triggers including gateway and stream triggers.


    ## Core Concepts


    ### Triggers

    Triggers are the foundation of the Bellerophon platform's event-driven
    architecture. A trigger connects different parts of the system, allowing
    events in one component to initiate actions in another. Each trigger has a
    unique subject identifier that follows a specific naming pattern.


    ### Gateway Triggers

    Gateway triggers create API endpoints that can be accessed from outside the
    system. They define HTTP methods, paths, rate limits, and connect incoming
    requests to processing functions.


    ### Stream Triggers

    Stream triggers connect data sources to targets, enabling real-time data
    flow between components. They define how data should be processed,
    transformed, and routed within the system.


    ## Subject Structure


    The service follows a subject naming pattern which typically expands to:

    ```

    ms.trigger.[trigger_type].[resource_name]

    ```


    All API endpoints use the /trigger/ prefix in their paths for consistency
    and to clearly identify the trigger service.
  contact:
    name: Bellerophon Support
  version: '1.0'
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearer_auth: []
paths:
  /trigger/stream:
    post:
      tags:
        - Stream Triggers
      summary: Create a stream trigger
      description: >-
        Creates a new stream trigger for data processing and routing. A stream
        trigger connects a data source to a target, enabling real-time data flow
        between components.


        **Usage Notes:**

        - The system automatically creates necessary import/export pairs

        - Stream triggers define both source and target configurations

        - The source configuration specifies where data originates

        - The target configuration specifies where data should be delivered

        - Response types can be Singleton (single response), Stream
        (continuous), or Chunked (paginated)

        - Source and target types determine how data flows through the system

        - The trigger is active immediately after creation

        - Both synchronous and asynchronous data processing patterns are
        supported
      operationId: createStreamTrigger
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StreamTriggerRequest'
            example:
              name: my-stream-trigger
              collection: my-collection
              description: Stream data processing trigger
              trigger_type: stream
              source:
                subject: ms.data.source
                type: stream
                response_type: Stream
              target:
                subject: ms.data.target
                account: account_identifier
                type: stream
      responses:
        '201':
          description: Stream trigger created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StreamTriggerResponse'
              example:
                body:
                  name: my-stream-trigger
                  collection: my-collection
                  description: Stream data processing trigger
                  source:
                    subject: ms.data.source
                    type: stream
                    response_type: Stream
                  target:
                    subject: ms.data.target
                    account: account_identifier
                    type: stream
                  stream: quiva-trigger-config
                  subject: ms.trigger.stream.my-stream-trigger
                  trigger_type: stream
                  type: created
                status_code: 201
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    StreamTriggerRequest:
      type: object
      required:
        - name
        - trigger_type
        - source
        - target
      properties:
        name:
          type: string
          description: >-
            Unique name identifier for the trigger. Used to construct the
            trigger's topic and subject.
          example: my-stream-trigger
        collection:
          type: string
          description: >-
            Logical grouping the trigger belongs to. Used for organizing and
            filtering triggers.
          example: my-collection
        description:
          type: string
          description: >-
            Human-readable description explaining the trigger's purpose and
            function.
          example: Stream data processing trigger
        trigger_type:
          type: string
          enum:
            - stream
          description: >-
            Must be 'stream' for this endpoint. Determines the trigger's
            behavior and available properties.
          example: stream
        source:
          $ref: '#/components/schemas/TriggerSource'
        target:
          $ref: '#/components/schemas/TriggerTarget'
    StreamTriggerResponse:
      type: object
      properties:
        body:
          type: object
          properties:
            name:
              type: string
              description: >-
                Unique name identifier for the trigger. Used to construct the
                trigger's topic and subject.
              example: my-stream-trigger
            collection:
              type: string
              description: >-
                Logical grouping the trigger belongs to. Used for organizing and
                filtering triggers.
              example: my-collection
            description:
              type: string
              description: >-
                Human-readable description explaining the trigger's purpose and
                function.
              example: Stream data processing trigger
            source:
              $ref: '#/components/schemas/TriggerSource'
            target:
              $ref: '#/components/schemas/TriggerTarget'
            stream:
              type: string
              description: Stream identifier where the trigger configuration is stored.
              example: quiva-trigger-config
            subject:
              type: string
              description: >-
                Full subject identifier for the trigger, following the pattern
                "ms.trigger.stream.[name]".
              example: ms.trigger.stream.my-stream-trigger
            trigger_type:
              type: string
              enum:
                - stream
              description: Type of trigger, always 'stream' for stream triggers.
              example: stream
            type:
              type: string
              description: >-
                Specific type identifier providing additional classification
                information.
              example: stream-trigger
        status_code:
          type: integer
          description: HTTP status code indicating the result of the operation.
          example: 201
    TriggerSource:
      type: object
      properties:
        advertise:
          type: boolean
          description: >-
            Whether to advertise this trigger source to other services. When
            true, allows other services to discover this source.
        allow_trace:
          type: boolean
          description: >-
            Whether to allow request tracing. When true, enables debugging and
            performance monitoring.
        name:
          type: string
          description: >-
            Human-readable name for the source. Used for identification in logs
            and monitoring.
        response_type:
          type: string
          enum:
            - Singleton
            - Stream
            - Chunked
          description: |-
            Format of response data from this source:
            * Singleton - Returns a single response and closes
            * Stream - Continuously streams data until connection closes
            * Chunked - Returns paginated data in multiple responses
        subject:
          type: string
          description: >-
            Subject identifier for the source. Used for routing messages to/from
            this source.
        type:
          type: string
          enum:
            - stream
            - service
          description: |-
            Export type categorizing how this source behaves:
            * stream - Emits a continuous flow of data
            * service - Provides request/response functionality
        description:
          type: string
          description: >-
            Detailed information about the source including its purpose and data
            format.
        info_url:
          type: string
          description: >-
            URL pointing to additional documentation or information about this
            source.
    TriggerTarget:
      type: object
      properties:
        name:
          type: string
          description: >-
            Human-readable name for the target. Used for identification in logs
            and monitoring.
        subject:
          type: string
          description: >-
            Subject identifier for the target. Used for routing messages to this
            target.
        account:
          type: string
          description: >-
            Account identifier owning or associated with this target. Used for
            access control.
        local_subject:
          type: string
          description: Alternative subject for local routing within the same account.
        type:
          type: string
          enum:
            - stream
            - service
          description: |-
            Export type categorizing how this target behaves:
            * stream - Consumes a continuous flow of data
            * service - Provides request/response functionality
        share:
          type: boolean
          description: >-
            Whether this target is shareable with other accounts. When true,
            allows cross-account access.
        allow_trace:
          type: boolean
          description: >-
            Whether to allow request tracing to this target. When true, enables
            debugging and performance monitoring.
    Error:
      type: object
      properties:
        error:
          type: string
          description: >-
            Detailed error message explaining what went wrong and potential
            solutions.
          example: 'Invalid request: Missing required field'
        status_code:
          type: integer
          description: HTTP status code indicating the specific error type.
          example: 400
  responses:
    BadRequest:
      description: >-
        Invalid request. Occurs when required parameters are missing, validation
        fails, or the request format is incorrect.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: >-
              Invalid request: Missing required field 'name' in trigger
              definition
            status_code: 400
    Unauthorized:
      description: >-
        Unauthorized access. Occurs when authentication is missing or invalid,
        or when the authenticated user lacks permission.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'Unauthorized: Invalid or missing authentication token'
            status_code: 401
    InternalServerError:
      description: >-
        Internal server error. Occurs when an unexpected condition prevents the
        server from fulfilling the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'Internal server error: Unable to process request at this time'
            status_code: 500
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT token for authentication. Required for all API operations to verify
        identity and access permissions.

````