TerraBog
Docs
⌘K
ChangelogSign inDashboard
DocsGetting Started
Getting Started

Getting Started with TerraBog

Set up your workspace, connect your first data source, and run your first analytics query — in under 10 minutes.

Updated February 2026· ~8 min read

Looking for a faster path? Use the TerraBog UI to connect sources and run queries without writing any code. This guide covers the SDK approach for programmatic access.

Prerequisites

Before you begin, make sure you have the following:

  • A TerraBog accountFree trial or paid plan — sign up at terrabog.com
  • Node.js 18+ or Python 3.8+Required for the SDK. Check your version with node -v
  • An API keyFound in Settings → Developer → API Keys after signing in
  • A data sourceAny PostgreSQL, Snowflake, BigQuery, Salesforce, or CSV source

Step-by-step Setup

1

Install the SDK

Add the TerraBog SDK to your project using your preferred package manager:

terminal
# Install via npmnpm install @terrabog/sdk# Or with yarnyarn add @terrabog/sdk# Python SDK also availablepip install terrabog-sdk
2

Initialize Your Client

Import and configure the client with your API key. We recommend storing credentials in environment variables — never commit API keys to version control.

TypeScript
import { TerraBog } from '@terrabog/sdk';const client = new TerraBog({  apiKey: process.env.TERRABOG_API_KEY,  workspace: 'acme-corp',  region: 'us-east-1',        // optional});// Verify connectionconst status = await client.ping();console.log(status.connected);  // true

Your TERRABOG_API_KEY is a secret credential. Store it in a .env file and add that file to .gitignore. Never expose it in client-side code.

3

Connect a Data Source

Use the sources.connect() method to link your first database or service. TerraBog supports 200+ data sources — see the full list in .

TypeScript
// Connect a PostgreSQL data sourceconst source = await client.sources.connect({  type: 'postgresql',  name: 'Production Database',  credentials: {    host: process.env.DB_HOST,    port: 5432,    database: 'analytics_db',    username: process.env.DB_USER,    password: process.env.DB_PASS,    ssl: true,  },});console.log(`Source connected: ${source.id}`);
4

Run Your First Query

Once your data source is connected, run a SQL query to pull data into TerraBog. Results are returned as typed rows and automatically cached for subsequent requests.

TypeScript
// Run your first analytics queryconst result = await client.query({  sourceId: source.id,  sql: `    SELECT      DATE_TRUNC('day', created_at) AS date,      COUNT(*)                       AS total_events,      COUNT(DISTINCT user_id)        AS unique_users    FROM events    WHERE created_at > NOW() - INTERVAL '30 days'    GROUP BY 1    ORDER BY 1  `,});// Access your resultsresult.rows.forEach(row => {  console.log(row.date, row.total_events, row.unique_users);});
5

Explore the Dashboard

Your query results are now available in the TerraBog Dashboard. Navigate to Analytics → Query Results to see your data visualized, or connect additional sources to enrich your analysis.

Results from SDK queries automatically sync to your dashboard within 30 seconds. Use the refresh: true option to force an immediate sync.

What's Next