Skip to main content
We have a Go client available at github.com/duneanalytics/duneapi-client-go.

Installation

To install the SDK, run the following command:
go get github.com/duneanalytics/duneapi-client-go

Quick Start

Initialize the client and execute a query:
package main

import (
    "fmt"
    "os"
    
    "github.com/duneanalytics/duneapi-client-go"
)

func main() {
    // Initialize client with API key
    client := duneapi.New(os.Getenv("DUNE_API_KEY"))
    
    // Execute a query
    queryID := 1215383
    results, err := client.ExecuteQuery(queryID)
    if err != nil {
        panic(err)
    }
    
    // Process results
    fmt.Printf("Got %d rows\n", len(results.Rows))
    for _, row := range results.Rows {
        fmt.Printf("%+v\n", row)
    }
}

Error Handling

The Go client follows idiomatic Go error handling patterns:
results, err := client.ExecuteQuery(queryID)
if err != nil {
    // Handle error
    log.Printf("Error executing query: %v", err)
    return
}

// Use results
fmt.Println(results)

Additional Resources