> ## 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 Infrastructure Inventory

> Get existing infrastructure context for coding agents

Get existing infrastructure context for coding agents, including resources, costs, and compliance status.

<ParamField query="repository_url" type="string">
  GitHub repository URL
</ParamField>

<ParamField query="environment_name" type="string">
  Environment name (dev, stage, prod, etc.)
</ParamField>

<ParamField query="inventory_id" type="string">
  Inventory ID
</ParamField>

<ParamField query="include_compliance" type="boolean" default="true">
  Include compliance status
</ParamField>

<ParamField query="include_costs" type="boolean" default="true">
  Include cost information
</ParamField>

## Request Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.wistx.ai/v1/infrastructure/inventory?repository_url=https://github.com/myorg/infrastructure&include_compliance=true&include_costs=true" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.wistx.ai/v1/infrastructure/inventory"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY"
  }
  params = {
      "repository_url": "https://github.com/myorg/infrastructure",
      "include_compliance": True,
      "include_costs": True
  }

  response = requests.get(url, params=params, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = new URL("https://api.wistx.ai/v1/infrastructure/inventory");
  url.searchParams.append("repository_url", "https://github.com/myorg/infrastructure");
  url.searchParams.append("include_compliance", "true");
  url.searchParams.append("include_costs", "true");

  const response = await fetch(url, {
    headers: {
      "Authorization": "Bearer YOUR_API_KEY"
    }
  });

  const data = await response.json();
  console.log(data);
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "net/url"
  )

  func main() {
      baseURL := "https://api.wistx.ai/v1/infrastructure/inventory"
      u, _ := url.Parse(baseURL)
      q := u.Query()
      q.Set("repository_url", "https://github.com/myorg/infrastructure")
      q.Set("include_compliance", "true")
      q.Set("include_costs", "true")
      u.RawQuery = q.Encode()
      
      req, _ := http.NewRequest("GET", u.String(), nil)
      req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
      
      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()
  }
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'uri'

  uri = URI('https://api.wistx.ai/v1/infrastructure/inventory')
  params = {
    repository_url: "https://github.com/myorg/infrastructure",
    include_compliance: true,
    include_costs: true
  }
  uri.query = URI.encode_www_form(params)

  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Get.new(uri)
  request['Authorization'] = 'Bearer YOUR_API_KEY'

  response = http.request(request)
  puts response.body
  ```

  ```php PHP theme={null}
  <?php

  $url = "https://api.wistx.ai/v1/infrastructure/inventory";
  $params = [
      "repository_url" => "https://github.com/myorg/infrastructure",
      "include_compliance" => true,
      "include_costs" => true
  ];

  $ch = curl_init($url . "?" . http_build_query($params));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer YOUR_API_KEY"
  ]);

  $response = curl_exec($ch);
  curl_close($ch);
  echo $response;
  ```

  ```java Java theme={null}
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;
  import java.net.URI;

  HttpClient client = HttpClient.newHttpClient();
  String url = "https://api.wistx.ai/v1/infrastructure/inventory?repository_url=https://github.com/myorg/infrastructure&include_compliance=true&include_costs=true";

  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create(url))
      .header("Authorization", "Bearer YOUR_API_KEY")
      .GET()
      .build();

  HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
  System.out.println(response.body());
  ```
</CodeGroup>

## Response Example

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "data": {
      "repository_url": "https://github.com/myorg/infrastructure",
      "environment_name": "prod",
      "status": "indexed",
      "resource_id": "res_xyz789",
      "resources": [
        {
          "resource_type": "aws_rds_instance",
          "name": "main-db",
          "monthly_cost": 150.0,
          "service": "rds"
        }
      ],
      "resources_count": 15,
      "total_monthly_cost": 2500.0,
      "total_annual_cost": 30000.0,
      "cost_breakdown": {
        "by_service": {
          "rds": 150.0,
          "ec2": 2000.0,
          "s3": 350.0
        }
      },
      "cost_optimizations": [
        {
          "type": "reserved_instances",
          "potential_savings": 500.0
        }
      ],
      "compliance_summary": {
        "PCI-DSS": {
          "compliant_count": 40,
          "non_compliant_count": 5,
          "compliance_rate": 88.9
        }
      },
      "compliance_status": "partial",
      "recommendations": [
        "Consider cost optimization - current spending: $2500.00/month",
        "Review partial compliance issues"
      ],
      "context_for_agents": "Existing Infrastructure Context:\n\n- Total Resources: 15\n- Monthly Cost: $2500.00\n\nCompliance Status:\n- PCI-DSS: 88.9% compliant (40/45)\n\nRecommendations:\n- Consider cost optimization - current spending: $2500.00/month\n- Review partial compliance issues"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123,
      "query_time_ms": 320
    }
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "Invalid request parameters",
      "details": "repository_url or inventory_id is required"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "error": {
      "code": "UNAUTHORIZED",
      "message": "Invalid or expired token"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```

  ```json 429 Too Many Requests theme={null}
  {
    "error": {
      "code": "QUOTA_EXCEEDED",
      "message": "Query quota exceeded",
      "details": {
        "limit_type": "queries_per_month",
        "current": 1000,
        "limit": 1000
      }
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "error": {
      "code": "INTERNAL_ERROR",
      "message": "An unexpected error occurred"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```

  ```json 503 Service Unavailable theme={null}
  {
    "error": {
      "code": "DATABASE_ERROR",
      "message": "Database connection failed"
    },
    "metadata": {
      "request_id": "req_123",
      "timestamp": 1234567890.123
    }
  }
  ```
</ResponseExample>

## Rate Limits

* **Professional**: 2,000 queries/month
* **Team**: 10,000 queries/month
* **Enterprise**: Unlimited queries/month


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