Skip to main content
POST
/
v1
/
query
/
{queryId}
/
unprivate
curl --request POST \
  --url https://api.dune.com/api/v1/query/{queryId}/unprivate \
  --header 'X-DUNE-API-KEY: <x-dune-api-key>'
from dune_client.client import DuneClient

dune = DuneClient()

query = dune.unprivate_query(1252207)
import requests

url = "https://api.dune.com/api/v1/query/{queryId}/unprivate"

headers = {"X-DUNE-API-KEY": "<x-dune-api-key>"}

response = requests.request("POST", url, headers=headers)

print(response.text)

const options = {method: 'POST', headers: {'X-DUNE-API-KEY': '<x-dune-api-key>'}};

fetch('https://api.dune.com/api/v1/query/{queryId}/unprivate', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.dune.com/api/v1/query/{queryId}/unprivate"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-DUNE-API-KEY", "<x-dune-api-key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.dune.com/api/v1/query/{queryId}/unprivate",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "X-DUNE-API-KEY: <x-dune-api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.dune.com/api/v1/query/{queryId}/unprivate")
  .header("X-DUNE-API-KEY", "<x-dune-api-key>")
  .asString();
{
  "query_id": 123
}
{
  "error": "Bad Request"
}
{
  "error": "Invalid API Key"
}
{
  "error": "Not allowed to execute query. Query is archived, unsaved or not enough permissions"
}
{
  "error": "Object not found"
}
{
  "error": "Internal error"
}
Minimum required API key scope: Read/Write
To access Query endpoints, an Analyst plan or higher is required.
curl --request POST \
  --url https://api.dune.com/api/v1/query/{queryId}/unprivate \
  --header 'X-DUNE-API-KEY: <x-dune-api-key>'
from dune_client.client import DuneClient

dune = DuneClient()

query = dune.unprivate_query(1252207)
import requests

url = "https://api.dune.com/api/v1/query/{queryId}/unprivate"

headers = {"X-DUNE-API-KEY": "<x-dune-api-key>"}

response = requests.request("POST", url, headers=headers)

print(response.text)

const options = {method: 'POST', headers: {'X-DUNE-API-KEY': '<x-dune-api-key>'}};

fetch('https://api.dune.com/api/v1/query/{queryId}/unprivate', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.dune.com/api/v1/query/{queryId}/unprivate"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-DUNE-API-KEY", "<x-dune-api-key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.dune.com/api/v1/query/{queryId}/unprivate",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "X-DUNE-API-KEY: <x-dune-api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.dune.com/api/v1/query/{queryId}/unprivate")
  .header("X-DUNE-API-KEY", "<x-dune-api-key>")
  .asString();

Headers

X-Dune-Api-Key
string
required

API Key for the service

Path Parameters

queryId
integer
required

Query ID

Query Parameters

api_key
string

API Key, alternative to using the HTTP header X-Dune-Api-Key

Response

OK

query_id
integer

The unique ID of the query that was updated