# Reference Insights Model Endpoints

Use these REST endpoints to build and maintain Treasure Insights data models.

- [Create/Read/Delete Insights Models](#createreaddelete-insights-models)
  - [Get a list of the account’s insights models](#get-a-list-of-the-accounts-insights-models)
  - [Get the build and query resource limit sizes](#get-the-build-and-query-resource-limit-sizes)
  - [Retrieve a specific insights model configuration](#retrieve-a-specific-insights-model-configuration)
  - [Create a new insights model](#create-a-new-insights-model)
  - [Delete an existing insights model](#delete-an-existing-insights-model)
- [Update Insights Model Share](#update-insights-model-share)
  - [Share the insights model with users](#share-the-insights-model-with-users)
- [Create/Read/Delete Datasets](#createreaddelete-datasets)
  - [Get a list of the datasets in the insights model](#get-a-list-of-the-datasets-in-the-insights-model)
  - [Create a new insights model dataset](#create-a-new-insights-model-dataset)
  - [Delete an insights model dataset](#delete-an-insights-model-dataset)
- [Create/Read/Update/Delete Tables](#createreadupdatedelete-tables)
  - [Get a list of tables in a dataset](#get-a-list-of-tables-in-a-dataset)
  - [Create a new table in a dataset](#create-a-new-table-in-a-dataset)
  - [Update an existing table in a dataset](#update-an-existing-table-in-a-dataset)
  - [Delete an existing table in a dataset](#delete-an-existing-table-in-a-dataset)
- [Create/Read/Delete Relations](#createreaddelete-relations)
  - [Get a list of insights model relations](#get-a-list-of-insights-model-relations)
  - [Create a new relation for an insights model](#create-a-new-relation-for-an-insights-model)
  - [Delete an existing relation](#delete-an-existing-relation)
- [Create/Read/Delete Insights Model Builds](#createreaddelete-insights-model-builds)
  - [Get a list of insights model builds](#get-a-list-of-insights-model-builds)
  - [Get the insights model’s build status](#get-the-insights-models-build-status)
  - [Trigger the build of an insights model](#trigger-the-build-of-an-insights-model)
  - [Stop the build of an insights model](#stop-the-build-of-an-insights-model)


# Create/Read/Delete Insights Models

## Get a list of the account’s insights models


```text
GET /reporting/datamodels
```

## 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.


```text
GET /reporting/account
```

### Sample Response

View the query and dashboard limits in GB paying specific attention to the `build_size` and `query_size` parameters.


```json
{
        "id": "10",
        "sisense_group_id": "5f7e73a8390cef002c916538",
        "td_account_id": "6233",
        "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": "7e550d2c-68c0-4fb1-90b0-ac40c044b096",
        "sisense_hostname": "us01-01-development.reporting.treasuredata.com",
        "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


```text
GET /reporting/datamodels/{datamodel_id}
```

## Create a new insights model


```text
POST /reporting/datamodels
```

## Delete an existing insights model


```text
DELETE /reporting/datamodels/{datamodel_id}
```

# Update Insights Model Share

## Share the insights model with users


```text
PUT /reporting/datamodels/{datamodel_id}/shares
```

# Create/Read/Delete Datasets

## Get a list of the datasets in the insights model


```text
GET /reporting/datamodels/{datamodel_id}/datasets
```

## Create a new insights model dataset


```text
POST /reporting/datamodels/{datamodel_id}/datasets
```

## Delete an insights model dataset


```text
DELETE /reporting/datamodels/{datamodel_id}/datasets/{dataset_id}
```

# Create/Read/Update/Delete Tables

## Get a list of tables in a dataset


```text
GET /reporting/datamodels/{datamodel_id}/datasets/{dataset_id}/tables
```

## Create a new table in a dataset


```text
POST /reporting/datamodels/{datamodel_id}/datasets/{dataset_id}/tables
```

## Update an existing table in a dataset


```text
PUT|PATCH /reporting/datamodels/{datamodel_id}/datasets/{dataset_id}/tables/{table_id}
```

## Delete an existing table in a dataset


```text
DELETE /reporting/datamodels/{datamodel_id}/datasets/{dataset_id}/tables/{table_id}
```

# Create/Read/Delete Relations

## Get a list of insights model relations


```text
GET /reporting/datamodels/{datamodel_id}/relations
```

## Create a new relation for an insights model


```text
POST /reporting/datamodels/{datamodel_id}/relations
```

## Delete an existing relation


```text
DELETE /reporting/datamodels/{datamodel_id}/relations/{relation_id}
```

# Create/Read/Delete Insights Model Builds

## Get a list of insights model builds


```text
GET /reporting/datamodels/{datamodel_id}/builds
```

## Get the insights model’s build status


```text
GET /reporting/datamodels/{datamodel_id}/builds/{build_id}
```

## Trigger the build of an insights model


```text
POST /reporting/datamodels/{datamodel_id}/builds
```

## Stop the build of an insights model


```text
DELETE /reporting/datamodels/{datamodel_id}/builds/{build_id}
```