Skip to content

SDK API Reference / TDX

Class: TDX ​

TDX SDK - Main class

Provides programmatic access to Treasure AI operations

Properties ​

api ​

readonly api: RawAPI

Raw API access - Make direct HTTP requests to any TD API endpoint


cas ​

readonly cas: CASSDK

CAS (Composable Audience Studio) operations API


connection ​

readonly connection: ConnectionSDK

Connection operations API (data connections for activations/exports)


delivery ​

readonly delivery: DeliverySDK

Delivery API operations for email sender/domain lookup and workspace assignment. Email sending operations are not exposed.


engage ​

readonly engage: EngageSDK

Engage operations API (campaigns, templates, workspaces)


jobs ​

readonly jobs: JobSDK

Job operations API


journey ​

readonly journey: JourneySDK

Journey operations API (CDP Journey Orchestration)


llm ​

readonly llm: LLMSDK

LLM operations API (agents, chat)


personalization ​

readonly personalization: PersonalizationSDK

Personalization operations API (RT 2.0 personalization services)


policy ​

readonly policy: PolicySDK

Policy operations API (access control)


query ​

readonly query: 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 ​

readonly realtime: RealtimeSDK

RT 2.0 operations API (realtime configuration management)


schedules ​

readonly schedules: ScheduleSDK

Schedule operations API (scheduled queries)


segment ​

readonly segment: SegmentSDK

Segment operations API (CDP)


user ​

readonly user: UserSDK

User operations API


workflow ​

readonly workflow: WorkflowSDK

Workflow operations API

Accessors ​

p13nStudio ​

Get Signature ​

get p13nStudio(): P13nStudioSDK

Personalization Studio operations API (campaigns, content spots, creative assets)

Lazy: the client throws for a site with no Personalization Studio endpoint, so constructing it eagerly would fail every command in those regions.

Returns ​

P13nStudioSDK

Methods ​

create() ​

static create(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 ​

typescript
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();