Connect Data Sources

This guide covers connecting your data systems to Loxtep. You will create connectors for golden-path integrations, configure workflow connections, and test connectivity. Once data is flowing, it lands in a governed data layer your AI agents reach over the hosted MCP server.

Create a Connector

Connectors authenticate with your source systems. Loxtep ships golden-path connectors for the sources most builders start with — Postgres, S3, webhooks, Shopify, Stripe, and HubSpot.

List available connector types and create a connector with loxtep_connect.

{ "operation": "list_connector_types" }

Create a connector using the selected type's metadata contract.

{
  "operation": "create_connector",
  "connector_type": "shopify",
  "metadata": { "api_key": "shpat_abc123", "shop": "mystore.myshopify.com" }
}

Each connector type requires specific metadata for authentication. The list_connector_types response describes the fields for each type.

Choose Direction (ingestion, delivery, or both)

Connectors whose catalog supports both inbound and outbound (Postgres is the common case) show a Direction step in the create wizard:

  • Ingestion only — pull data in
  • Delivery only — write data out
  • Both — the same connector can ingest and deliver

That choice is stored as metadata.direction. After create, the connector Data tab splits into Ingestion | Delivery when both apply. The Delivery sub-tab edits org-level destination defaults. It does not start a workflow.

Outbound write policy (table, write_mode, upsert primary_key, batch sizes, conflict_update) belongs on the workflow connection's delivery_config, not on connector configuration. See Configuring Delivery — Database (Postgres).

Configure OAuth Connectors

Some connector types (like Google Sheets, Salesforce, or HubSpot) use OAuth for authentication. These require a browser-based authorization flow.

Retrieve the OAuth authorization URL for a connector:

{ "operation": "get_oauth_url", "connector_id": "<connector-uuid>" }

Complete Authorization

Open the returned URL in a browser, authorize access, and Loxtep stores the refresh token automatically. The connector status transitions from pending to active once authorization completes.

Token Refresh

Loxtep handles token refresh transparently. If a refresh fails (revoked access, expired grant), the connector transitions to error status and ingestion pauses until re-authorization.

Postgres RDS IAM authentication

Postgres connectors (postgres, postgresql, postgres-source) accept auth_mode=password (a stored secret) or auth_mode=iam. IAM signs a fresh RDS auth token on each new physical connection. The token is not written to connector config, SSM, or logs.

Use the RDS Proxy endpoint as host. Set discrete host fields — IAM rejects a connection_string. The Username field is the database user that has the rds_iam role, not an AWS access key. Choosing IAM in Studio clears any stored password and forces TLS verify-full.

The following custom_settings create an IAM-authenticated Postgres connector:

{
  "connector_type": "postgres",
  "metadata": {
    "custom_settings": {
      "auth_mode": "iam",
      "host": "<RDS_PROXY_ENDPOINT>",
      "port": 5432,
      "database": "<DATABASE>",
      "username": "<DB_USER>",
      "aws_region": "<REGION>",
      "schema": "public",
      "ssl_mode": "verify-full",
      "ssl_ca": "<CA_PEM>"
    }
  }
}

aws_region is the region of the RDS Proxy. You can omit it when it matches the runtime AWS_REGION (or AWS_DEFAULT_REGION). If the database is not reachable from the public internet, also set network_binding to customer_vpc and pass the instance whose private subnets can reach the proxy.

Databases in more than one VPC

One instance keeps a primary private network and can add up to seven more. Add each extra network on the instance first, then set the connector's network to that name.

On a managed or self-hosted instance, the section Private connector networking (create: Private connector networking (optional)) includes Additional networks. Add network opens Network name, Extra subnet ID (AZ 1), Extra subnet ID (AZ 2), and Extra security group ID. The primary network stays on Private subnet ID (AZ 1), Private subnet ID (AZ 2), and Connector security group ID. Remove network drops that extra row. Leave Additional networks empty to keep every private connector on the primary network.

Network name is 1–16 lowercase letters or digits. default is reserved for the primary network. A subnet or security group can belong to only one network. Shared instances reject both connector_vpc and connector_vpcs.

Send the extra network on the instance as connection_details.connector_vpcs:

{
  "connection_details": {
    "connector_vpcs": [
      {
        "id": "postgres",
        "subnet_ids": ["subnet-11111111", "subnet-22222222"],
        "security_group_id": "sg-33333333"
      }
    ]
  }
}

connector_vpcs: null clears the extra networks and leaves the primary network in place. A stored connector_vpcs value that is present but does not match this shape is an error (Invalid connection_details.connector_vpcs). It is not treated as no extra networks. Removing a network a connector still uses returns 409 (Connector network in use). Clear that connector's metadata.connector_vpc_id before you remove the network.

CloudFormation validates the subnet IDs when it attaches the private connector Lambda. The deploy role policy does not grant EC2 actions.

After the instance has the extra network, open the connector Configuration panel. Connector network lists Primary network and each extra network name. Primary network uses the instance default and leaves metadata.connector_vpc_id unset. Pick the extra network that can reach this database. That choice is metadata.connector_vpc_id. The field is present when the connector's instance has at least one additional network.

Required IAM and database setup

  1. Enable IAM authentication on the RDS Proxy (and the Aurora / RDS instance behind it).

  2. Create a database user and grant it the rds_iam role. Do not store a password for that user on the connector.

  3. Grant the Loxtep runtime principal rds-db:connect on that user:

    arn:aws:rds-db:<region>:<account>:dbuser:<proxy-resource-id>/<db-username>

    The principal that needs the grant is the one that runs connectors-private-* (private probe, sample, and ingestion). A public test uses the same signer and the same permission on the process that executes test_connector.

  4. Provide the CA PEM in ssl_ca. IAM requires ssl_mode=verify-full; any other TLS mode is rejected.

