Get Costs by Provider
curl --request GET \
--url https://api.wistx.ai/v1/cost/by-provider/{provider}import requests
url = "https://api.wistx.ai/v1/cost/by-provider/{provider}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.wistx.ai/v1/cost/by-provider/{provider}', 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/by-provider/{provider}",
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/by-provider/{provider}"
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/by-provider/{provider}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/cost/by-provider/{provider}")
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{
"provider": "aws",
"total": 5000,
"count": 100,
"offset": 0,
"limit": 100,
"results": [
{
"provider": "aws",
"service_name": "EC2",
"resource_type": "t3.micro",
"region_id": "us-east-1",
"list_unit_price": 0.0104,
"billing_currency": "USD",
"pricing_unit": "hour",
"pricing_category": "OnDemand"
}
]
}
{
"detail": "Query failed: Database connection error"
}
Cost Search
Get Costs by Provider
Get costs by provider with optional filters
GET
/
v1
/
cost
/
by-provider
/
{provider}
Get Costs by Provider
curl --request GET \
--url https://api.wistx.ai/v1/cost/by-provider/{provider}import requests
url = "https://api.wistx.ai/v1/cost/by-provider/{provider}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.wistx.ai/v1/cost/by-provider/{provider}', 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/by-provider/{provider}",
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/by-provider/{provider}"
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/by-provider/{provider}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wistx.ai/v1/cost/by-provider/{provider}")
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{
"provider": "aws",
"total": 5000,
"count": 100,
"offset": 0,
"limit": 100,
"results": [
{
"provider": "aws",
"service_name": "EC2",
"resource_type": "t3.micro",
"region_id": "us-east-1",
"list_unit_price": 0.0104,
"billing_currency": "USD",
"pricing_unit": "hour",
"pricing_category": "OnDemand"
}
]
}
{
"detail": "Query failed: Database connection error"
}
Get costs by provider with optional filters
Endpoint
GET /v1/cost/by-provider/{provider}
curl --request GET \
--url 'https://api.wistx.ai/v1/cost/by-provider/aws?region=us-east-1&service_category=compute&limit=100&offset=0'
import requests
url = "https://api.wistx.ai/v1/cost/by-provider/aws"
response = requests.get(
url,
params={
"region": "us-east-1",
"service_category": "compute",
"limit": 100,
"offset": 0
}
)
data = response.json()
print(f"Found {data['count']} of {data['total']} results")
const url = "https://api.wistx.ai/v1/cost/by-provider/aws";
const params = new URLSearchParams({
region: "us-east-1",
service_category: "compute",
limit: "100",
offset: "0"
});
const response = await fetch(`${url}?${params}`);
const data = await response.json();
console.log(`Found ${data.count} of ${data.total} results`);
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
)
func main() {
baseURL := "https://api.wistx.ai/v1/cost/by-provider/aws"
params := url.Values{}
params.Add("region", "us-east-1")
params.Add("service_category", "compute")
params.Add("limit", "100")
params.Add("offset", "0")
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 of %v results\n", result["count"], result["total"])
}
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.wistx.ai/v1/cost/by-provider/aws")
params = {
region: "us-east-1",
service_category: "compute",
limit: 100,
offset: 0
}
url.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(url)
data = JSON.parse(response.body)
puts "Found #{data['count']} of #{data['total']} results"
<?php
$url = "https://api.wistx.ai/v1/cost/by-provider/aws?" . http_build_query([
"region" => "us-east-1",
"service_category" => "compute",
"limit" => 100,
"offset" => 0
]);
$response = file_get_contents($url);
$data = json_decode($response, true);
echo "Found " . $data['count'] . " of " . $data['total'] . " results";
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 GetCostsByProvider {
public static void main(String[] args) throws Exception {
URL url = new URL("https://api.wistx.ai/v1/cost/by-provider/aws?region=us-east-1&service_category=compute&limit=100&offset=0");
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("count") + " of " + data.get("total") + " results");
}
}
Path Parameters
string
required
Cloud provider.Options:
aws, gcp, azure, oracle, alibabaQuery Parameters
string
Filter by region (e.g.,
us-east-1, eu-west-1).string
Filter by service category (e.g.,
compute, storage, networking).integer
Maximum results to return.Minimum: 1
Maximum: 1000
Default: 100
Maximum: 1000
Default: 100
integer
Pagination offset.Minimum: 0
Default: 0
Default: 0
Response
{
"provider": "aws",
"total": 5000,
"count": 100,
"offset": 0,
"limit": 100,
"results": [
{
"provider": "aws",
"service_name": "EC2",
"resource_type": "t3.micro",
"region_id": "us-east-1",
"list_unit_price": 0.0104,
"billing_currency": "USD",
"pricing_unit": "hour",
"pricing_category": "OnDemand"
}
]
}
{
"detail": "Query failed: Database connection error"
}
Related Endpoints
- Search Costs - Search cost data
- Compare Costs - Compare costs
- Get Optimization Opportunities - Find optimization opportunities