Skip to content

Treasure Data API (3)

Download OpenAPI description
Languages
Servers

https://api.treasuredata.com/v3/

https://api.treasuredata.co.jp/v3/

https://api.ap02.treasuredata.com/v3/

https://api.eu01.treasuredata.com/v3/

Access Control - Policies

Operations

Access Control - Permissions

Operations

Access Control - Users

Operations

Access Control - Policy Groups

Operations

Connections

Operations

Databases

Operations

Jobs

Operations

Tables

Operations

Policy Group Tags

Operations

Schedules

Operations

Get schedules

Request

Gets a list of schedules.

Security
ApiKeyAuth
curl -i -X GET \
  https://api.treasuredata.com/v3/schedule/list \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'

Responses

OK

Bodyapplication/json
schedulesArray of objects(Schedule)required
schedules[].​created_atstring(DateTimeISO8601)\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(([+-]\d{2...required

Datetime in ISO 8601 format (2020-12-31T11:22:33-05:00 or 2020-12-31T11:22:33Z for UTC)

Example: "2020-12-31T11:22:33Z"
schedules[].​cronstring or nullrequired
schedules[].​databasestring or (string or null)required
Any of:

database name

string

database name

schedules[].​delayinteger or null>= 0required
Example: 5
schedules[].​engine_versionstring

the version of the query engine for the query, can be a version release name (e.g 'stable') or version number (e.g '0.205')

Example: "stable"
schedules[].​executing_user_idinteger
schedules[].​namestringrequired
schedules[].​priorityinteger[ -2 .. 2 ]
Example: 1
schedules[].​querystringrequired
schedules[].​retry_limitinteger[ 0 .. 32 ]
Example: 3
schedules[].​timezonestring(Timezone)required
Example: "UTC"
schedules[].​typestringrequired
schedules[].​user_namestringrequired

user's full name or email

Example: "Treasure Data"
Response
application/json
{ "schedules": [ {} ] }

Create schedule

Request

Creates a schedule.

Security
ApiKeyAuth
Path
schedule_namestringrequired
Bodyapplication/x-www-form-urlencoded
namestring
cronstring or null
databasestringrequired

database name

Example: "Alpha"
delayinteger or null>= 0
Example: 5
executing_user_idinteger
engine_versionstring

the version of the query engine for the query, can be a version release name (e.g 'stable') or version number (e.g '0.205')

Example: "stable"
pool_namestring

resource pool name

Example: "pool_1"
priorityinteger[ -2 .. 2 ]
Example: 1
retry_limitinteger[ 0 .. 32 ]
Example: 3
querystringrequired
resultstring

url of the result

timezonestring
Example: "UTC"
typestringrequired
curl -i -X POST \
  'https://api.treasuredata.com/v3/schedule/create/{schedule_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d name=string \
  -d cron=string \
  -d database=Alpha \
  -d delay=5 \
  -d executing_user_id=0 \
  -d engine_version=stable \
  -d pool_name=pool_1 \
  -d priority=1 \
  -d retry_limit=3 \
  -d query=string \
  -d result=string \
  -d timezone=UTC \
  -d type=string

Responses

OK

Bodyapplication/json
created_atstring\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(([+-]\d{2...required

Datetime in ISO 8601 format (2020-12-31T11:22:33-05:00 or 2020-12-31T11:22:33Z for UTC)

Example: "2020-12-31T11:22:33Z"
cronstring or nullrequired
databasestring or (string or null)required
Any of:

database name

string

database name

delayinteger or null>= 0required
Example: 5
namestringrequired
querystringrequired
timezonestringrequired
Example: "UTC"
typestringrequired
user_namestringrequired

user's full name or email

Example: "Treasure Data"
Response
application/json
{ "created_at": "2020-12-31T11:22:33Z", "cron": "string", "database": "Alpha", "delay": 5, "name": "string", "query": "string", "timezone": "UTC", "type": "string", "user_name": "Treasure Data" }

Delete schedule

Request

Deletes a specified schedule.

Security
ApiKeyAuth
Path
schedule_namestringrequired
curl -i -X POST \
  'https://api.treasuredata.com/v3/schedule/delete/{schedule_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'

Responses

OK

Bodyapplication/json
created_atstring\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(([+-]\d{2...required

Datetime in ISO 8601 format (2020-12-31T11:22:33-05:00 or 2020-12-31T11:22:33Z for UTC)

Example: "2020-12-31T11:22:33Z"
cronstring or nullrequired
databasestring or (string or null)required
Any of:

database name

string

database name

delayinteger or null>= 0required
Example: 5
namestringrequired
querystringrequired
timezonestringrequired
Example: "UTC"
typestringrequired
user_namestringrequired

user's full name or email

Example: "Treasure Data"
Response
application/json
{ "created_at": "2020-12-31T11:22:33Z", "cron": "string", "database": "Alpha", "delay": 5, "name": "string", "query": "string", "timezone": "UTC", "type": "string", "user_name": "Treasure Data" }

Update schedule

Request

Updates a schedule.

Security
ApiKeyAuth
Path
schedule_namestringrequired
Bodyapplication/x-www-form-urlencoded
namestring
cronstring or null
databasestring

database name

Example: "Alpha"
delayinteger or null>= 0
Example: 5
executing_user_idinteger
engine_versionstring

the version of the query engine for the query, can be a version release name (e.g 'stable') or version number (e.g '0.205')

Example: "stable"
pool_namestring

resource pool name

Example: "pool_1"
priorityinteger[ -2 .. 2 ]
Example: 1
retry_limitinteger[ 0 .. 32 ]
Example: 3
querystring
resultstring

url of the result

timezonestring
Example: "UTC"
typestring
curl -i -X POST \
  'https://api.treasuredata.com/v3/schedule/update/{schedule_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d name=string \
  -d cron=string \
  -d database=Alpha \
  -d delay=5 \
  -d executing_user_id=0 \
  -d engine_version=stable \
  -d pool_name=pool_1 \
  -d priority=1 \
  -d retry_limit=3 \
  -d query=string \
  -d result=string \
  -d timezone=UTC \
  -d type=string

Responses

OK

Bodyapplication/json
created_atstring\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(([+-]\d{2...required

Datetime in ISO 8601 format (2020-12-31T11:22:33-05:00 or 2020-12-31T11:22:33Z for UTC)

Example: "2020-12-31T11:22:33Z"
cronstring or nullrequired
databasestring or (string or null)required
Any of:

database name

string

database name

delayinteger or null>= 0required
Example: 5
namestringrequired
querystringrequired
timezonestringrequired
Example: "UTC"
typestringrequired
user_namestringrequired

user's full name or email

Example: "Treasure Data"
Response
application/json
{ "created_at": "2020-12-31T11:22:33Z", "cron": "string", "database": "Alpha", "delay": 5, "name": "string", "query": "string", "timezone": "UTC", "type": "string", "user_name": "Treasure Data" }

Run schedule

Request

Schedules a run.

Security
ApiKeyAuth
Path
schedule_namestringrequired
schedule_timeinteger(Timestamp)required
Example: 1356998400
Bodyapplication/x-www-form-urlencoded
numinteger<= 10
Default 1
domain_keystring(DomainKey)
Example: "domain_key_123"
curl -i -X POST \
  'https://api.treasuredata.com/v3/schedule/run/{schedule_name}/1356998400' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d num=1 \
  -d domain_key=domain_key_123

Responses

OK

Bodyapplication/json
jobsArray of objects(ScheduledJob)required
jobs[].​job_idinteger(JobId)required

unique identifier of job

Example: 19
jobs[].​typestringrequired
Example: "presto"
jobs[].​scheduled_atDateTimeAsString (string) or EmptyString (string)required
One of:

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

string(DateTimeAsString)\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s(([+-]\...

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

Response
application/json
{ "jobs": [ {} ] }

Get execution history

Request

Gets a history of scheduled executions by name.

Security
ApiKeyAuth
Path
schedule_namestringrequired
Query
frominteger
Default 0
tointeger
Default 20
curl -i -X GET \
  'https://api.treasuredata.com/v3/schedule/history/{schedule_name}?from=0&to=20' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'

Responses

OK

Bodyapplication/json
countintegerrequired
Example: 20
fromintegerrequired
Example: 5
tointegerrequired
Example: 15
historyArray of objects(Job)required
history[].​cpu_timeinteger or nullrequired
history[].​created_atstring(DateTimeAsString)\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s(([+-]\...required

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

Example: "2020-12-31 11:22:33 UTC"
history[].​databasestring or nullrequired

database name

history[].​durationinteger or nullrequired

Duration

Example: 10
history[].​end_atDateTimeAsString (string) or EmptyString (string)required
One of:

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

string(DateTimeAsString)\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s(([+-]\...

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

history[].​hive_result_schemastring or nullrequired

the schema for the job's result table

history[].​job_idstring(JobIdAsString)required

unique identifier of job

Example: "19"
history[].​linked_result_export_job_idJobId (integer) or (integer or null)required
Any of:

unique identifier of job

integer(JobId)

unique identifier of job

history[].​num_recordsinteger or nullrequired

the number of records in the result. Will be null until job has finished, and may not be set for all query types

Example: 100
history[].​priorityinteger[ -2 .. 2 ]required

job execution priority

Example: 0
history[].​query(string or null) or QueryAsString (string) or BulkLoadConfig (object)required
Any of:
string or null
history[].​resultstring

...?

history[].​result_export_target_job_idJobId (integer) or (integer or null)required
Any of:

unique identifier of job

integer(JobId)

unique identifier of job

history[].​result_sizeinteger or nullrequired

size in bytes of the job's result, in msgpack.gz format

Example: 1048576
history[].​retry_limitinteger[ 0 .. 32 ]required

automatically retry this many times on failure

Default 0
Example: 3
history[].​start_atDateTimeAsString (string) or EmptyString (string)required
One of:

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

string(DateTimeAsString)\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s(([+-]\...

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

history[].​statusstringrequired

current status of the job

Enum"queued""running""killed""success""error"
Example: "success"
history[].​typestringrequired
Example: "presto"
history[].​updated_atstring(DateTimeAsString)\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s(([+-]\...required

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

Example: "2020-12-31 11:22:33 UTC"
history[].​urlstringrequired
history[].​user_namestringrequired

user's full name or email

Example: "Treasure Data"
history[].​scheduled_atDateTimeAsString (string) or EmptyString (string)required
One of:

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

string(DateTimeAsString)\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s(([+-]\...

Datetime in custom format (2020-12-31 11:22:33 -0500 or 2020-12-31 11:22:33 UTC for UTC)

history[].​organizationstring or nullDeprecatedrequired

always "null"

Response
application/json
{ "count": 20, "from": 5, "to": 15, "history": [ {} ] }

Users

Operations