IAM does not support logical replication (CDC). Use incremental or snapshot ingest.

Errors you will see

MessageCause
PostgreSQL auth_mode=iam does not support connection_string. Set host, port, database, and username.A URL was supplied. Use discrete host fields.
PostgreSQL auth_mode=iam does not accept a password. The RDS signer creates a token per connection; do not store one.A stored password was sent with auth_mode=iam.
PostgreSQL auth_mode=iam requires host, database, and username.One of the required discrete fields is missing.
PostgreSQL auth_mode=iam requires username.Discrete host and database were set but username was missing.
PostgreSQL auth_mode=iam does not allow pg_pool_options.<key>. TLS and the auth token come from the connector.pg_pool_options included password, connectionString, or ssl. IAM owns the token and TLS.
PostgreSQL auth_mode=iam requires ssl_mode=verify-full.TLS is not verify-full.
PostgreSQL auth_mode=iam requires custom_settings.ssl_ca (CA PEM) for verify-full.The CA PEM is missing.
PostgreSQL auth_mode=iam does not support logical replication (CDC). Use incremental or snapshot.CDC / logical replication was enabled.
PostgreSQL auth_mode=iam requires custom_settings.aws_region (or AWS_REGION on the runtime).No region on the connector and none on the runtime.
PostgreSQL auth_mode=… is not supported. Use password or iam.A value other than password or iam was set.
Failed to sign an RDS IAM auth token (…). The runtime principal needs rds-db:connect on this database user.The signer could not mint a token (typically missing rds-db:connect or a wrong region / user). Signature material is redacted.
RDS IAM auth token was empty.The signer returned no token.
CONNECTOR_NOT_CONFIGUREDThe connector is missing required IAM fields (ssl_mode=verify-full, ssl_ca, no password, no connection URL) or other Postgres setup.
Connector secret '<key>' is <size> characters; SSM Parameter Store supports at most 8192. Shorten the value (for example ssl_ca PEM) and retry.A secret such as the ssl_ca PEM is over 8192 characters. Trim it so it includes only the CA certificate or certificates the connection needs, then test again.

Test the connector after saving. A passing test does not start ingestion.

Workflow Connections

While connectors handle organization-level authentication, workflow connections define how data flows within a specific project. A connection node in a workflow graph represents a configured data pipe from a connector into a data product.

Bind the connector into a workflow graph with loxtep_build:

{
  "operation": "patch_workflow_graph",
  "project_id": "<project-uuid>",
  "workflow_id": "<workflow-uuid>",
  "operations": [
    {
      "op": "add_node",
      "node": {
        "id": "shopify-orders-sync",
        "type": "connection",
        "connector_id": "<connector-uuid>",
        "configuration": { "resource": "orders", "sync_mode": "incremental" }
      }
    }
  ]
}

Test Connectivity

Verify that the connection can reach the external system and authenticate successfully:

{ "operation": "test_connector", "connector_id": "<connector-uuid>" }

A successful test returns the connection status and a sample record from the source system.

Connection Configuration Patterns

Incremental Sync

For high-volume sources, use incremental sync to process only new or changed records since the last checkpoint:

{
  "connector_id": "conn_shopify",
  "resource": "orders",
  "sync_mode": "incremental",
  "cursor_field": "updated_at",
  "initial_cursor": "2024-01-01T00:00:00Z"
}

Full Refresh

For smaller reference datasets or when incremental tracking is not available, use full refresh to replace all records on each sync:

{
  "connector_id": "conn_postgres",
  "resource": "product_catalog",
  "sync_mode": "full_refresh",
  "schedule": "0 2 * * *"
}

Event-Driven Ingestion

For real-time sources, configure event-driven connections that stream records as they arrive:

{
  "connector_id": "conn_mongodb",
  "resource": "orders",
  "sync_mode": "streaming"
}

Attach Connections to Workflows

Once created, wire connections into your data product's ingestion workflow graph using the workflow patch API:

{
  "operation": "patch_workflow_graph",
  "project_id": "<project-uuid>",
  "workflow_id": "<workflow-uuid>",
  "operations": [
    {
      "op": "add_node",
      "node": { "id": "shopify_source", "type": "connection", "connector_id": "<connector-uuid>" }
    }
  ]
}

Add Validation Nodes

Add inline validation between the connection and the data product to catch schema violations early:

{
  "operation": "patch_workflow_graph",
  "project_id": "<project-uuid>",
  "workflow_id": "<workflow-uuid>",
  "operations": [
    {
      "op": "add_node",
      "node": {
        "id": "schema-check",
        "type": "validation",
        "schema_id": "<schema-uuid>",
        "on_failure": "reject"
      }
    }
  ]
}

Monitor Connection Health

Track connection status and throughput through the Observe dashboard or programmatically:

loxtep queue info dp_orders

Connection health metrics include records processed, validation failures, latency, and last successful sync timestamp.

Troubleshooting Connections

Authentication Failures

If a connector enters error status, check whether credentials have been rotated or OAuth tokens revoked. Re-authorize or update the connector metadata:

{
  "operation": "update_connector",
  "connector_id": "<connector-uuid>",
  "metadata": { "api_key": "shpat_new_key" }
}

Schema Mismatches

When source systems change their payload shape, validation failures spike. Update your schema to accommodate the new fields or add a transformation step to normalize the data before validation.