# Replace Model

## PUT /v1/forecasts/models/{model\_id}

> Replace Model

```json
{"openapi":"3.1.0","info":{"title":"PredictHQ Forecasts API (Public Preview)","version":"1.0.0"},"tags":[{"name":"Models"}],"servers":[{"url":"https://api.predicthq.com"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"$API_KEY","description":"Enter your PredictHQ API key. The Bearer prefix is added automatically.\n\nWhen calling the API directly, send: `Authorization: Bearer <YOUR_API_KEY>` as documented at [https://docs.predicthq.com/api/overview/authenticating](https://docs.predicthq.com/api/overview/authenticating)\n"}},"schemas":{"ReplaceModelRequest":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"external_id":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"External Id"},"forecast_window":{"anyOf":[{"$ref":"#/components/schemas/ForecastWindowDay"},{"type":"null"}]},"label":{"anyOf":[{"items":{"type":"string","minLength":1},"type":"array","minItems":1},{"type":"null"}],"title":"Label"},"location":{"$ref":"#/components/schemas/Location"},"algo":{"$ref":"#/components/schemas/AlgoType","default":"phq-xgboost"},"demand_type":{"anyOf":[{"$ref":"#/components/schemas/InputDemandType"},{"type":"null"}]}},"additionalProperties":false,"type":"object","required":["name","location"],"title":"ReplaceModelRequest"},"ForecastWindowDay":{"type":"string","enum":["1d","7d","14d","28d","30d","60d","90d"],"title":"ForecastWindowDay"},"Location":{"properties":{"saved_location_id":{"type":"string","minLength":1,"title":"Saved Location ID"}},"type":"object","required":["saved_location_id"],"title":"Location"},"AlgoType":{"type":"string","enum":["phq-xgboost"]},"InputDemandType":{"properties":{"interval":{"$ref":"#/components/schemas/InputInterval"},"industry":{"$ref":"#/components/schemas/Industry"}},"type":"object","title":"InputDemandType"},"InputInterval":{"type":"string","enum":["day"],"title":"InputInterval"},"Industry":{"description":"Choosing the right industry is important as this will determine the type of features used in the training and forecasting and will impact the accuracy of the results. We will use the applicable Predicted Impact Patterns for the specified industry.","type":"string","enum":["accommodation","cpg","tourism","marketing","parking","restaurants","retail","transportation","other"],"title":"Industry"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/forecasts/models/{model_id}":{"put":{"tags":["Models"],"summary":"Replace Model","operationId":"replace_model_models__model_id__put","parameters":[{"name":"model_id","in":"path","required":true,"schema":{"type":"string","title":"Model Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplaceModelRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## OpenAPI Spec

The OpenAPI spec for Forecasts API can be [found here](https://api.predicthq.com/docs/?urls.primaryName=Forecasts+API).

## Guides

* [Getting Started with Forecasts API](https://docs.predicthq.com/getting-started/guides/forecasts-api-guides/getting-started)
* [Understanding Forecast Accuracy Metrics](https://docs.predicthq.com/getting-started/guides/forecasts-api-guides/understanding-forecast-accuracy-metrics)
* [Troubleshooting Guide for Forecasts API](https://docs.predicthq.com/getting-started/guides/forecasts-api-guides/troubleshooting)
