# Replacing the API Key for Data Models

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.


```bash
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.

- `API_ENDPOINT`: Refers to your Treasure Data region.
  - US: api.treasuredata.com
  - EU01: api.eu01.treasuredata.com
  - Korea: api.ap02.treasuredata.com
  - Tokyo: api.treasuredata.co.jp
To confirm your Treasure Data region, see [Sites and Endpoints](/apis/endpoints/endpoints).
- `YOUR_DATAMODEL_OID`: The value of the data model. You can get this value from the Treasure Console URL. Refer to `/app/admin/datamodels/<VALUE>` in the Data Model URL.
- `YOUR_TD_APIKEY`: Requires your Master Treasure API Key. The following document explains how to get a Treasure API key: [Getting your API keys](/products/my-settings/getting-your-api-keys).


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:


```json
    {"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](mailto:support@treasure-data.com)) when you have any further assistance about this operation.