{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"redocly_category":"Products","product_name":"Treasure Insights","type":"markdown"},"seo":{"title":"Create an Insights Model","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"create-an-insights-model","__idx":0},"children":["Create an Insights Model"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Call #POST /reporting/datamodels to create a data model. The following is an example that creates a data model while referencing the previously created YAML file."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Access ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["sample_datasets"]}," database and create two tables: ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["nasdaq"]}," and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["www_access"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Create a relationship between the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["symbol"]}," column and the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["host"]}," column."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the API endpoint, select the appropriate ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/endpoints/endpoints"},"children":["endpoint for your region"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST --data-urlencode \"yaml=$(cat datamodel.yml)\" \\\n-H 'Authorization: TD1 xxxx/xxxxxxxxxxxxxx' \\\nhttps://${TD_API_ENDPOINT}/reporting/datamodels  \n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The actual Insights model is created in the analytics platform; the prefix created uses the following format: dm_{your account id}_.__ For example,__ if your account id is 1, the Insights model name is ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["dm_1_sample_datamodel."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Model names are case insensitive; the model name automatically converts to lower case. For example, ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["data_MODEL_one"]}," and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["data_model_ONE"]}," create the same data model: ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["data_model_one"]},"."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Analytics platform does not support ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["unixtimestamp"]},". If you want to use ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["datetime"]}," in a widget, convert ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["unixtimestamp"]}," to text with the timestamp format before you create an Insights model and define the column as a type of ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["timestamp"]},"."]}]}]},"headings":[{"value":"Create an Insights Model","id":"create-an-insights-model","depth":1}],"frontmatter":{"seo":{"title":"Create an Insights Model"}},"lastModified":"2026-03-10T06:52:05.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/customer-data-platform/treasure-insights/create-an-insights-model","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}