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

# Unprivate Query

> This API allows for anyone to unprivate a query. Only the API key generated under the context of the owner of that query will work.

<Note>
  To access Query endpoints, a [Plus plan](https://dune.com/pricing) or higher is required.
</Note>

<RequestExample>
  ```bash cURL
  curl --request GET \
    --url https://api.dune.com/api/v1/query/{queryId}/unprivate \
    --header 'X-DUNE-API-KEY: <x-dune-api-key>'
  ```

  ```python Python SDK
  import dotenv, os
  from dune_client.client import DuneClient

  dotenv_path = os.path.join(os.path.dirname(__file__), '..', '.env')
  dotenv.load_dotenv(".env")
  dune = DuneClient.from_env()

  query = dune.unprivate_query(1252207)
  ```

  ```python Python
  import requests

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

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

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

  print(response.text)

  ```

  ```javascript JavaScript
  const options = {method: 'GET', 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));
  ```

  ```go Go
  package main

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

  func main() {

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

  	req, _ := http.NewRequest("GET", 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 PHP
  <?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 => "GET",
    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;
  }
  ```

  ```java Java
  HttpResponse<String> response = Unirest.get("https://api.dune.com/api/v1/query/{queryId}/unprivate")
    .header("X-DUNE-API-KEY", "<x-dune-api-key>")
    .asString();
  ```
</RequestExample>
