> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anysite.io/llms.txt
> Use this file to discover all available pages before exploring further.

# /dune/queries

> Get a Dune query by id: SQL text, metadata, author, parameters and visualizations

**Price:** 1 credit

**💡 AI Hint:** Get a Dune Analytics query by its numeric id (the number in a dune.com/queries/{id} URL). Returns the full SQL text, name, AI-generated description, tags, star count, created/updated timestamps, the author (analyst or team), declared query parameters, and the visualizations defined on the query. Use the 'queries/results' endpoint to fetch the actual cached on-chain result rows for a query.

**⚠️ Common errors:** 412: Query not found



## OpenAPI

````yaml /openapi-filtered.json post /api/dune/queries
openapi: 3.1.0
info:
  title: Any Site API
  description: >+
    Any Site API provides programmatic access to data from LinkedIn, Instagram,
    Twitter, and other platforms.


    ## Authentication


    All API endpoints require an `access-token` header with a valid API token.
    Tokens can be created in the [dashboard](https://app.anysite.io/).


    ## Pricing


    Each endpoint has a credit cost listed in its description. Credits are
    deducted from your token balance per request.

  version: 0.0.1
servers: []
security:
  - AccessToken: []
paths:
  /api/dune/queries:
    post:
      tags:
        - /dune
      summary: /dune/queries
      description: >-
        Get a Dune query by id: SQL text, metadata, author, parameters and
        visualizations


        **Price:** 1 credit


        **💡 AI Hint:** Get a Dune Analytics query by its numeric id (the number
        in a dune.com/queries/{id} URL). Returns the full SQL text, name,
        AI-generated description, tags, star count, created/updated timestamps,
        the author (analyst or team), declared query parameters, and the
        visualizations defined on the query. Use the 'queries/results' endpoint
        to fetch the actual cached on-chain result rows for a query.


        **⚠️ Common errors:** 412: Query not found
      operationId: __api_dune_queries_post
      parameters:
        - name: access-token
          in: header
          required: true
          schema:
            anyOf:
              - type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DuneQueryPayload'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DuneQuery'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    DuneQueryPayload:
      properties:
        timeout:
          type: integer
          maximum: 1500
          minimum: 20
          description: Max scrapping execution timeout (in seconds)
          default: 300
        query:
          type: integer
          description: Query id (numeric), e.g. 5868495 or a dune.com/queries/{id} URL
          examples:
            - 5868495
      type: object
      required:
        - query
    DuneQuery:
      properties:
        '@type':
          type: string
          default: DuneQuery
        id:
          type: integer
        name:
          anyOf:
            - type: string
            - type: 'null'
        description:
          anyOf:
            - type: string
            - type: 'null'
        ai_description:
          anyOf:
            - type: string
            - type: 'null'
        sql:
          anyOf:
            - type: string
            - type: 'null'
        version:
          anyOf:
            - type: integer
            - type: 'null'
        dataset_id:
          anyOf:
            - type: integer
            - type: 'null'
        tags:
          items:
            type: string
          type: array
          default: []
        is_private:
          type: boolean
          default: false
        is_archived:
          type: boolean
          default: false
        star_count:
          anyOf:
            - type: integer
            - type: 'null'
        fork_count:
          anyOf:
            - type: integer
            - type: 'null'
        is_favorite:
          type: boolean
          default: false
        created_at:
          anyOf:
            - type: string
            - type: 'null'
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
        author:
          anyOf:
            - $ref: '#/components/schemas/DuneAuthor'
            - type: 'null'
        parameters:
          items:
            $ref: '#/components/schemas/DuneQueryParameter'
          type: array
          default: []
        visualizations:
          items:
            $ref: '#/components/schemas/DuneVisualization'
          type: array
          default: []
      type: object
      required:
        - id
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
      type: object
    DuneAuthor:
      properties:
        '@type':
          type: string
          default: DuneAuthor
        id:
          anyOf:
            - type: integer
            - type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        alias:
          anyOf:
            - type: string
            - type: 'null'
        image:
          anyOf:
            - type: string
            - type: 'null'
        is_team:
          type: boolean
          default: false
      type: object
    DuneQueryParameter:
      properties:
        '@type':
          type: string
          default: DuneQueryParameter
        key:
          type: string
        type:
          anyOf:
            - type: string
            - type: 'null'
        value:
          anyOf:
            - type: string
            - type: 'null'
      type: object
      required:
        - key
    DuneVisualization:
      properties:
        '@type':
          type: string
          default: DuneVisualization
        id:
          type: integer
        type:
          anyOf:
            - type: string
            - type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        description:
          anyOf:
            - type: string
            - type: 'null'
      type: object
      required:
        - id
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
        msg:
          type: string
        type:
          type: string
        input: {}
        ctx:
          type: object
      type: object
      required:
        - loc
        - msg
        - type
  securitySchemes:
    AccessToken:
      type: apiKey
      in: header
      name: access-token
      description: API token from the dashboard

````