Configuring Delivery
This guide helps you answer: "How do I get my data to an external system?" Follow the decision tree to pick the right pattern, then use the step-by-step setup instructions below.
Choosing a Delivery Pattern
A delivery interface defines how your data product's data reaches external systems. You can configure delivery on both source and consumer data products from the Delivery tab on the data product detail page.
Do you need to reshape data first?
Yes — Build a consumer data product first to transform, filter, or join data from one or more sources. Then return here to configure delivery on that consumer.
No — Attach a delivery interface directly to your source data product.
Which pattern fits your use case?
| Pattern | Latency | Best For |
|---|---|---|
| Webhook | Real-time | Event-driven integrations, triggering downstream workflows |
| API Endpoint | On-demand | Apps, services, dashboards querying on their own schedule |
| Export | Batch | Reports, data sharing, compliance archives |
| Database (Postgres) | Near real-time | Landing rows in your own Postgres table |
| SQL Query | On-demand | Analysis, and BI tools on the queryable table |
| Event Stream (SDK) | Real-time | Streaming pipelines, CDC, custom integrations |
Want data to land in your own Snowflake or Databricks warehouse? See Bring your own warehouse — bind a table that's already there, or ingest directly into it. For your own Postgres, use Database (Postgres) — that is a delivery-workflow Target, not a warehouse bind.
Quick rules of thumb:
- Need real-time updates? → Webhook or Event Stream (SDK)
- Consumers query on their own schedule? → API Endpoint or SQL Query
- Periodic bulk transfer? → Export
- Write rows into a Postgres table you own? → Database (Postgres)
- Feeding Metabase, Tableau, Power BI, or Looker? → a SQL grant on the queryable table or a shaped SQL table
Author a delivery workflow via MCP
Use this shape whenever you author outbound delivery with save_workflow_bundle. Saving a workflow_type: "delivery" bundle whose first node is not a data-product-trigger fails with DELIVERY_FIRST_NODE_NOT_DATA_PRODUCT_TRIGGER. A Target-only bundle is not enough.
Task: take a published data product and write its events to an external system.
- Confirm the source product exists (
get_data_product/list_data_products) and you have a destination connector (connector_id). - Compose a delivery bundle under
workflows/{workflow_id}/. Paths in the MCPfilesmap are relative to that folder — do not prefix them withworkflows/{workflow_id}/. - Head: a
connections/{trigger_id}.jsonwhosetypeisdata-product-triggerand whoseconfiguration.source_data_product_idis the published product UUID. Do not put adata-productsentity at the head (that would take ownership of the publisher's product). Do not useconfiguration.source_queue. - Tail: a Target
connections/{target_id}.jsonwithconnector_id,connector_mode: "outbound", andupstream_entity_idpointing at the trigger (or at the last transform). There is no top-levelrolefield —role: "Target"is rejected asunknown_field. Put write-policy keys (table,write_mode,primary_key,endpoint_url,format, batch sizes,conflict_update) ondelivery_config. Leaving them underconfigurationis refused. - Optional transforms sit between the trigger and the Target. The Target then points at the last transform (
upstream_entity_type: "transformations"). That DPT → transform → Target chain deploys; grant embedding walks back to the trigger'ssource_data_product_id. save_workflow_bundlewithdry_run: true, fix errors, then persist. Aworkflow_idthe catalog already assigns to another project is refused withWORKFLOW_ID_OWNED_BY_OTHER_PROJECT, including whendry_runis true. Nothing is written. Use a newworkflow_id. This refusal was not run live. Unverified.- Grant the outbound writer (
data_products:manage):save_delivery_grantorproject_filesgrants/{grant_id}.json. Persist fails if a declared grant file does not materialize into a subscriber row. List/read withlist_delivery_grants/get_delivery_grant; patch withupdate_delivery_grant. deploy_workflow— deploy embeds the active grant into the Target writer. Grant changes need a redeploy. The returneddeployment_idcan be read at once withget_deployment. The call's status isrequested. The stored row ispending, thenin_progress, thendeployedorfailed. The first read of that id ispending. A missing row for an id this call just returned is a platform fault. This poll was not run live. Unverified.
Replace the placeholder UUIDs below with IDs from your org. project_id on the MCP call must be a UUID (the runtime supplies org context).
Grant the outbound writer
Call save_delivery_grant with the source product, the Target connection_id, and a party (domain shown here):
{
"operation": "save_delivery_grant",
"project_id": "44444444-4444-4444-8444-444444444444",
"grant_id": "11111111-1111-4111-8111-111111111203",
"data_product_id": "66666666-6666-4666-8666-666666666666",
"party_subject_type": "domain",
"domain_id": "55555555-5555-4555-8555-555555555555",
"access_method": "webhook",
"connection_id": "11111111-1111-4111-8111-111111111202",
"status": "active"
}
Equivalent Git declaration (pass in project_files, not files):
{
"grant_id": "11111111-1111-4111-8111-111111111203",
"organization_id": "33333333-3333-4333-8333-333333333333",
"data_product_id": "66666666-6666-4666-8666-666666666666",
"party_subject_type": "domain",
"domain_id": "55555555-5555-4555-8555-555555555555",
"access_method": "webhook",
"connection_id": "11111111-1111-4111-8111-111111111202",
"status": "active",
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
}
access_method is one of sql, api_endpoint, event_stream, webhook, export. Match it to the Target (webhook → webhook, file export → export, Postgres table write → export, a BI tool or analyst query → sql).
Set the destination for the instance you deploy to
Deploy writes the destination for the instance you name. Put that instance's table, host, or endpoint on its overlay. When the overlay has keys, those keys replace the same keys on the grant's base destination. An empty overlay ({}) is unbound. Deploy does not copy the grant's base destination onto that instance, so a stage table or host stays off prod. When seeding is allowed and the base destination has keys, deploy can store that base on the home instance only. Otherwise deploy fails closed with unbound_destination_overlay. A deploy with no instance id fails closed with missing_instance_id when the base destination has keys or any overlay is already stored. This is resolveDeliveryGrantDestinationForDeploy in delivery-grant-instance-overlays.ts. The grant JSON above was not deployed. Unverified.
Webhook
Push data to an HTTP endpoint whenever the data product changes. Ideal for event-driven integrations where downstream systems need to react to changes in real time.
Setup
Author a delivery workflow via MCP. The bundle must start with a
data-product-trigger (see Author a delivery workflow via MCP), then grant and deploy:
{
"operation": "save_workflow_bundle",
"project_id": "44444444-4444-4444-8444-444444444444",
"dry_run": true,
"files": {
"workflow.json": {
"workflow_id": "11111111-1111-4111-8111-111111111111",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"name": "Customer webhook delivery",
"template_id": "990e8400-e29b-41d4-a716-446655440000",
"workflow_type": "delivery",
"domain_id": "55555555-5555-4555-8555-555555555555",
"status": "active",
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
},
"connections/11111111-1111-4111-8111-111111111201.json": {
"connection_id": "11111111-1111-4111-8111-111111111201",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"workflow_id": "11111111-1111-4111-8111-111111111111",
"key": "from-customer-360",
"name": "From customer_360",
"type": "data-product-trigger",
"status": "active",
"upstream_entity_id": null,
"configuration": {
"source_data_product_id": "66666666-6666-4666-8666-666666666666"
},
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
},
"connections/11111111-1111-4111-8111-111111111202.json": {
"connection_id": "11111111-1111-4111-8111-111111111202",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"workflow_id": "11111111-1111-4111-8111-111111111111",
"key": "customer-webhook-target",
"name": "Customer webhook target",
"type": "webhook",
"status": "active",
"connector_id": "77777777-7777-4777-8777-777777777777",
"connector_mode": "outbound",
"upstream_entity_id": "11111111-1111-4111-8111-111111111201",
"upstream_entity_type": "connections",
"configuration": {
"method": "POST",
"headers": { "X-Source": "loxtep" }
},
"delivery_config": {
"endpoint_url": "https://app.example.com/hooks/customer-update"
},
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
}
}
}
Then save_delivery_grant (see Grant the outbound writer) and deploy:
{
"operation": "deploy_workflow",
"workflow_id": "11111111-1111-4111-8111-111111111111",
"instance_id": "99999999-9999-4999-8999-999999999999"
}
Configuration Options
| Option | Required | Description |
|---|---|---|
endpoint_url | Yes | The HTTPS URL to receive POST/PUT requests |
method | No | HTTP method (POST or PUT). Defaults to POST |
headers | No | Custom HTTP headers to include in each request |
secret_token | No | HMAC signing secret for payload verification |
filters | No | Field-level filters to control which changes trigger delivery |
retry_policy | No | Retry configuration (max attempts, backoff) |
Verifying Delivery
After deployment, publish a test change to the source data product and inspect the delivery workflow in Observe. Confirm the receiver's HTTP status and signature handling before enabling production traffic.
API Endpoint
Generate a queryable REST API for on-demand access to the data product. Consumers query the endpoint when they need data rather than waiting for pushes.
Setup
Author an API-endpoint delivery workflow via MCP. Use the same data-product-trigger head and grant step as Author a delivery workflow via MCP:
{
"operation": "save_workflow_bundle",
"project_id": "44444444-4444-4444-8444-444444444444",
"dry_run": true,
"files": {
"workflow.json": {
"workflow_id": "22222222-2222-4222-8222-222222222222",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"name": "Customer API delivery",
"template_id": "990e8400-e29b-41d4-a716-446655440000",
"workflow_type": "delivery",
"domain_id": "55555555-5555-4555-8555-555555555555",
"status": "active",
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
},
"connections/22222222-2222-4222-8222-222222222201.json": {
"connection_id": "22222222-2222-4222-8222-222222222201",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"workflow_id": "22222222-2222-4222-8222-222222222222",
"key": "from-customer-360",
"name": "From customer_360",
"type": "data-product-trigger",
"status": "active",
"upstream_entity_id": null,
"configuration": {
"source_data_product_id": "66666666-6666-4666-8666-666666666666"
},
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
},
"connections/22222222-2222-4222-8222-222222222202.json": {
"connection_id": "22222222-2222-4222-8222-222222222202",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"workflow_id": "22222222-2222-4222-8222-222222222222",
"key": "customer-api-target",
"name": "Customer API target",
"type": "api_endpoint",
"status": "active",
"connector_id": "77777777-7777-4777-8777-777777777777",
"connector_mode": "outbound",
"upstream_entity_id": "22222222-2222-4222-8222-222222222201",
"upstream_entity_type": "connections",
"configuration": {
"path": "/api/v1/customers",
"auth": "bearer"
},
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
}
}
}
Then save_delivery_grant with access_method: "api_endpoint" and connection_id set to the Target, and deploy:
{
"operation": "deploy_workflow",
"workflow_id": "22222222-2222-4222-8222-222222222222",
"instance_id": "99999999-9999-4999-8999-999999999999"
}
Configuration Options
| Option | Required | Description |
|---|---|---|
path | Yes | The URL path for the generated endpoint |
auth | No | Authentication method (bearer, api_key, none). Defaults to bearer |
rate_limit | No | Maximum requests per minute |
allowed_filters | No | Fields consumers can filter on |
default_page_size | No | Default pagination size. Defaults to 50 |
max_page_size | No | Maximum pagination size. Defaults to 200 |
Querying the Endpoint
To read the product from Loxtep itself, use loxtep_query → execute_query scoped to the data product:
{
"operation": "execute_query",
"data_product_id": "66666666-6666-4666-8666-666666666666",
"sql": "SELECT name, email, segment FROM customer_360 WHERE segment = 'vip' ORDER BY name",
"limit": 100,
"offset": 0
}
Select columns, filter, and sort in the SQL. limit is at most 10000 and offset pages through results. From scripts, use loxtep data-products query <data-product-id> "SQL" in the CLI or client.build.data_products.query(id, sql) in the TypeScript SDK.
Export
Scheduled or one-time bulk extract to file (CSV, Parquet, JSON). Useful for reports, compliance archives, and large dataset transfers to partners.
Setup
Author an export delivery workflow via MCP. Use the same
data-product-trigger head and grant step as
Author a delivery workflow via MCP. Put
file-format and destination keys on delivery_config (not configuration —
write-policy keys under configuration are refused):
{
"operation": "save_workflow_bundle",
"project_id": "44444444-4444-4444-8444-444444444444",
"dry_run": true,
"files": {
"workflow.json": {
"workflow_id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"name": "Customer export delivery",
"template_id": "990e8400-e29b-41d4-a716-446655440000",
"workflow_type": "delivery",
"domain_id": "55555555-5555-4555-8555-555555555555",
"status": "active",
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
},
"connections/aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaa01.json": {
"connection_id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaa01",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"workflow_id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
"key": "from-customer-360",
"name": "From customer_360",
"type": "data-product-trigger",
"status": "active",
"upstream_entity_id": null,
"configuration": {
"source_data_product_id": "66666666-6666-4666-8666-666666666666"
},
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
},
"connections/aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaa02.json": {
"connection_id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaa02",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"workflow_id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
"key": "customer-export-target",
"name": "Customer export target",
"type": "s3",
"status": "active",
"connector_id": "77777777-7777-4777-8777-777777777777",
"connector_mode": "outbound",
"upstream_entity_id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaa01",
"upstream_entity_type": "connections",
"configuration": {},
"delivery_config": {
"format": "parquet",
"destination": "s3://reports/customers/",
"write_mode": "append"
},
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
}
}
}
Then save_delivery_grant with access_method: "export" and connection_id set to the Target, and deploy:
{
"operation": "deploy_workflow",
"workflow_id": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
"instance_id": "99999999-9999-4999-8999-999999999999"
}
Configuration Options
| Option | Required | Description |
|---|---|---|
format | Yes | Output format: csv, parquet, or json |
destination | Yes | Target location (S3 URI, GCS URI, or download) |
schedule | No | Cron expression for recurring exports. Omit for one-time |
compression | No | Compression: snappy, gzip, none. Defaults to snappy for Parquet |
partition_by | No | Fields to partition output by (e.g., ["date", "region"]) |
filters | No | Record-level filters for the export |
Running an Export Manually
Use the delivery workflow's Run action in Products to trigger an on-demand export outside its schedule, then inspect the run in Observe.
Database (Postgres)
Task: write events from a published data product into a table in your Postgres.
This is a delivery-workflow Target, not SQL Query (analytics engine) and not Bring your own warehouse. The org Postgres connector holds auth and host. The workflow connection holds write policy on delivery_config.
1. Point a Postgres connector at the destination
Create or reuse a Postgres connector. In the create wizard, connectors that support both directions show a Direction step: Ingestion only, Delivery only, or Both. Choose Delivery only or Both.
On the connector's Data tab, Ingestion | Delivery sub-tabs appear when both apply. The Delivery tab stores org-level destination defaults on the connector. It does not start a workflow.
Auth stays on the org connector:
| Auth | What you set | Constraints |
|---|---|---|
| Password (default) | host, database, username, password | Non-localhost requires username + password. TLS defaults to require (non-localhost) or prefer (localhost). |
IAM (auth_mode: iam) | host, database, username — no password, no connection URL | ssl_mode must be verify-full with ssl_ca PEM. CDC with IAM is refused. The instance role needs rds-db:connect on that DB user. |
Do not put the destination table or upsert keys on the connector configuration.
2. Author the delivery workflow
Follow Author a delivery workflow via MCP: data-product-trigger head → optional transform → Postgres Target. Put write policy on the Target's delivery_config:
{
"operation": "save_workflow_bundle",
"project_id": "44444444-4444-4444-8444-444444444444",
"dry_run": true,
"files": {
"workflow.json": {
"workflow_id": "88888888-8888-4888-8888-888888888888",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"name": "Customer Postgres delivery",
"template_id": "990e8400-e29b-41d4-a716-446655440000",
"workflow_type": "delivery",
"domain_id": "55555555-5555-4555-8555-555555555555",
"status": "active",
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
},
"connections/88888888-8888-4888-8888-888888888201.json": {
"connection_id": "88888888-8888-4888-8888-888888888201",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"workflow_id": "88888888-8888-4888-8888-888888888888",
"key": "from-customer-360",
"name": "From customer_360",
"type": "data-product-trigger",
"status": "active",
"upstream_entity_id": null,
"configuration": {
"source_data_product_id": "66666666-6666-4666-8666-666666666666"
},
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
},
"connections/88888888-8888-4888-8888-888888888202.json": {
"connection_id": "88888888-8888-4888-8888-888888888202",
"organization_id": "33333333-3333-4333-8333-333333333333",
"project_id": "44444444-4444-4444-8444-444444444444",
"workflow_id": "88888888-8888-4888-8888-888888888888",
"key": "customer-postgres-target",
"name": "Customer Postgres target",
"type": "postgres",
"status": "active",
"connector_id": "77777777-7777-4777-8777-777777777777",
"connector_mode": "outbound",
"upstream_entity_id": "88888888-8888-4888-8888-888888888201",
"upstream_entity_type": "connections",
"configuration": {},
"delivery_config": {
"table": "analytics.customers",
"write_mode": "upsert",
"primary_key": ["customer_id"],
"insert_batch_size": 1000,
"batch_size": 100,
"conflict_update": { "default": "excluded" }
},
"created_at": "2026-10-26T00:00:00.000Z",
"updated_at": "2026-10-26T00:00:00.000Z"
}
}
}
A mid-graph transform is allowed: add transformations/{id}.json with upstream_entity_id set to the trigger, and point the Target at that transform. Events must already be destination-shaped when they reach the Postgres writer.
Then save_delivery_grant with access_method: "export" and connection_id set to the Target, and deploy_workflow.
Saving write-policy keys (table, write_mode, primary_key, insert_batch_size, conflict_update, …) under configuration is refused — move them to delivery_config.
Write policy (delivery_config)
| Field | Required | What it does |
|---|---|---|
table | Yes at runtime | Destination table. Schema-qualified names work (analytics.customers). Alias: destination_table (Postgres outbound reads table or destination_table only). A missing table fails the batch with missing_table (it does not skip). |
schema | No | Destination schema when it is not embedded in table. |
write_mode | No | append, upsert (queue-driven default when omitted), or replace. An unrecognized value is refused at save (invalid_write_mode, allowed values listed) and throws at delivery. Queue-driven delivery refuses replace plus truncate_before_write: true. |
primary_key | For upsert | Destination conflict columns. Default _id when omitted on the queue-driven path. This is not ingestion_config.primary_key. |
insert_batch_size | No | Rows per multi-value INSERT. Integer from 1 to 10000. When unset, save writes the documented default 1000. A value outside that range, including 0, is refused at save (invalid_insert_batch_size) and throws at delivery. A per-call options.batch_size is an insert override with the same rules. Stream-read batch_size is not the INSERT size. |
batch_size | No | Stream-read batch (LeoCron). Intended range 1–10000 when set; unset defaults to 100 on the registered consumer. Not applied to SQL INSERT chunking on the delivery Target path. |
conflict_update | No | Upsert conflict behavior. default: excluded (take incoming) or keep_existing. Optional per-column strategies include excluded, keep_existing, coalesce_excluded, greatest, least, enum_advance, only_if_newer. |
update_columns | No | Explicit UPDATE column list on upsert. |
exclude_columns | No | Columns stripped before INSERT/UPSERT. |
statement_timeout | No | Milliseconds; applied as SET LOCAL statement_timeout when greater than 0. |
A missing host (and no connection string) fails the batch with missing_host.
Upsert behavior
- Omitted columns are left as they are. Heterogeneous batches do not bind missing keys as NULL.
- An upsert whose only columns are the primary key is
ON CONFLICT … DO NOTHING. - Within one Lambda batch, the last event for a given primary key wins.
Arrays, JSON, and schema errors
Postgres ARRAY columns bind as SQL arrays. json / jsonb columns bind with JSON.stringify. Schema mismatches (destination_schema_mismatch, including type and missing-column errors) land on the connection error queue and open an Inbox issue (error_code on the payload). Unique violations use unique_violation. Transient deadlocks and timeouts retry.
Limits
| Limit | Value |
|---|---|
insert_batch_size | Integer 1–10000. Unset is the documented default 1000, written at save. Out of range, including 0, is invalid_insert_batch_size at save and a throw at delivery. |
Stream batch_size | Integer 1–10000 when set (consumer default 100). Not used for SQL INSERT chunking. |
| IAM TLS | verify-full + CA only |
SQL Query
Access data through the built-in analytics engine. Run queries from the platform, CLI, or SDK. Metabase, Tableau, Power BI, and Looker read the same table through a SQL grant.
BI tools
Publish SQL on the data product, then grant sql to the party that uses the tool:
{
"operation": "save_delivery_grant",
"project_id": "44444444-4444-4444-8444-444444444444",
"grant_id": "11111111-1111-4111-8111-111111111204",
"data_product_id": "66666666-6666-4666-8666-666666666666",
"party_subject_type": "domain",
"domain_id": "55555555-5555-4555-8555-555555555555",
"access_method": "sql",
"status": "active"
}
Point the tool at the queryable table, or at a shaped SQL table. A connection file is not a delivery method.
Setup
Run a query from the platform, CLI, or SDK:
{
"operation": "execute_query",
"sql": "SELECT customer_id, segment, lifetime_value FROM customer_360 WHERE segment = 'vip'"
}
Available SQL Features
- Standard SQL
- JOINs across data products
- Window functions and aggregations
- Date/time manipulation
- JSON field access
Listing Available Tables
Use loxtep_query to see all queryable tables in your analytics engine:
{ "operation": "list_tables" }
Event Stream (SDK Connector)
Stream events in and out of data products programmatically using the @loxtep/sdk. The SDK resolves queue names, bot identities, and stream bus configuration automatically from the data product's deployment metadata.
Install the SDK
Add the SDK to your project:
npm install @loxtep/sdk
Writing Events
Use get_writer() to push records into a data product's stream:
import { LoxtepClient } from '@loxtep/sdk';
const client = new LoxtepClient({
api_url: 'https://api.loxtep.io',
auth: { type: 'jwt', token: process.env.LOXTEP_AUTH_TOKEN! },
});
const writer = await client.get_writer('shopify_gql_customer', {
transport_mode: 'default',
});
writer.write({ customer_id: '123', name: 'Alice', email: 'alice@example.com' });
writer.write({ customer_id: '456', name: 'Bob', email: 'bob@example.com' });
await writer.close();
Pass raw business objects — the SDK handles batching and delivery to the stream bus. Always call close() when done to flush buffered events.
Use default for durable, balanced writes (recommended). Use fast when the
lowest latency is worth potentially higher cost. Use volume for sustained
throughput when delivery lag is acceptable.
Reading Events
Use get_reader() to consume events from a data product as an async iterable:
const reader = await client.get_reader('shopify_gql_customer');
for await (const event of reader) {
console.log(event);
}
Reader options include from (start position) and batch_size.
Stream Helpers
Use mapStream and filterStream to transform or filter events inline:
import { mapStream, filterStream } from '@loxtep/sdk';
const reader = await client.get_reader('orders');
// Filter to only VIP orders
for await (const event of filterStream(reader, e => e.segment === 'vip')) {
console.log(event);
}
// Transform events
for await (const event of mapStream(reader, e => e.payload)) {
console.log(event);
}
Lower-Level Access
For explicit control over queue names and bot identities, use the flows or queues API:
const writer = client.flows.get_writer('your-flow-id', {
bot_id: 'your-bot-id',
output_queue_name: 'your-ingest-queue',
});
writer.write({ customer_id: '123', name: 'Alice' });
await writer.close();
Managing Delivery Interfaces
List All Interfaces
List delivery workflows in the project via MCP:
{
"operation": "list_workflows",
"project_id": "44444444-4444-4444-8444-444444444444",
"workflow_type": "delivery"
}
List the delivery grants attached to the product.
{ "operation": "list_delivery_grants", "data_product_id": "66666666-6666-4666-8666-666666666666" }
Pause and Resume
Temporarily pause a delivery workflow without deleting its configuration:
{ "operation": "update_workflow", "workflow_id": "<workflow-uuid>", "status": "paused" }
Resume the workflow by returning it to active status.
{ "operation": "update_workflow", "workflow_id": "<workflow-uuid>", "status": "active" }
Delete an Interface
Remove a delivery interface:
{ "operation": "delete_workflow", "workflow_id": "<workflow-uuid>" }
Related Guides and Concepts
- Delivery Patterns — conceptual deep-dive into each pattern's architecture
- Build a Consumer Data Product — create a composed view before configuring delivery
- Consumer Data Products — learn about demand-driven modeling and projection logic