Overview
ThecreateClient() function creates a new instance of the low-level TinybirdClient for interacting with the Tinybird API.
For a typed client experience with full TypeScript inference based on your schema definitions, use the Tinybird class instead.
Usage
Parameters
Client configuration object
ClientConfig
Tinybird API base URLExamples:
'https://api.tinybird.co'(EU region)'https://api.us-east.tinybird.co'(US region)
API token for authentication. Typically loaded from environment variables.
Custom fetch implementation. Defaults to global
fetch if not provided.Useful for:- Custom retry logic
- Request interceptors
- Testing with mocked responses
Default timeout in milliseconds for all requests. Can be overridden per-request.
Enable development mode to automatically use branch tokens when on a feature branch.When enabled, the client will:
- Detect the current git branch
- Use the corresponding Tinybird branch token instead of the workspace token
- Automatically create branches if they don’t exist
falseDirectory to use as the starting point when searching for
tinybird.json config.In monorepo setups, set this to the directory containing tinybird.json to ensure the config is found regardless of where the application runs from.Return Value
Returns a configuredTinybirdClient instance with methods for:
- Querying pipe endpoints
- Ingesting events
- Datasource operations (append, replace, delete, truncate)
- Token operations (JWT creation)
- Raw SQL queries
Examples
Basic Usage
With Development Mode
Automatically use branch tokens during development:With Custom Timeout
With Custom Fetch (Node.js 16 or older)
Monorepo Setup
Related
TinybirdClient
Core client class documentation
Tinybird (Typed Client)
Type-safe client with schema inference
Query
Query pipe endpoints
Ingest
Ingest data into datasources