Overview
TheTinybirdClient class is the core low-level client for interacting with the Tinybird API. It provides methods for querying pipe endpoints, ingesting events to datasources, and performing datasource operations.
For a typed client experience with full TypeScript inference, use the Tinybird class instead.
Instantiation
Create a new client instance using theTinybirdClient constructor or the createClient helper function:
Configuration Options
Tinybird API base URL (e.g.,
'https://api.tinybird.co' or 'https://api.us-east.tinybird.co')API token for authentication
Custom fetch implementation (optional, defaults to global fetch)
Default timeout in milliseconds for all requests
Enable dev mode to automatically use branch tokens when on a feature branch. When enabled, the client detects the git branch and uses the corresponding Tinybird branch token instead of the workspace token.
Directory to use as the starting point when searching for
tinybird.json config. In monorepo setups, this should be set to the directory containing tinybird.json to ensure the config is found regardless of where the application runs from.Properties
datasources
Access datasource operations (ingest, append, replace, delete, truncate):tokens
Access token operations (JWT creation, etc.):Methods
query()
Query a pipe endpoint with parameters:ingest()
Ingest a single event to a datasource:ingestBatch()
Ingest multiple events in a single request:sql()
Execute a raw SQL query:getContext()
Get the current client context with resolved configuration:Promise<ClientContext>
Related
createClient()
Helper function to create a client instance
Query
Query pipe endpoints with parameters
Ingest
Ingest data into datasources
Datasource Operations
Append, replace, delete, and truncate operations