.png)
Treasure Data Integration Guide
Connect Treasure Data CDP with enterprise applications through REST and query APIs, asynchronous jobs, bulk data exchange, SDK-based collection, and governed Martini workflows.
Treasure Data integration options at a glance
Treasure Data supports REST APIs for databases, tables, queries, jobs, and data operations, alongside asynchronous query execution, bulk ingestion, file-based import and export, and product-specific event collection through SDKs. API-key authentication, regional endpoints, and permission-controlled access are central to the integration model. Webhook-style notifications may be available for selected features but are not universal across Treasure Data objects. Martini can consume these APIs, schedule incremental workflows, poll query jobs, process large files, transform profiles and events, expose governed APIs, and route results to enterprise applications or analytical platforms.
Common Treasure Data integration patterns
Common Treasure Data data objects used in integrations
Authentication and security considerations
API keys and permissions
Treasure Data core APIs primarily use API keys supplied through the TD-API-KEY request header. Use a dedicated least-privileged key appropriate to the workflow rather than a master key whenever possible.
Regional endpoints
Store the Treasure Data regional API base URL in environment configuration. API calls, query operations, and ingestion requests should target the correct account region.
Secrets and privacy
- Store API keys and regional URLs in Martini secrets or secure environment configuration.
- Restrict access according to key owner, account, database, and operation permissions.
- Define consent, retention, deletion, suppression, and access-control requirements before moving customer or behavioral data.
- Use API exposure controls when Martini acts as an event gateway or API façade.
Operational considerations for Treasure Data integrations
Asynchronous jobs
Queries and exports may complete asynchronously. Persist job identifiers, poll with bounded intervals, apply timeouts, and distinguish queued, running, successful, and failed states.
Scale and pagination
Do not assume that one API response contains all data. Use pagination, incremental watermarks, bulk ingestion, or file exchange for large results and avoid loading complete datasets into memory.
Retries and idempotency
Use exponential backoff and a maximum retry count for transient failures and throttling. Do not retry authorization or validation errors as transient failures. Use deterministic event or record keys and reconciliation controls to limit duplicates.
Schema and query management
Validate new nullable fields, type changes, renamed attributes, nested JSON, partition requirements, and destination restrictions. Restrict query date ranges and selected columns to reduce cost and operational load.
Monitoring and testing
Track source counts, accepted and rejected records, job identifiers, query status, watermarks, throttling, schema failures, and downstream delivery totals. Test representative payloads, failed jobs, duplicate events, expired keys, and regional configuration before production rollout.
Why use Martini instead of scripts or point-to-point integrations?
Orchestration beyond scripts
Scripts can call Treasure Data APIs, but enterprise integrations also require asynchronous job coordination, incremental extraction, mapping, consent rules, retries, reconciliation, monitoring, and controlled deployment. Martini provides a workflow model for these concerns.
Reusable integration assets
Martini can centralize Treasure Data authentication, regional configuration, query submission, job polling, file processing, and error handling in reusable workflows and APIs rather than duplicating logic across point-to-point scripts.
Controlled change and operations
Schema validation, business rules, environment-specific secrets, bounded retries, and operational status make integrations easier to test, troubleshoot, and maintain as Treasure Data tables, profiles, audiences, and destinations evolve.
- Consume REST and query APIs through governed workflows.
- Expose APIs for upstream applications that need a controlled Treasure Data interface.
- Transform JSON, query results, and files between Treasure Data and enterprise systems.
- Monitor asynchronous jobs, watermarks, delivery counts, and failures.