Getting started (4)

Last updated Oct 1, 2026 This guide will instruct you through:

  • Creating an API token needed for pipelines to authenticate with your data catalog.
  • Creating your first pipeline with a simple ecommerce schema that writes to an Apache Iceberg ↗︎ table managed by Basin Catalog.
  • Sending sample ecommerce data via HTTP endpoint.
  • Validating data in your bucket and querying it with Basin SQL.

Prerequisites

  1. Sign up for a Cloudflare account ↗︎.
  2. Install Node.js ↗︎.

<details>

<summary>

Node.js version manager

</summary>

Use <a href="https://viteplus.dev/guide/env">Vite+ (<code>vp env</code>) ↗︎</a> to install and manage Node.js versions.

For supported Node.js versions, refer to the <a href="https://developers.cloudflare.com/workers/wrangler/install-and-update/#install-wrangler">Wrangler system requirements</a>.

</details>

1. Create an API token

Basin Pipelines must authenticate to Basin Catalog with an R2 API token that has catalog and R2 permissions.

  1. In the Cloudflare dashboard, go to the R2 object storage page. Go to Overview ↗
  2. Select Manage API tokens.
  3. Select Create Account API token.
  4. Give your API token a name.
  5. Under Permissions, select the Admin Read & Write permission.
  6. Select Create Account API Token.
  7. Note the Token value.

Note

This token also includes the Basin SQL Read permission, which allows you to query your data with Basin SQL.

2. Create your first pipeline

First, create a schema file that defines your ecommerce data structure:

Create schema.json:

{
    "fields": [
        {
            "name": "user_id",
            "type": "string",
            "required": true
        },
        {
            "name": "event_type",
            "type": "string",
            "required": true
        },
        {
            "name": "product_id",
            "type": "string",
            "required": false
        },
        {
            "name": "amount",
            "type": "float64",
            "required": false
        }
    ]
}

Use the interactive setup to create a pipeline that writes to Basin Catalog:

npmyarnpnpm

npx wrangler basin pipelines setup
yarn wrangler basin pipelines setup
pnpm wrangler basin pipelines setup

Note

The setup command automatically creates the R2 bucket and enables Basin Catalog if they do not already exist, so you do not need to create them beforehand.

Follow the prompts:

  1. Pipeline name: Enter ecommerce
  2. Stream configuration:
  3. Enable HTTP endpoint: yes
  4. Require authentication: no (for simplicity)
  5. Configure custom CORS origins: no
  6. Schema definition: Load from file
  7. Schema file path: schema.json (or your file path)
  8. Sink configuration:
  9. Destination type: Data Catalog (Iceberg)
  10. Setup mode: Simple (recommended defaults)
  11. R2 bucket name: pipelines-tutorial (created automatically if it does not exist)
  12. Table name: ecommerce
  13. Catalog API token: Enter your token from step 1
  14. Review: Confirm the summary and select Create resources
  15. SQL transformation: Choose Simple ingestion (SELECT * FROM stream)

Note

If you make a mistake during setup (such as an invalid name or incorrect credentials), you will be prompted to retry rather than needing to restart the entire setup process.

<details>

<summary>

Advanced mode options

</summary>

If you select Advanced instead of Simple during sink configuration, you can customize the following additional options:

  • Format: Output file format (for example, Parquet)
  • Compression: Compression algorithm (for example, zstd)
  • Rolling policy: File size threshold (minimum 5 MB) and time interval (minimum 10 seconds) for creating new files
  • Credentials: Choose between automatic credential generation or manually entering R2 credentials
  • Namespace: Data Catalog namespace (defaults to <code>default</code>)

</details>

After setup completes, the command outputs a configuration snippet for your Wrangler file, a Worker binding example with sample data, and a curl command for the HTTP endpoint. Note the HTTP endpoint URL and the pipelines configuration for use in the following steps.

You can also pre-set the pipeline name using the --name flag:

npmyarnpnpm

