---
title: "Updates an existing view."
method: PUT
path: "/api/projects/{projectName}/views/{viewName}"
---

# Updates an existing view.

`PUT /api/projects/{projectName}/views/{viewName}`

Updates an existing view, or creates a new view if one doesn't exist.

## Path parameters

- `projectName` string, required
- `viewName` string, required

## Request body

- object
  - `view` object
    - `name` string — Name of the view
    - `query` string — The SQL query that will save the result-set in a view.

## Response `200`

View was successfully updated

- View
  - `name` string
  - `query` string — SELECT query used to create the view

## Other responses

- `400` — Bad request format
- `401` — Invalid API key error message
- `500` — Server error

---

[API](https://skmtc.net/mindsdb/apis/mindsdb-api.md) · [All operations](https://skmtc.net/mindsdb/apis/mindsdb-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mindsdb/mindsdb-api/versions/387ff52538f9/schema)
