Execute a read-only SQL query against ClickHouse
import requests
url = "https://api.pmxt.dev/v0/sql"
payload = { "query": "SELECT * FROM markets LIMIT 10" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'SELECT * FROM markets LIMIT 10'})
};
fetch('https://api.pmxt.dev/v0/sql', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.pmxt.dev/v0/sql \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "SELECT * FROM markets LIMIT 10"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pmxt.dev/v0/sql"
payload := strings.NewReader("{\n \"query\": \"SELECT * FROM markets LIMIT 10\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pmxt.dev/v0/sql")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"SELECT * FROM markets LIMIT 10\"\n}")
.asString();{
"data": [
{
"column1": "value1"
}
],
"meta": {
"columns": [
{
"name": "column1",
"type": "String"
}
],
"rows": 1,
"statistics": {
"elapsed": 0.005,
"rows_read": 100,
"bytes_read": 5000
}
}
}{
"error": "query_error",
"message": "<string>"
}{
"error": "sql_access_denied",
"message": "SQL query access requires an Enterprise plan"
}{
"error": "query_timeout",
"message": "Query exceeded the maximum execution time (5s)"
}{
"error": "service_unavailable",
"message": "SQL query service is not available"
}Enterprise
Execute a read-only SQL query against ClickHouse
POST
/
v0
/
sql
Execute a read-only SQL query against ClickHouse
import requests
url = "https://api.pmxt.dev/v0/sql"
payload = { "query": "SELECT * FROM markets LIMIT 10" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'SELECT * FROM markets LIMIT 10'})
};
fetch('https://api.pmxt.dev/v0/sql', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.pmxt.dev/v0/sql \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "SELECT * FROM markets LIMIT 10"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pmxt.dev/v0/sql"
payload := strings.NewReader("{\n \"query\": \"SELECT * FROM markets LIMIT 10\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pmxt.dev/v0/sql")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"SELECT * FROM markets LIMIT 10\"\n}")
.asString();{
"data": [
{
"column1": "value1"
}
],
"meta": {
"columns": [
{
"name": "column1",
"type": "String"
}
],
"rows": 1,
"statistics": {
"elapsed": 0.005,
"rows_read": 100,
"bytes_read": 5000
}
}
}{
"error": "query_error",
"message": "<string>"
}{
"error": "sql_access_denied",
"message": "SQL query access requires an Enterprise plan"
}{
"error": "query_timeout",
"message": "Query exceeded the maximum execution time (5s)"
}{
"error": "service_unavailable",
"message": "SQL query service is not available"
}Authorizations
Required when calling the hosted API directly (curl, requests, fetch). SDK users pass credentials via constructor params instead.
Body
application/json
Example:
"SELECT * FROM markets LIMIT 10"
Was this page helpful?
⌘I

