Skip to content

SDK API Reference / getEndpoint

Function: getEndpoint()

getEndpoint(site, apiType): string

Get full endpoint URL for a given site and API type

Different API types use different hostnames:

  • TD API: api.treasuredata.com
  • CDP API: api-cdp.treasuredata.com
  • Workflow API: api-workflow.treasuredata.com
  • Trino: api-presto.treasuredata.com
  • LLM: llm-api.treasuredata.com

Parameters

site

TDSite

TD site (us01, jp01, eu01, ap02, ap03, dev-us01, dev-eu01, stg-us01, stg-jp01, stg-ap03)

apiType

APIType = 'td'

API type (td, cdp, workflow, trino, llm), defaults to 'td'

Returns

string

Full endpoint URL

Example

ts
// Production TD API endpoints
getEndpoint('us01', 'td')       // 'https://api.treasuredata.com'
getEndpoint('jp01', 'td')       // 'https://api.treasuredata.co.jp'

// Development endpoints
getEndpoint('dev-us01', 'td')   // 'https://api-development.us01.treasuredata.com'
getEndpoint('dev-eu01', 'llm')  // 'https://llm-api-development.eu01.treasuredata.com'

// Staging endpoints
getEndpoint('stg-us01', 'trino') // 'https://api-staging-presto.us01.treasuredata.com'
getEndpoint('stg-jp01', 'cdp')   // 'https://api-staging-cdp.treasuredata.co.jp'
getEndpoint('stg-ap03', 'workflow') // 'https://api-staging-workflow.ap03.treasuredata.com'