cURL
curl --request GET \
--url https://api.isofold.com/cost \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.isofold.com/cost"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.isofold.com/cost', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isofold.com/cost",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.isofold.com/cost"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.isofold.com/cost")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isofold.com/cost")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"original_cost": 123,
"optimized_cost": 123,
"savings": 123
}Endpoints
Estimate Cost
Estimates the cost of the original and rewritten version of a query.
GET
/
cost
cURL
curl --request GET \
--url https://api.isofold.com/cost \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.isofold.com/cost"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.isofold.com/cost', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isofold.com/cost",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.isofold.com/cost"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.isofold.com/cost")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isofold.com/cost")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"original_cost": 123,
"optimized_cost": 123,
"savings": 123
}Estimate the cost of running a query before and after Isofold optimization.
This endpoint is primarily supported for BigQuery, where dry-run mode provides exact byte scan estimates. For other warehouses, estimates are heuristic-based.
Next: Verify Result Equivalence
Request
Make aGET request to /cost with a query parameter:
curl -G https://api.isofold.com/cost \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "query=SELECT * FROM users"
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | ✅ | Raw SQL query to evaluate |
Response
{
"original_cost": 0.29,
"optimized_cost": 0.11,
"savings": 0.18
}
Fields
| Field | Type | Description |
|---|---|---|
original_cost | number | Cost estimate of the unoptimized query (USD) |
optimized_cost | number | Cost estimate of the rewritten query (USD) |
savings | number | Difference between original and optimized cost |
Notes
- On BigQuery, this uses real dry-run estimates.
- On other engines, costs are approximated using:
- Column count
- Join complexity
- Filter selectivity
- Use this endpoint to evaluate query rewrites without executing them.
Next: Verify Result Equivalence