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

# Get Optimization Opportunities

> Get cost optimization opportunities

> Get cost optimization opportunities

### Endpoint

`GET /v1/cost/optimization-opportunities`

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.wistx.ai/v1/cost/optimization-opportunities?provider=aws&min_savings_percentage=20.0&limit=50'
  ```

  ```python Python theme={null}
  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']}")
  ```

  ```javascript JavaScript theme={null}
  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}`);
  ```

  ```go Go theme={null}
  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"])
  }
  ```

  ```ruby Ruby theme={null}
  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 PHP theme={null}
  <?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'];
  ```

  ```java Java theme={null}
  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"));
      }
  }
  ```
</CodeGroup>

### Query Parameters

<ParamField query="provider" type="string">
  Filter by provider (e.g., `aws`, `gcp`, `azure`).
</ParamField>

<ParamField query="min_savings_percentage" type="number">
  Minimum savings percentage threshold.

  **Default:** `20.0`
</ParamField>

<ParamField query="limit" type="integer">
  Maximum results to return.

  **Minimum:** 1\
  **Maximum:** 200\
  **Default:** 50
</ParamField>

### Response

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "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
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "detail": "Query failed: Database connection error"
  }
  ```
</ResponseExample>

## 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](/api-reference/cost-search/search) - Search cost data
* [Get Costs by Provider](/api-reference/cost-search/by-provider) - Get costs by provider
* [Compare Costs](/api-reference/cost-search/compare) - Compare costs


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.