Use these REST endpoints to build and maintain Treasure Insights data models.
Select your region tab in each example to use the correct base URL for your site.
curl -X GET \
"https://api.treasuredata.com/reporting/datamodels" \
-H "Authorization: TD1 <your_api_key>"ElastiCube data model, build, and dashboard/queries are associated with a certain upper limit of RAM and CPU, an upper limit of 23 GB, so if the data model build exceeds that limit, users will see an error.
curl -X GET \
"https://api.treasuredata.com/reporting/account" \
-H "Authorization: TD1 <your_api_key>"View the query and dashboard limits in GB paying specific attention to the build_size and query_size parameters.
{
"id": "<id>",
"sisense_group_id": "<sisense_group_id>",
"td_account_id": "<td_account_id>",
"max_data_modelers": 5,
"max_designers": 10,
"max_viewers": 20,
"storage_size": 20,
"storage_threshold": 500,
"build_threshold": 100,
"query_threshold": 100,
"sisense_datagroup_oid": "<sisense_datagroup_oid>",
"sisense_hostname": "<sisense_hostname>",
"build_size": 23.0,
"query_size": 23.0,
"calculated_build_size": 23.0,
"calculated_query_size": 23.0,
"current_data_modelers": 4,
"current_designers": 2,
"current_viewers": 4
}curl -X GET \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>" \
-H "Authorization: TD1 <your_api_key>"curl -X POST \
"https://api.treasuredata.com/reporting/datamodels" \
-H "Authorization: TD1 <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "<model_name>",
"apikey": "<your_api_key>",
"type": "elasticube",
"description": "<description>"
}'| Parameter | Required | Description |
|---|---|---|
name | Yes | Model name |
apikey | Yes | API key for the account |
type | Yes | Model type. Use elasticube. |
description | No | Description of the model |
curl -X DELETE \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>" \
-H "Authorization: TD1 <your_api_key>"curl -X PUT \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/shares" \
-H "Authorization: TD1 <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"emails": ["<user1@example.com>", "<user2@example.com>"]
}'| Parameter | Required | Description |
|---|---|---|
emails | No | List of user email addresses to share the model with. If omitted, shares with all members of the account. Must include the model owner's email address. |
This operation is idempotent — the specified list replaces the current share settings entirely.
curl -X GET \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets" \
-H "Authorization: TD1 <your_api_key>"curl -X POST \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets" \
-H "Authorization: TD1 <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "<dataset_name>",
"definition": {
"type": "presto",
"database": "<database_name>",
"tables": {
"<table_name>": {
"columns": {
"<column_name>": { "type": "<column_type>" }
}
}
}
}
}'| Parameter | Required | Description |
|---|---|---|
name | Yes | Dataset name |
definition.type | Yes | Data source type. Use presto. |
definition.database | Yes | Database name in Treasure Data |
definition.tables | Yes | Table definitions. Key is the table name. |
curl -X DELETE \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets/<dataset_id>" \
-H "Authorization: TD1 <your_api_key>"curl -X GET \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets/<dataset_id>/tables" \
-H "Authorization: TD1 <your_api_key>"curl -X POST \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets/<dataset_id>/tables" \
-H "Authorization: TD1 <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "<table_name>",
"definition": {
"columns": {
"<column_name>": { "type": "<column_type>" },
"<another_column>": { "type": "<column_type>", "hidden": true },
"<indexed_column>": { "type": "<column_type>", "indexed": true }
}
}
}'| Parameter | Required | Description |
|---|---|---|
name | Yes | Table name |
definition.columns | Yes | Column definitions. Key is the column name. |
| Type | Description |
|---|---|
int | Integer |
float | Floating point number |
string | Short text |
text | Long text |
datetime | Date and time |
timestamp | Unix timestamp or ISO 8601 string |
| Option | Type | Description |
|---|---|---|
type | string | Column type (required) |
hidden | boolean | Hide the column in dashboards. Default: false |
indexed | boolean | Index the column for faster filtering. Default: false |
curl -X PUT \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets/<dataset_id>/tables/<table_id>" \
-H "Authorization: TD1 <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"name": "<table_name>",
"definition": {
"columns": {
"<column_name>": { "type": "<column_type>" }
}
}
}'The columns field is merged with the existing definition — only the columns you send are updated or added. See Column Types and Column Options above.
curl -X DELETE \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets/<dataset_id>/tables/<table_id>" \
-H "Authorization: TD1 <your_api_key>"curl -X GET \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/relations" \
-H "Authorization: TD1 <your_api_key>"curl -X POST \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/relations" \
-H "Authorization: TD1 <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"definition": [
{ "dataset": "<dataset_name>", "table": "<table_name>", "column": "<column_name>" },
{ "dataset": "<dataset_name>", "table": "<table_name>", "column": "<column_name>" }
]
}'curl -X DELETE \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/relations/<relation_id>" \
-H "Authorization: TD1 <your_api_key>"curl -X GET \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/builds" \
-H "Authorization: TD1 <your_api_key>"curl -X GET \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/builds/<build_id>" \
-H "Authorization: TD1 <your_api_key>"curl -X POST \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/builds" \
-H "Authorization: TD1 <your_api_key>"curl -X DELETE \
"https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/builds/<build_id>" \
-H "Authorization: TD1 <your_api_key>"