docs/platform/connector-development/connector-builder-ui/stream-templates.md
Use Stream Templates to generate multiple similar streams from a single template configuration.
Stream templates are ideal for scenarios like:
Not everyone needs to use stream templates, but people who are comfortable with the Connector Builder can use them to save a lot of time building and maintaining connectors.
A stream template consists of two main sections:
Stream templates use different approaches to produce data for generating multiple streams:
The most common approach fetches data via HTTP requests to determine what streams to generate. This uses the same request configuration interface as regular streams.
Example use case: fetching a list of repositories from GitHub API to generate individual issue streams for each repository.
Generate streams based on values specified in the connector's configuration. This is useful when users can specify what data they want to sync through the connector setup.
Example use case: a connector where users specify a list of database tables in the configuration, and each table becomes a separate stream.
Generate a fixed set of streams based on predefined parameters in the connector. This approach creates consistent streams across all connector instances.
Example use case: a connector that always creates streams for a fixed set of data types or regions.
The Components Mapping configuration defines how data from the resolver is mapped to variables that can be used in the Generated Stream Template. This is configured through the UI form and includes:
A list of potentially nested fields indicating the full path where the value will be added or updated in the template. Supports:
["primary_key"]["retriever", "requester", "url"]["retriever", "{{ components_values.name }}"]["*", "**", "name"]Optional specification of the expected data type (string, integer, boolean, etc.). If omitted, the type is inferred from the provided value.
Boolean flag determining whether to create new paths if they don't exist (true) or only update existing paths (false). Defaults to false.
To demonstrate how stream templates work, build a connector that fetches issues from multiple GitHub repositories. To make this work, you need to fetch a list of repositories from the GitHub API, then use their IDs to fetch the issues for each repository.
Click Builder.
Click New custom connector.
Click Start from scratch.
If prompted to use AI, click Skip and start manually.
Name your connector (for example, GitHub Issues).
Click the + button next to STREAM TEMPLATES.
Enter a name for your template (for example, Repository Issues).
Under Produce Data for Template, set API Endpoint URL to https://api.github.com/repositories.
Click Preview endpoint. The panel on the right displays a sample of the data that endpoint returns.
Because each repository has a unique name and URL, you need to set up component mappings to allow generated streams to reflect these values.
Under Produce Data for Template, in the Components Mapping section, create two component mappings.
In the first component map, set Field Path to name.
Set Value to {{ components_values.full_name }} issues.
Click Add to add a second component mapping.
In the second component map, set Field Path to retriever, requester, url.
Set Value to https://api.github.com/repositories/{{ components_values.id }}/issues.
In the Generated Stream Template section, provide a Name. It doesn't matter what you call it. Any static value works.
Click Generate Streams to generate the streams from the template.
After generating the streams, you can expand the stream template in the left-hand sidebar to see the list of generated streams.
Click on one of the generated streams to see its configuration and test it to verify that it works as expected.
:::info You can't modify generated streams. To make changes, modify the parent Stream Template configuration and re-generate the streams. :::
The Connector Builder UI provides access to commonly used configuration fields for the Produce Data for Template section.
Additional fields are available through the form interface, organized into logical sections like request configuration, response handling, and data mapping.
When using interpolation in your stream templates, you have access to these contexts.
{{ components_values.field_name }} - Access fields from the Produce Data for Template records{{ config.field_name }} - Access connector configuration values{{ stream_slice.field_name }} - Access stream slice information{{ stream_template_config.field_name }} - Access stream template configuration{{ components_values.field_name }} to access fields from the Produce Data for Template records.