---
title: "Create a stream trigger"
method: POST
path: "/trigger/stream"
tags: ["Stream Triggers"]
---

# Create a stream trigger

`POST /trigger/stream`

## Request

- Base URL: `https://api.quiva.ai`
- URL: `https://api.quiva.ai/trigger/stream`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-6/docs/trigger/stream/post.ts> (a function with typed inputs; its response is checked against the schema)

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

## Request body

- StreamTriggerRequest
  - `name` string, required: Unique name identifier for the trigger. Used to construct the trigger's topic and subject.
  - `collection` string: Logical grouping the trigger belongs to. Used for organizing and filtering triggers.
  - `description` string: Human-readable description explaining the trigger's purpose and function.
  - `trigger_type` 'stream', required: Must be 'stream' for this endpoint. Determines the trigger's behavior and available properties.
  - `source` TriggerSource, required
    - `advertise` boolean: Whether to advertise this trigger source to other services. When true, allows other services to discover this source.
    - `allow_trace` boolean: Whether to allow request tracing. When true, enables debugging and performance monitoring.
    - `name` string: Human-readable name for the source. Used for identification in logs and monitoring.
    - `response_type` 'Singleton' | 'Stream' | 'Chunked': 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` string: Subject identifier for the source. Used for routing messages to/from this source.
    - `type` 'stream' | 'service': Export type categorizing how this source behaves: * stream - Emits a continuous flow of data * service - Provides request/response functionality
    - `description` string: Detailed information about the source including its purpose and data format.
    - `info_url` string: URL pointing to additional documentation or information about this source.
  - `target` TriggerTarget, required
    - `name` string: Human-readable name for the target. Used for identification in logs and monitoring.
    - `subject` string: Subject identifier for the target. Used for routing messages to this target.
    - `account` string: Account identifier owning or associated with this target. Used for access control.
    - `local_subject` string: Alternative subject for local routing within the same account.
    - `type` 'stream' | 'service': Export type categorizing how this target behaves: * stream - Consumes a continuous flow of data * service - Provides request/response functionality
    - `share` boolean: Whether this target is shareable with other accounts. When true, allows cross-account access.
    - `allow_trace` boolean: Whether to allow request tracing to this target. When true, enables debugging and performance monitoring.

## Response `201`

Stream trigger created successfully

- StreamTriggerResponse
  - `body` object
    - `name` string: Unique name identifier for the trigger. Used to construct the trigger's topic and subject.
    - `collection` string: Logical grouping the trigger belongs to. Used for organizing and filtering triggers.
    - `description` string: Human-readable description explaining the trigger's purpose and function.
    - `source` TriggerSource
      - `advertise` boolean: Whether to advertise this trigger source to other services. When true, allows other services to discover this source.
      - `allow_trace` boolean: Whether to allow request tracing. When true, enables debugging and performance monitoring.
      - `name` string: Human-readable name for the source. Used for identification in logs and monitoring.
      - `response_type` 'Singleton' | 'Stream' | 'Chunked': 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` string: Subject identifier for the source. Used for routing messages to/from this source.
      - `type` 'stream' | 'service': Export type categorizing how this source behaves: * stream - Emits a continuous flow of data * service - Provides request/response functionality
      - `description` string: Detailed information about the source including its purpose and data format.
      - `info_url` string: URL pointing to additional documentation or information about this source.
    - `target` TriggerTarget
      - `name` string: Human-readable name for the target. Used for identification in logs and monitoring.
      - `subject` string: Subject identifier for the target. Used for routing messages to this target.
      - `account` string: Account identifier owning or associated with this target. Used for access control.
      - `local_subject` string: Alternative subject for local routing within the same account.
      - `type` 'stream' | 'service': Export type categorizing how this target behaves: * stream - Consumes a continuous flow of data * service - Provides request/response functionality
      - `share` boolean: Whether this target is shareable with other accounts. When true, allows cross-account access.
      - `allow_trace` boolean: Whether to allow request tracing to this target. When true, enables debugging and performance monitoring.
    - `stream` string: Stream identifier where the trigger configuration is stored.
    - `subject` string: Full subject identifier for the trigger, following the pattern "ms.trigger.stream.[name]".
    - `trigger_type` 'stream': Type of trigger, always 'stream' for stream triggers.
    - `type` string: Specific type identifier providing additional classification information.
  - `status_code` integer: HTTP status code indicating the result of the operation.

## Other responses

- `400`: Invalid request. Occurs when required parameters are missing, validation fails, or the request format is incorrect.
- `401`: Unauthorized access. Occurs when authentication is missing or invalid, or when the authenticated user lacks permission.
- `500`: Internal server error. Occurs when an unexpected condition prevents the server from fulfilling the request.

---

[API](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-6.md) - [All operations](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-6/llms.txt) - [OpenAPI document](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-6/revisions/a9f443efdc5d?raw)
