Skip to content
Last updated

Replacing the API Key for Data Models

To replace the current TD API key with a new TD 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 TD API KEY rotation in your data model.

curl -i -X PUT 'https://API_ENDPOINT/reporting/datamodels/YOUR_DATAMODEL_OID' \  
--header 'Content-Type: application/json' \  
--header "Authorization: TD1 YOUR_TD_APIKEY" \  
--data '{  
        "datamodel": {  
           "apikey": "YOUR_TD_APIKEY"  
        }  
}'  

You’ll need to update the following three paramaters to execute.

When the request executes, your TD API key for a data model will be rotated by your specified TD API key, and you will get the data model information with 200 success response like below:

    {"oid":"93d34997-xxxx-xxxx-xxxx-xxxxxxxxx","name":"your_datamodel_name","type":"elasticube",
    ...
    ,"relations":[]}

Build the data model after the command, you can confirm that the API key rotation works. Please reach out to Support (support@treasure-data.com) when you have any further assistance about this operation.