> ## 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.

# API Reference

> WISTX REST API documentation for programmatic access

Welcome to the WISTX REST API documentation. The WISTX API provides programmatic access to compliance requirements, infrastructure pricing, knowledge research, and indexing capabilities.

## Base URL

```
https://api.wistx.ai
```

## Authentication

All API endpoints require authentication using Bearer tokens. Include your API key in the `Authorization` header:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

<Warning>
  Keep your API key secure! Never commit it to version control or expose it in client-side code.
</Warning>

## Getting Your API Key

1. Sign up at [wistx.ai/api-key](https://wistx.ai/api-key)
2. Navigate to **API Keys** in your dashboard
3. Create a new API key or use an existing one
4. Copy the key and store it securely

<Info>
  You'll get 3 free index jobs and 50 queries/month to start - no credit card required!
</Info>

## API Endpoints

### Compliance & Security

<CardGroup cols={2}>
  <Card title="Get Compliance Requirements" icon="shield-check" href="/api-reference/compliance">
    Get compliance requirements for infrastructure resources. Supports PCI-DSS, HIPAA, CIS, SOC2, NIST, ISO 27001, GDPR, FedRAMP, and more.
  </Card>
</CardGroup>

### Knowledge & Research

<CardGroup cols={2}>
  <Card title="Research Knowledge Base" icon="book" href="/api-reference/knowledge">
    Deep research tool for DevOps, infrastructure, compliance, FinOps, and platform engineering knowledge.
  </Card>
</CardGroup>

### Search

<CardGroup cols={2}>
  <Card title="Search Codebase" icon="code" href="/api-reference/search/codebase">
    Search your indexed repositories, documentation, and documents using natural language queries.
  </Card>

  <Card title="Search Code Examples" icon="code-branch" href="/api-reference/code-examples">
    Search infrastructure code examples from curated repositories. Supports 32+ code types (Terraform, Kubernetes, Docker, CI/CD, etc.) with filtering by cloud provider, services, quality score, and compliance standards.
  </Card>

  <Card title="Search Packages" icon="package" href="/api-reference/search/packages">
    Search DevOps/infrastructure packages across registries (PyPI, npm, Terraform, Crates.io, Go, Helm, Ansible, Maven, NuGet, RubyGems).
  </Card>

  <Card title="Regex Search" icon="search" href="/api-reference/search/regex">
    Search codebase using regex patterns with pre-built templates for security audits, compliance checks, and code analysis.
  </Card>

  <Card title="Web Search" icon="globe" href="/api-reference/search/web">
    Search the web for DevOps/infrastructure/compliance/FinOps/SRE information. Supports general web search and security-focused searches (CVEs, advisories).
  </Card>

  <Card title="Read Package File" icon="file-code" href="/api-reference/search/read-package-file">
    Read specific file sections from package source code using SHA256 hash. Fetches packages on-demand from registries.
  </Card>
</CardGroup>

### Indexing

<CardGroup cols={2}>
  <Card title="Index Resources" icon="github" href="/api-reference/indexing">
    Index GitHub repositories, documentation websites, and documents for user-specific search. Includes cost and compliance analysis.
  </Card>
</CardGroup>

### Cost & FinOps

<CardGroup cols={2}>
  <Card title="Calculate Infrastructure Cost" icon="calculator" href="/api-reference/pricing/calculate">
    Calculate infrastructure costs for cloud resources. Get monthly/annual costs, cost breakdowns, and optimization suggestions for AWS, GCP, and Azure resources.
  </Card>

  <Card title="Cost Search" icon="search" href="/api-reference/cost-search">
    Search infrastructure pricing data using semantic search. Find costs for AWS, GCP, and Azure resources. Compare costs and get optimization opportunities.
  </Card>
</CardGroup>

### Infrastructure Budget

<CardGroup cols={2}>
  <Card title="Infrastructure Budget" icon="wallet" href="/api-reference/budget">
    Create, manage, and track infrastructure spending budgets. Monitor spending, set alerts, and track budget status.
  </Card>
</CardGroup>

### Architecture & Infrastructure

<CardGroup cols={2}>
  <Card title="Design Architecture" icon="diagram-project" href="/api-reference/architecture/design">
    Design and initialize DevOps/infrastructure/SRE/platform engineering projects with intelligent context.
  </Card>

  <Card title="Infrastructure Management" icon="server" href="/api-reference/infrastructure">
    Get infrastructure inventory and manage infrastructure lifecycle (create, update, upgrade, backup, restore, monitor, optimize).
  </Card>

  <Card title="Cloud Discovery" icon="cloud" href="/api-reference/cloud-discovery">
    Discover existing cloud resources from AWS accounts and generate Terraform import context. Secure cross-account access with dependency resolution, import order, and infrastructure diagrams.
  </Card>
</CardGroup>

### Troubleshooting

<CardGroup cols={2}>
  <Card title="Troubleshoot Issue" icon="wrench" href="/api-reference/troubleshoot">
    Diagnose and fix infrastructure/code issues. Analyzes errors, logs, and code to identify root causes and provide fix recommendations.
  </Card>
</CardGroup>

### Reports & Health

<CardGroup cols={2}>
  <Card title="Reports" icon="file-document" href="/api-reference/reports">
    Generate documentation and reports in various formats (markdown, HTML, PDF, DOCX).
  </Card>

  <Card title="Alerts" icon="bell" href="/api-reference/alerts">
    Manage budget alerts and notification preferences.
  </Card>

  <Card title="Health" icon="heartbeat" href="/api-reference/health">
    Check API health status.
  </Card>
</CardGroup>

## Response Format

All API responses follow a consistent format:

```json theme={null}
{
  "data": {
    // Response data
  },
  "metadata": {
    "request_id": "req_abc123",
    "timestamp": 1704067200.0,
    "query_time_ms": 234
  }
}
```

### Success Response

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "data": {
      // Response data
    },
    "metadata": {
      "request_id": "req_abc123",
      "timestamp": 1704067200.0
    }
  }
  ```
</ResponseExample>

### Error Response

<ResponseExample>
  ```json 400 Bad Request theme={null}
  {
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "Invalid request parameters",
      "details": {
        "field": "resource_types",
        "reason": "At least one resource type is required"
      }
    },
    "metadata": {
      "request_id": "req_abc123",
      "timestamp": 1704067200.0
    }
  }
  ```
</ResponseExample>

## Rate Limits

Rate limits vary by plan:

| Plan | Queries/Month | Index Jobs/Month |
| - | - | - |
| Professional | 2,000 | 5 |
| Team | 10,000 | 10 |
| Enterprise | Unlimited | Unlimited |

Rate limit information is included in response headers:

* `X-RateLimit-Limit`: Maximum requests allowed
* `X-RateLimit-Remaining`: Remaining requests
* `X-RateLimit-Reset`: Unix timestamp when limit resets

## HTTP Status Codes

| Code | Description |
| - | - |
| `200` | Success |
| `201` | Created |
| `202` | Accepted (async operation started) |
| `400` | Bad Request - Invalid parameters |
| `401` | Unauthorized - Invalid or missing API key |
| `403` | Forbidden - Insufficient permissions |
| `404` | Not Found - Resource not found |
| `429` | Too Many Requests - Rate limit exceeded |
| `500` | Internal Server Error |
| `503` | Service Unavailable |

## Error Codes

| Code | Description |
| - | - |
| `VALIDATION_ERROR` | Request validation failed |
| `UNAUTHORIZED` | Invalid or missing API key |
| `QUOTA_EXCEEDED` | Rate limit or quota exceeded |
| `RESOURCE_NOT_FOUND` | Requested resource not found |
| `INTERNAL_ERROR` | Internal server error |
| `SERVICE_UNAVAILABLE` | Service temporarily unavailable |

## Pagination

Some endpoints support pagination using query parameters:

* `page`: Page number (default: 1)
* `per_page`: Items per page (default: 20, max: 100)

Paginated responses include pagination metadata:

```json theme={null}
{
  "data": [...],
  "pagination": {
    "page": 1,
    "per_page": 20,
    "total": 150,
    "total_pages": 8
  }
}
```

## SDKs

Official SDKs are available for popular languages:

* **Python**: `pip install wistx-sdk`
* **JavaScript/TypeScript**: `npm install @wistx/sdk`
* **Go**: `go get github.com/wistx/sdk-go`

<Card title="SDK Documentation" icon="code" href="/resources/sdks">
  View SDK documentation and examples
</Card>

## OpenAPI Specification

The complete OpenAPI specification is available:

<Card title="OpenAPI Spec" icon="file-code" href="/api-reference/openapi.json">
  View the complete OpenAPI specification
</Card>

## Support

Need help? We're here for you:

* **Documentation**: [docs.wistx.ai](https://docs.wistx.ai)
* **Support**: [support.wistx.ai](https://support.wistx.ai)
* **Status**: [status.wistx.ai](https://status.wistx.ai)
* **Discord Community**: [discord.gg/ZVGK5Fv3wT](https://discord.gg/ZVGK5Fv3wT) - Join for real-time support and discussions
* **GitHub**: [github.com/WISTXHQ/wistx-model](https://github.com/WISTXHQ/wistx-model) - Report issues and contribute

## Quick Start

<Steps>
  <Step title="Get Your API Key">
    Sign up at [wistx.ai/api-key](https://wistx.ai/api-key) and get your API key.
  </Step>

  <Step title="Make Your First Request">
    Try the compliance requirements endpoint:

    ```bash theme={null}
    curl --request POST \
      --url https://api.wistx.ai/v1/compliance/requirements \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --header 'Content-Type: application/json' \
      --data '{
        "resource_types": ["RDS"],
        "standards": ["PCI-DSS"]
      }'
    ```
  </Step>

  <Step title="Explore the API">
    Check out the [API endpoints](/api-reference/compliance) for detailed documentation and examples.
  </Step>
</Steps>


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