curl -X POST "https://api.dune.com/api/v1/materialized-views/my_matview/refresh" \
-H "X-Dune-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"performance": "medium"
}'
import requests
url = "https://api.dune.com/api/v1/materialized-views/my_matview/refresh"
headers = {
"X-Dune-Api-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"performance": "medium"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch(
'https://api.dune.com/api/v1/materialized-views/my_matview/refresh',
{
method: 'POST',
headers: {
'X-Dune-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
performance: 'medium'
})
}
);
const data = await response.json();
console.log(data);
{
"execution_id": "01HZ065JVE23C23FM2HKWQP2RT",
"sql_id": "dune.dune.result_erc_20_token_summary"
}
{
"error": "Bad Request"
}
{
"error": "Invalid API Key"
}
{
"error": "Object not found"
}
{
"error": "Internal error"
}
Materialized Views
Refresh Materialized View
Starts an execution of the materialized view’s source query that refreshes its data, optionally on a chosen performance tier. Returns the ID of that execution.
POST
/
v1
/
materialized-views
/
{name}
/
refresh
curl -X POST "https://api.dune.com/api/v1/materialized-views/my_matview/refresh" \
-H "X-Dune-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"performance": "medium"
}'
import requests
url = "https://api.dune.com/api/v1/materialized-views/my_matview/refresh"
headers = {
"X-Dune-Api-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"performance": "medium"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch(
'https://api.dune.com/api/v1/materialized-views/my_matview/refresh',
{
method: 'POST',
headers: {
'X-Dune-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
performance: 'medium'
})
}
);
const data = await response.json();
console.log(data);
{
"execution_id": "01HZ065JVE23C23FM2HKWQP2RT",
"sql_id": "dune.dune.result_erc_20_token_summary"
}
{
"error": "Bad Request"
}
{
"error": "Invalid API Key"
}
{
"error": "Object not found"
}
{
"error": "Internal error"
}
Minimum required API key scope:
Read- By default, the refresh runs on the
mediumengine. To boost performance, pass in a JSON body with{{"performance": "large"}}. Credits are consumed based on actual compute resources used for the refresh operation. - If you prefer
mediumperformance, you can omit theperformanceparameter. - You must own the materialized view to refresh it.
Path Parameters
Request Body
Performance level of the refresh. Available options:
medium, large. Defaults to medium.medium: Extended timeout, 1x compute, priority queue. Best for most queries.large: Extended timeout, 2x compute, priority queue. For complex queries.
Response
Unique identifier for the execution triggered to refresh the materialized viewExample:
01HZ065JVE23C23FM2HKWQP2RTcurl -X POST "https://api.dune.com/api/v1/materialized-views/my_matview/refresh" \
-H "X-Dune-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"performance": "medium"
}'
import requests
url = "https://api.dune.com/api/v1/materialized-views/my_matview/refresh"
headers = {
"X-Dune-Api-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"performance": "medium"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch(
'https://api.dune.com/api/v1/materialized-views/my_matview/refresh',
{
method: 'POST',
headers: {
'X-Dune-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
performance: 'medium'
})
}
);
const data = await response.json();
console.log(data);
{
"execution_id": "01HZ065JVE23C23FM2HKWQP2RT",
"sql_id": "dune.dune.result_erc_20_token_summary"
}
{
"error": "Bad Request"
}
{
"error": "Invalid API Key"
}
{
"error": "Object not found"
}
{
"error": "Internal error"
}
Notes
- Refreshing a materialized view triggers a query execution to update the view with the latest data
- Use the returned
execution_idto check the status of the refresh operation - Credits are consumed based on actual compute resources used, the performance tier selected, and the amount of data written (e.g., table creation and data insertion)
Body
*/*
MatviewsRefreshRequest
Was this page helpful?