npx wrangler basin pipelines setup --name ecommerce
yarn wrangler basin pipelines setup --name ecommerce
pnpm wrangler basin pipelines setup --name ecommerce
  1. In the Cloudflare dashboard, go to R2 object storage. Go to Overview ↗
  2. Select Create bucket and enter the bucket name: pipelines-tutorial.
  3. Select Create bucket.
  4. Select the bucket, switch to the Settings tab, scroll down to Basin Catalog, and select Enable.
  5. Once enabled, note the Catalog URI and Warehouse name.
  6. Go to Basin Pipelines > Pipelines. Go to Pipelines ↗
  7. Select Create Pipeline.
  8. Connect to a Stream:
  9. Pipeline name: ecommerce
  10. Enable HTTP endpoint for sending data: Enabled
  11. HTTP authentication: Disabled (default)
  12. Select Next
  13. Define Input Schema:
  14. Select JSON editor
  15. Copy in the schema:

    json { "fields": [ { "name": "user_id", "type": "string", "required": true }, { "name": "event_type", "type": "string", "required": true }, { "name": "product_id", "type": "string", "required": false }, { "name": "amount", "type": "float64", "required": false } ] }

  16. Select Next

  17. Define Sink:
    • Select your R2 bucket: pipelines-tutorial
    • Storage type: Basin Catalog
    • Namespace: default
    • Table name: ecommerce
    • Advanced Settings: Change Maximum Time Interval to 10 seconds
    • Select Next
  18. Credentials:
    • Disable Automatically create an Account API token for your sink
    • Enter Catalog Token from step 1
    • Select Next
  19. Pipeline Definition:

    • Leave the default SQL query:

    sql INSERT INTO ecommerce_sink SELECT * FROM ecommerce_stream;

    • Select Create Pipeline
    • After pipeline creation, note the Stream ID for the next step.

3. Send sample data

Send ecommerce events to your pipeline's HTTP endpoint:

curl -X POST https://{stream-id}.ingest.cloudflare.com \
  -H "Content-Type: application/json" \
  -d '[
    {
      "user_id": "user_12345",
      "event_type": "purchase",
      "product_id": "widget-001",
      "amount": 29.99
    },
    {
      "user_id": "user_67890",
      "event_type": "view_product",
      "product_id": "widget-002"
    },
    {
      "user_id": "user_12345",
      "event_type": "add_to_cart",
      "product_id": "widget-003",
      "amount": 15.50
    }
  ]'

Replace {stream-id} with your actual stream endpoint from the pipeline setup.

4. Validate data in your bucket

  1. In the Cloudflare dashboard, go to the R2 object storage page.
  2. Select your bucket: pipelines-tutorial.
  3. You should see Iceberg metadata files and data files created by your pipeline. If you are not seeing any files in your bucket, wait a couple of minutes and try again.
  4. The data is organized in the Apache Iceberg format with metadata tracking table versions.

5. Query your data using Basin SQL

Set up your environment to use Basin SQL:

export WRANGLER_BASIN_SQL_AUTH_TOKEN=YOUR_API_TOKEN

Or create a .env file with:

WRANGLER_BASIN_SQL_AUTH_TOKEN=YOUR_API_TOKEN

Where YOUR_API_TOKEN is the token you created in step 1. For more information on setting environment variables, refer to Wrangler system environment variables.

Query your data:

npmyarnpnpm

npx wrangler basin sql query "YOUR_WAREHOUSE_NAME" "SELECT user_id, event_type, product_id, amount FROM default.ecommerce WHERE event_type = 'purchase' LIMIT 10"
yarn wrangler basin sql query "YOUR_WAREHOUSE_NAME" "SELECT user_id, event_type, product_id, amount FROM default.ecommerce WHERE event_type = 'purchase' LIMIT 10"
pnpm wrangler basin sql query "YOUR_WAREHOUSE_NAME" "SELECT user_id, event_type, product_id, amount FROM default.ecommerce WHERE event_type = 'purchase' LIMIT 10"

Replace YOUR_WAREHOUSE_NAME with the warehouse name noted during pipeline setup. You can find it in the Cloudflare dashboard under R2 object storage > your bucket > Settings > Basin Catalog.

You can also query this table with any engine that supports Apache Iceberg. To learn more about connecting other engines to Basin Catalog, refer to Connect to Iceberg engines.

Learn more

Streams

Learn about configuring streams for data ingestion.

Pipelines

Understand SQL transformations and pipeline configuration.

Sinks

Configure data destinations and output formats.

Examples

Browse end-to-end examples that show how to build with Basin Pipelines.

Was this helpful?

YesNo

On this page

Getting started (4) - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/basin-pipelines/getting-started/#page","headline":"Getting started","description":"Create your first pipeline to ingest streaming data and write to Basin Catalog as an Apache Iceberg table.","url":"https://developers.cloudflare.com/basin-pipelines/getting-started/","inLanguage":"en","image":"https://developers.cloudflare.com/basin-pipelines/getting-started/og.png?v=55021221f23d0ffc","dateModified":"2026-10-01","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Durable, buffered queues that receive and store events for processing in Basin Pipelines. title: Streams image: https://developers.cloudflare.com/basin-pipelines/streams/og.png?v=7bd7ec4f3c7fcbfd


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/basin-pipelines/llms.txt
Use this file to discover all available pages before exploring further.