{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Products","product_name":"Treasure Insights","type":"markdown"},"seo":{"title":"Replacing the API Key for Data Models","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":"replacing-the-api-key-for-data-models","__idx":0},"children":["Replacing the API Key for Data Models"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To replace the current Treasure API key with a new Treasure API key, follow this procedure. This allows you to build your data models without needing to re-create your existing data models. Use the following REST API request for Treasure API KEY rotation in your data model."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -i -X PUT 'https://API_ENDPOINT/reporting/datamodels/YOUR_DATAMODEL_OID' \\  \n--header 'Content-Type: application/json' \\  \n--header \"Authorization: TD1 YOUR_TD_APIKEY\" \\  \n--data '{  \n        \"datamodel\": {  \n           \"apikey\": \"YOUR_TD_APIKEY\"  \n        }  \n}'  \n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You’ll need to update the following three paramaters to execute."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["API_ENDPOINT"]},": Refers to your Treasure Data region.",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["US: api.treasuredata.com"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["EU01: api.eu01.treasuredata.com"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Korea: api.ap02.treasuredata.com"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tokyo: api.treasuredata.co.jp"," ","To confirm your Treasure Data region, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/endpoints/endpoints"},"children":["Sites and Endpoints"]},"."]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["YOUR_DATAMODEL_OID"]},": The value of the data model. You can get this value from the Treasure Console URL. Refer to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/app/admin/datamodels/<VALUE>"]}," in the Data Model URL."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["YOUR_TD_APIKEY"]},": Requires your Master Treasure API Key. The following document explains how to get a Treasure API key: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/my-settings/getting-your-api-keys"},"children":["Getting your API keys"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When the request executes, your Treasure API key for a data model will be rotated by your specified Treasure API key, and you will get the data model information with 200 success response like below:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"    {\"oid\":\"93d34997-xxxx-xxxx-xxxx-xxxxxxxxx\",\"name\":\"your_datamodel_name\",\"type\":\"elasticube\",\n    ...\n    ,\"relations\":[]}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Build the data model after the command, you can confirm that the API key rotation works. Please reach out to Support (",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"mailto:support@treasure-data.com"},"children":["support@treasure-data.com"]},") when you have any further assistance about this operation."]}]},"headings":[{"value":"Replacing the API Key for Data Models","id":"replacing-the-api-key-for-data-models","depth":1}],"frontmatter":{"seo":{"title":"Replacing the API Key for Data Models"}},"lastModified":"2026-06-01T09:09:59.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/customer-data-platform/treasure-insights/replacing-the-api-key-for-data-models","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}