---
title: "This upserts (create or replace) a materialized view from an existing query"
method: POST
path: "/v1/materialized-views"
---

# This upserts (create or replace) a materialized view from an existing query

`POST /v1/materialized-views`

This upserts a materialized view from an existing query. If the materialized view with the given name

## Query parameters

- `api_key` string

## Headers

- `X-Dune-Api-Key` string, required

## Response `200`

OK

- MatviewsMatviewsUpsertResponse
  - `execution_id` string — Unique identifier for the execution triggered to refresh the materialized view
  - `name` string — Unique identifier for the materialized view

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.dev/dune/apis/duneapi.md) · [All operations](https://skmtc.dev/dune/apis/duneapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/dune/duneapi/revisions/f3a7a865f95b/schema)
