Dune Analytics Materialized Views API

The Materialized Views API from Dune Analytics — 3 operation(s) for materialized views.

Operations 5

GET /v1/materialized-views This lists all materialized view owned by the account tied to the API key #
POST /v1/materialized-views This upserts (create or replace) a materialized view from an existing query #
DELETE /v1/materialized-views/{name} This deletes a materialized view given a full name #
GET /v1/materialized-views/{name} This fetches a materialized view given a name #
POST /v1/materialized-views/{name}/refresh This refreshes a materialized view #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/dune-analytics:dune-analytics-materialized-views-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

dune-analytics-materialized-views-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact: {}
  description: Dune API
  title: Dune Materialized Views API
  version: '1.0'
servers:
- url: https://api.dune.com/api
tags:
- name: Materialized Views
paths:
  /v1/materialized-views:
    get:
      parameters:
      - description: API Key for the service
        in: header
        name: X-Dune-Api-Key
        required: true
        schema:
          type: string
      - description: API Key, alternative to using the HTTP header X-Dune-Api-Key
        in: query
        name: api_key
        schema:
          type: string
      - description: Number of materialized views to return on a page. Default and max 10000
        in: query
        name: limit
        schema:
          type: string
      - description: Offset used for pagination. Use the value provided on a previous response under next_offset
        in: query
        name: offset
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/matviews.MatviewsListResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error400'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error401'
          description: Unauthorized
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error500'
          description: Internal Server Error
      summary: This lists all materialized view owned by the account tied to the API key
      x-required-scope: Read
      tags:
      - Materialized Views
      operationId: getV1MaterializedViews
      x-operation-id-source: derived
    post:
      description: This upserts a materialized view from an existing query. If the materialized view with the given name
      parameters:
      - description: API Key for the service
        in: header
        name: X-Dune-Api-Key
        required: true
        schema:
          type: string
      - description: API Key, alternative to using the HTTP header X-Dune-Api-Key
        in: query
        name: api_key
        schema:
          type: string
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/matviews.MatviewsUpsertRequest'
        description: MatviewsUpsertRequest
        x-originalParamName: body
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/matviews.MatviewsUpsertResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error400'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error401'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error404'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error500'
          description: Internal Server Error
      summary: This upserts (create or replace) a materialized view from an existing query
      x-required-scope: Read/Write
      tags:
      - Materialized Views
      operationId: postV1MaterializedViews
      x-operation-id-source: derived
  /v1/materialized-views/{name}:
    delete:
      parameters:
      - description: Matview Name
        in: path
        name: name
        required: true
        schema:
          type: string
      - description: API Key for the service
        in: header
        name: X-Dune-Api-Key
        required: true
        schema:
          type: string
      - description: API Key, alternative to using the HTTP header X-Dune-Api-Key
        in: query
        name: api_key
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/matviews.MatviewsDeleteResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error400'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error401'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error403'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error404'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error500'
          description: Internal Server Error
      summary: This deletes a materialized view given a full name
      x-required-scope: Read/Write
      tags:
      - Materialized Views
      operationId: deleteV1MaterializedViewsByName
      x-operation-id-source: derived
    get:
      parameters:
      - description: Matview Name
        in: path
        name: name
        required: true
        schema:
          type: string
      - description: API Key for the service
        in: header
        name: X-Dune-Api-Key
        required: true
        schema:
          type: string
      - description: API Key, alternative to using the HTTP header X-Dune-Api-Key
        in: query
        name: api_key
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/matviews.MatviewsGetResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error400'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error401'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error403'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error404'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error500'
          description: Internal Server Error
      summary: This fetches a materialized view given a name
      x-required-scope: Read
      tags:
      - Materialized Views
      operationId: getV1MaterializedViewsByName
      x-operation-id-source: derived
  /v1/materialized-views/{name}/refresh:
    post:
      parameters:
      - description: Matview Name
        in: path
        name: name
        required: true
        schema:
          type: string
      - description: API Key for the service
        in: header
        name: X-Dune-Api-Key
        required: true
        schema:
          type: string
      - description: API Key, alternative to using the HTTP header X-Dune-Api-Key
        in: query
        name: api_key
        schema:
          type: string
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/matviews.MatviewsRefreshRequest'
        description: MatviewsRefreshRequest
        x-originalParamName: body
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/matviews.MatviewsRefreshResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error400'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error401'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error404'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.Error500'
          description: Internal Server Error
      summary: This refreshes a materialized view
      x-required-scope: Read
      tags:
      - Materialized Views
      operationId: postV1MaterializedViewsByNameRefresh
      x-operation-id-source: derived
