Load Braze data to Amazon S3
Build a Braze to Amazon S3 pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Braze API base URL, auth, endpoints, and incremental loading.
Braze provides a REST API for tracking users, sending messages, exporting data, and managing campaigns, Canvases, catalogs, and related resources. Everything needed to build a working Braze → Amazon S3 pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.
Build your Braze to Amazon S3 pipeline
Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.
uvx dlthub-init@latest to build a pipeline from Braze to Amazon S3 and run it on dltHubThat scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the Braze API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →
Prefer to write it yourself? Every fact the agent uses is below.
Braze API at a glance
| Base URL | https://rest.iad-01.braze.com |
| Example endpoint | GET campaigns/list |
| Records found at | campaigns |
| Authentication | all requests require a Braze REST API key as a Bearer token — sent in the Authorization header, prefixed Bearer |
| Pagination | Page-number via page, up to 100 rows per page. For the campaigns list endpoint, pagination is page-number based, not cursor/token based. The page parameter defaults to 0 and returns the first set of up to 100 campaigns. Increment page (page=0, page=1, ...) to retrieve subsequent pages. The incremental filter is last_edit.time[gt], which returns campaigns edited after the supplied timestamp; it is a filter, not a pagination cursor. Braze's documented request uses a regional base URL such as https://rest.iad-01.braze.com and bearer authentication in the Authorization header. Other Braze list endpoints vary: custom events, custom attributes, and catalog items use cursor pagination via a cursor query parameter and Link response header, generally 50 records per request; product IDs use page pagination but the cited documentation does not state a page size. |
| Incremental field | last_edited |
| Record id | id |
| API reference | https://www.braze.com/docs/api/home |
These values come from the Braze API reference — the authoritative source if anything here looks out of date.
How do I authenticate with the Braze API?
Send the Braze REST API key in the HTTP Authorization header as Authorization: Bearer YOUR_REST_API_KEY. JSON request bodies, where applicable, use Content-Type: application/json; the X-Braze-Bulk header is endpoint/use-case-specific and should not be treated as a universal required header.
1. Get your credentials
- Sign in to the Braze dashboard for your workspace. 2. Open Settings > APIs and Identifiers > API Keys. 3. Select Create API Key. 4. Name the key, optionally specify allowlisted IP addresses/subnets, and grant only the REST API permissions required by the integration. 5. Create the key and copy its value securely; Braze uses this REST API key as a bearer token. 6. On the same API Keys tab, copy the REST endpoint shown for your workspace and configure that single cluster-specific base URL (for example, https://rest.iad-01.braze.com). Do not assume every workspace uses the example URL: Braze assigns accounts to clusters, and the dashboard/API-key page identifies the correct endpoint. Treat the key as a secret; it cannot be edited after creation, so create a replacement key if rotation is needed.
2. Add them to .dlt/secrets.toml
[sources.braze_source] api_key = "your_braze_rest_api_key" base_url = "https://rest.iad-01.braze.com"
dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.
What Braze data can I load into Amazon S3?
These are the Braze endpoints dlt can load into Amazon S3:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| campaigns | campaigns/list | GET | campaigns | Export campaigns; paginated with page (0-based), up to 100 per page; supports include_archived, sort_direction, and incremental last_edit.time[gt]. |
| campaign_details | campaigns/details | GET | Retrieve one campaign by campaign_id; response is an object containing updated_at. | |
| segment_details | segments/details | GET | Retrieve one segment by segment_id; response is an object containing updated_at. | |
| segment_analytics | segments/data_series | GET | data | Daily estimated segment-size series; requires segment_id and length, with optional ending_at. |
| export_catalog | catalogs/list | GET | Not verified in retrieved source; omit from production configuration until the response selector is confirmed. | |
| canvas_list | canvas/list | GET | Listed by Braze as an available GET export endpoint, but path and response selector were not verified in retrieved source. | |
| segment_list | segments/list | GET | segments | Listed by Braze as an available GET export endpoint; response selector/path should be confirmed against the live reference before use. |
How do I load only new Braze records?
Braze exposes last_edited on campaigns/list, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.
{"name": "campaigns", "endpoint": { "path": "campaigns/list", "data_selector": "campaigns", "incremental": {"cursor_path": "last_edited", "initial_value": "2024-01-01T00:00:00Z"}, }}
On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.
What does the generated Braze pipeline look like?
A standard dlt REST API pipeline — the same code you would write by hand, loading campaigns and canvases from the Braze API into Amazon S3:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def braze_source(api_key=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://rest.iad-01.braze.com", "auth": {"type": "bearer", "token": api_key}, }, "resources": [ {"name": "campaigns", "endpoint": {"path": "campaigns/list", "data_selector": "campaigns"}}, {"name": "segment_analytics", "endpoint": {"path": "segments/data_series", "data_selector": "data"}} ], } yield from rest_api_resources(config) def load_braze_to_amazon_s3_filesystem() -> None: pipeline = dlt.pipeline( pipeline_name="braze_pipeline", destination="filesystem", dataset_name="braze_data", ) load_info = pipeline.run(braze_source()) print(load_info) if __name__ == "__main__": load_braze_to_amazon_s3_filesystem()
Run it with uv run python braze_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.
How do I configure Amazon S3 as the destination?
dlt writes to Amazon S3 through its filesystem destination; the s3:// scheme in bucket_url selects it. Install the extra with uv add "dlt[s3]", then add to .dlt/config.toml and .dlt/secrets.toml:
# .dlt/config.toml [destination.filesystem] bucket_url = "s3://<bucket>/<path>" # .dlt/secrets.toml [destination.filesystem.credentials] aws_access_key_id = "<access key id>" aws_secret_access_key = "<secret access key>"
dlt writes JSONL by default; pass loader_file_format="parquet" to pipeline.run() for Parquet. Delta and Iceberg table formats are supported too. See the dlt filesystem destination docs.
Changing bucket_url is all it takes to write the same data to Google Cloud Storage, Azure Blob Storage or local files instead; see dlt's filesystem destination for all four.
How do I query Braze data in Amazon S3?
After a run, pipeline.dataset() holds the loaded tables, one per resource. A Relation is a query on that dataset, either a whole table or a SQL string, and reading it gives you the data as a Pandas DataFrame, a PyArrow table or Python tuples. Nothing is read until you ask for it. A filesystem destination holds files rather than tables, so dlt reads them through DuckDB views and the interface is the same as for a SQL destination; for frequent reads load Delta or Iceberg tables, which DuckDB reads only as far as the query needs (see reading data from filesystem).
import dlt pipeline = dlt.pipeline("braze_pipeline") # Step 1: Get the dataset from the pipeline dataset = pipeline.dataset() # Step 2: Get a Relation, either a whole table... campaigns = dataset.table("campaigns") # ...or any SQL query against Amazon S3 sample = dataset("SELECT * FROM campaigns LIMIT 100") # Step 3: Read the data df = campaigns.df() # or .df(chunk_size=50) for a large table arrow_table = sample.arrow() # a PyArrow Table rows = sample.fetchall() # a list of Python tuples # Which tables were loaded, and how big are they? print(dataset.row_counts().df()) """ table_name row_count 0 campaigns 13 1 segment_analytics 3 """
The columns are the fields the Braze API returns. Your agent can run the same queries through the MCP server's execute_sql_query tool, and uv run dlthub show opens the Pipeline Dashboard with the schema, load metrics and a query box. See access loaded data in Python and exploring it in marimo notebooks.
How do I deploy the Braze to Amazon S3 pipeline in production?
The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.
- Deploy & schedule — run the pipeline as a managed job with automatic retries.
- Monitor — observable job queues, alerting, and load metrics for every run.
- Transform — promote raw Braze loads into governed, documented models.
- Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.
What other destinations can I load Braze data to?
dlt loads into any of these — only the destination argument changes:
| Destination | Example value |
|---|---|
| PostgreSQL | "postgres" |
| BigQuery | "bigquery" |
| Snowflake | "snowflake" |
| Redshift | "redshift" |
| Databricks | "databricks" |
| Filesystem (S3, GCS, Azure) | "filesystem" |
Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.
Next steps
Was this page helpful?
Community Hub
Need more dlt context for Braze to Amazon S3?
Request dlt skills, commands, AGENT.md files, and AI-native context.