SDK API Reference / TDX
Class: TDX
TDX SDK - Main class
Provides programmatic access to Treasure Data operations
Properties
api
readonlyapi:RawAPI
Raw API access - Make direct HTTP requests to any TD API endpoint
connection
readonlyconnection:ConnectionSDK
Connection operations API (data connections for activations/exports)
delivery
readonlydelivery:DeliverySDK
Delivery operations API (email senders, read-only)
engage
readonlyengage:EngageSDK
Engage operations API (campaigns, templates, workspaces)
jobs
readonlyjobs:JobSDK
Job operations API
journey
readonlyjourney:JourneySDK
Journey operations API (CDP Journey Orchestration)
llm
readonlyllm:LLMSDK
LLM operations API (agents, chat)
personalization
readonlypersonalization:PersonalizationSDK
Personalization operations API (RT 2.0 personalization services)
query
readonlyquery:QuerySDK
Query operations SDK
Provides Trino query execution and schema introspection:
- execute() - Execute arbitrary SQL queries
- listDatabases() - List databases
- listTables() - List tables
- describeTable() - Describe table schema
- showTable() - Show table contents
realtime
readonlyrealtime:RealtimeSDK
RT 2.0 operations API (realtime configuration management)
schedules
readonlyschedules:ScheduleSDK
Schedule operations API (scheduled queries)
segment
readonlysegment:SegmentSDK
Segment operations API (CDP)
user
readonlyuser:UserSDK
User operations API
workflow
readonlyworkflow:WorkflowSDK
Workflow operations API
Methods
create()
staticcreate(config?):TDX
Create TDX SDK instance from configuration
This is the recommended way to create a TDX instance.
Parameters
config?
SDKConfig = {}
SDK configuration options
Returns
TDX
TDX instance
Example
import { TDX } from '@treasuredata/tdx/sdk';
// Method 1: Pass API key directly (works everywhere)
const tdx = TDX.create({
site: 'us01',
apiKey: 'your_key_id/your_key_secret'
});
// Method 2: Load from environment variable (Node.js only)
// export TD_API_KEY_US01=your_api_key
const tdx = TDX.create({ site: 'us01' });
// Method 3: Use defaults (us01, API key from env)
const tdx = TDX.create();
// Use the SDK
const databases = await tdx.query.listDatabases();