components:
  schemas:
    models.Error400:
      properties:
        error:
          example: Bad Request
          type: string
      type: object
    matviews.MatviewsGetResponse:
      properties:
        id:
          type: string
        is_private:
          type: boolean
        last_execution_ids:
          items:
            type: string
          type: array
        owner_team_id:
          type: integer
        owner_user_id:
          type: integer
        query_id:
          type: integer
        schedule:
          $ref: '#/components/schemas/matviews.MatviewSchedule'
        sql_id:
          type: string
        table_size_bytes:
          type: integer
      type: object
    matviews.MatviewsUpsertResponse:
      properties:
        execution_id:
          description: Unique identifier for the execution triggered to refresh the materialized view
          example: 01HZ065JVE23C23FM2HKWQP2RT
          type: string
        name:
          description: Unique identifier for the materialized view
          example: dune.dune.result_erc_20_token_summary
          type: string
      type: object
    models.Error403:
      properties:
        error:
          example: Not allowed to execute query. Query is archived, unsaved or not enough permissions
          type: string
      type: object
    matviews.MatviewsRefreshRequest:
      properties:
        performance:
          description: 'Performance tier for the refresh execution. Accepts `small`, `medium`, `large`.

            Omit to use the default tier for the source query''s engine.'
          type: string
      type: object
    models.Error404:
      properties:
        error:
          example: Object not found
          type: string
      type: object
    matviews.MatviewsListResponse:
      properties:
        materialized_views:
          items:
            $ref: '#/components/schemas/matviews.MatviewListElement'
          type: array
        next_offset:
          type: integer
      type: object
    matviews.MatviewListElement:
      properties:
        id:
          type: string
        is_private:
          type: boolean
        query_id:
          type: integer
        sql_id:
          type: string
        table_size_bytes:
          type: integer
      type: object
    matviews.MatviewSchedule:
      properties:
        cron_expression:
          example: 0 */6 * * *
          type: string
        expires_at:
          example: '2026-09-11T23:59:59Z'
          type: string
        next_execution_time:
          example: '2026-06-12T00:00:00Z'
          type: string
        performance:
          example: medium
          type: string
      type: object
    matviews.MatviewsRefreshResponse:
      properties:
        execution_id:
          description: Unique identifier for the execution triggered to refresh the materialized view
          example: 01HZ065JVE23C23FM2HKWQP2RT
          type: string
        sql_id:
          description: Unique identifier for the materialized view
          example: dune.dune.result_erc_20_token_summary
          type: string
      type: object
    matviews.MatviewsUpsertRequest:
      properties:
        cron_expression:
          type: string
        expires_at:
          type: string
        is_private:
          type: boolean
        name:
          type: string
        performance:
          description: 'Performance tier for the refresh execution. Accepts `small`, `medium`, `large`.

            Omit to use the default tier for the source query''s engine.'
          type: string
        query_id:
          type: integer
      type: object
    models.Error401:
      properties:
        error:
          example: Invalid API Key
          type: string
      type: object
    matviews.MatviewsDeleteResponse:
      properties:
        message:
          type: string
      type: object
    models.Error500:
      properties:
        error:
          example: Internal error
          type: string
      type: object
x-service-info:
  categories:
  - data
  - compute
  docs:
    apiReference: https://docs.dune.com/api-reference/overview/introduction
    homepage: https://docs.dune.com
x-provenance:
  method: harvested
  publisher: Dune Analytics
  source: https://api.dune.com/openapi.json
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)