Get Optimization Opportunities
curl --request GET \
--url https://api.wistx.ai/v1/cost/optimization-opportunitiesimport requests
url = "https://api.wistx.ai/v1/cost/optimization-opportunities"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.wistx.ai/v1/cost/optimization-opportunities', 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.wistx.ai/v1/cost/optimization-opportunities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.wistx.ai/v1/cost/optimization-opportunities"
req, _ := http.NewRequest("GET", url, nil)
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.wistx.ai/v1/cost/optimization-opportunities")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/cost/optimization-opportunities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"opportunities": [
{
"provider": "aws",
"service": "EC2",
"resource_type": "t3.large",
"region": "us-east-1",
"current_price": 0.0832,
"optimized_price": 0.0520,
"savings": 0.0312,
"savings_percentage": 37.5,
"optimization_type": "Reserved Instance"
}
],
"total": 1,
"total_potential_savings": 0.0312
}
{
"detail": "Query failed: Database connection error"
}
Cost Search
Get Optimization Opportunities
Get cost optimization opportunities
GET
/
v1
/
cost
/
optimization-opportunities
Get Optimization Opportunities
curl --request GET \
--url https://api.wistx.ai/v1/cost/optimization-opportunitiesimport requests
url = "https://api.wistx.ai/v1/cost/optimization-opportunities"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.wistx.ai/v1/cost/optimization-opportunities', 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.wistx.ai/v1/cost/optimization-opportunities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.wistx.ai/v1/cost/optimization-opportunities"
req, _ := http.NewRequest("GET", url, nil)
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.wistx.ai/v1/cost/optimization-opportunities")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/cost/optimization-opportunities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"opportunities": [
{
"provider": "aws",
"service": "EC2",
"resource_type": "t3.large",
"region": "us-east-1",
"current_price": 0.0832,
"optimized_price": 0.0520,
"savings": 0.0312,
"savings_percentage": 37.5,
"optimization_type": "Reserved Instance"
}
],
"total": 1,
"total_potential_savings": 0.0312
}
{
"detail": "Query failed: Database connection error"
}
Get cost optimization opportunities
Endpoint
GET /v1/cost/optimization-opportunities
curl --request GET \
--url 'https://api.wistx.ai/v1/cost/optimization-opportunities?provider=aws&min_savings_percentage=20.0&limit=50'
import requests
url = "https://api.wistx.ai/v1/cost/optimization-opportunities"
response = requests.get(
url,
params={
"provider": "aws",
"min_savings_percentage": 20.0,
"limit": 50
}
)
data = response.json()
print(f"Found {data['total']} opportunities")
print(f"Total potential savings: ${data['total_potential_savings']}")
const url = "https://api.wistx.ai/v1/cost/optimization-opportunities";
const params = new URLSearchParams({
provider: "aws",
min_savings_percentage: "20.0",
limit: "50"
});
const response = await fetch(`${url}?${params}`);
const data = await response.json();
console.log(`Found ${data.total} opportunities`);
console.log(`Total potential savings: $${data.total_potential_savings}`);
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
)
func main() {
baseURL := "https://api.wistx.ai/v1/cost/optimization-opportunities"
params := url.Values{}
params.Add("provider", "aws")
params.Add("min_savings_percentage", "20.0")
params.Add("limit", "50")
fullURL := baseURL + "?" + params.Encode()
resp, _ := http.Get(fullURL)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("Found %v opportunities\n", result["total"])
fmt.Printf("Total potential savings: $%v\n", result["total_potential_savings"])
}
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.wistx.ai/v1/cost/optimization-opportunities")
params = {
provider: "aws",
min_savings_percentage: 20.0,
limit: 50
}
url.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(url)
data = JSON.parse(response.body)
puts "Found #{data['total']} opportunities"
puts "Total potential savings: $#{data['total_potential_savings']}"
<?php
$url = "https://api.wistx.ai/v1/cost/optimization-opportunities?" . http_build_query([
"provider" => "aws",
"min_savings_percentage" => 20.0,
"limit" => 50
]);
$response = file_get_contents($url);
$data = json_decode($response, true);
echo "Found " . $data['total'] . " opportunities\n";
echo "Total potential savings: $" . $data['total_potential_savings'];
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class GetOptimizationOpportunities {
public static void main(String[] args) throws Exception {
URL url = new URL("https://api.wistx.ai/v1/cost/optimization-opportunities?provider=aws&min_savings_percentage=20.0&limit=50");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
StringBuilder response = new StringBuilder();
String responseLine;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
Gson gson = new Gson();
JsonObject data = gson.fromJson(response.toString(), JsonObject.class);
System.out.println("Found " + data.get("total") + " opportunities");
System.out.println("Total potential savings: $" + data.get("total_potential_savings"));
}
}
Query Parameters
string
Filter by provider (e.g.,
aws, gcp, azure).number
Minimum savings percentage threshold.Default:
20.0integer
Maximum results to return.Minimum: 1
Maximum: 200
Default: 50
Maximum: 200
Default: 50
Response
{
"opportunities": [
{
"provider": "aws",
"service": "EC2",
"resource_type": "t3.large",
"region": "us-east-1",
"current_price": 0.0832,
"optimized_price": 0.0520,
"savings": 0.0312,
"savings_percentage": 37.5,
"optimization_type": "Reserved Instance"
}
],
"total": 1,
"total_potential_savings": 0.0312
}
{
"detail": "Query failed: Database connection error"
}
Rate Limits
This endpoint does not require authentication and is rate-limited per IP address:- Rate Limit: 100 requests per hour per IP
- Burst: 10 requests per minute
Related Endpoints
- Search Costs - Search cost data
- Get Costs by Provider - Get costs by provider
- Compare Costs - Compare costs