Skip to content
Last updated

Insights Model Endpoints Reference

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.

Create/Read/Delete Insights Models

Get a List of the Account's Insights Models

curl -X GET \
  "https://api.treasuredata.com/reporting/datamodels" \
  -H "Authorization: TD1 <your_api_key>"

Get the Build and Query Resource Limit Sizes

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>"

Sample Response

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
}

Retrieve a Specific Insights Model Configuration

curl -X GET \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>" \
  -H "Authorization: TD1 <your_api_key>"

Create a New Insights Model

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>"
  }'
ParameterRequiredDescription
nameYesModel name
apikeyYesAPI key for the account
typeYesModel type. Use elasticube.
descriptionNoDescription of the model

Delete an Existing Insights Model

curl -X DELETE \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>" \
  -H "Authorization: TD1 <your_api_key>"

Update Insights Model Share

Share the Insights Model with Users

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>"]
  }'
ParameterRequiredDescription
emailsNoList 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.

Create/Read/Delete Datasets

Get a List of the Datasets in the Insights Model

curl -X GET \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets" \
  -H "Authorization: TD1 <your_api_key>"

Create a New Insights Model Dataset

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>" }
          }
        }
      }
    }
  }'
ParameterRequiredDescription
nameYesDataset name
definition.typeYesData source type. Use presto.
definition.databaseYesDatabase name in Treasure Data
definition.tablesYesTable definitions. Key is the table name.

Delete an Insights Model Dataset

curl -X DELETE \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets/<dataset_id>" \
  -H "Authorization: TD1 <your_api_key>"

Create/Read/Update/Delete Tables

Get a List of Tables in a Dataset

curl -X GET \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets/<dataset_id>/tables" \
  -H "Authorization: TD1 <your_api_key>"

Create a New Table in a Dataset

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 }
      }
    }
  }'

Request Parameters

ParameterRequiredDescription
nameYesTable name
definition.columnsYesColumn definitions. Key is the column name.

Column Types

TypeDescription
intInteger
floatFloating point number
stringShort text
textLong text
datetimeDate and time
timestampUnix timestamp or ISO 8601 string

Column Options

OptionTypeDescription
typestringColumn type (required)
hiddenbooleanHide the column in dashboards. Default: false
indexedbooleanIndex the column for faster filtering. Default: false

Update an Existing Table in a Dataset

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.

Delete an Existing Table in a Dataset

curl -X DELETE \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/datasets/<dataset_id>/tables/<table_id>" \
  -H "Authorization: TD1 <your_api_key>"

Create/Read/Delete Relations

Get a List of Insights Model Relations

curl -X GET \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/relations" \
  -H "Authorization: TD1 <your_api_key>"

Create a New Relation for an Insights Model

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>" }
    ]
  }'

Delete an Existing Relation

curl -X DELETE \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/relations/<relation_id>" \
  -H "Authorization: TD1 <your_api_key>"

Create/Read/Delete Insights Model Builds

Get a List of Insights Model Builds

curl -X GET \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/builds" \
  -H "Authorization: TD1 <your_api_key>"

Get the Insights Model's Build Status

curl -X GET \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/builds/<build_id>" \
  -H "Authorization: TD1 <your_api_key>"

Trigger the Build of an Insights Model

curl -X POST \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/builds" \
  -H "Authorization: TD1 <your_api_key>"

Stop the Build of an Insights Model

curl -X DELETE \
  "https://api.treasuredata.com/reporting/datamodels/<datamodel_id>/builds/<build_id>" \
  -H "Authorization: TD1 <your_api_key>"