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

# Explorer

# Explorer API Reference

Explore cloud infrastructure, pricing, and instance insights across multiple providers with the Explorer API. Get detailed information about available resources and optimize your infrastructure decisions.

## Endpoints Overview

| Method | Endpoint                             | Description               |
| ------ | ------------------------------------ | ------------------------- |
| GET    | `/api/explorer/check-credentials`    | Check credential validity |
| GET    | `/api/explorer/spot-pricing-history` | Get spot pricing history  |
| GET    | `/api/explorer/instance-insights`    | Get instance insights     |
| POST   | `/api/explorer/clear-cache`          | Clear explorer cache      |

## Credential Management

### Check Credential Validity

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
GET /api/explorer/check-credentials?provider=AWS
```

**Query Parameters:**

* `provider` (required): Cloud provider (AWS, Azure, GCP, DigitalOcean)

**Response:**

```json theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
{
  "success": true,
  "data": true
}
```

## Pricing Exploration

### Get Spot Pricing History

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
GET /api/explorer/spot-pricing-history?provider=AWS&instanceType=t2.micro&region=us-east-1&os=linux&timeRange=7d
```

**Query Parameters:**

* `provider` (required): Cloud provider
* `instanceType` (required): Instance type
* `region` (required): Cloud region
* `os` (optional): Operating system (default: linux)
* `timeRange` (optional): Time range (7d, 30d, 90d, 1y)

**Response:**

```json theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
{
  "success": true,
  "data": {
    "provider": "AWS",
    "instanceType": "t2.micro",
    "region": "us-east-1",
    "timeRange": "7d",
    "prices": [
      {
        "timestamp": "2024-01-15T10:30:00Z",
        "price": 0.0032,
        "availabilityZone": "us-east-1a"
      },
      {
        "timestamp": "2024-01-15T10:00:00Z",
        "price": 0.0035,
        "availabilityZone": "us-east-1b"
      }
    ],
    "statistics": {
      "average": 0.0034,
      "min": 0.0031,
      "max": 0.0038,
      "current": 0.0032
    }
  }
}
```

## Instance Insights

### Get Instance Insights

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
GET /api/explorer/instance-insights?provider=AWS&instanceType=t2.micro&region=us-east-1
```

**Query Parameters:**

* `provider` (required): Cloud provider
* `instanceType` (required): Instance type
* `region` (required): Cloud region

**Response:**

```json theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
{
  "success": true,
  "data": {
    "provider": "AWS",
    "instanceType": "t2.micro",
    "region": "us-east-1",
    "hardwareSpecs": {
      "vcpus": 1,
      "memoryGb": 1.0,
      "storage": "EBS only",
      "networkPerformance": "Low to Moderate",
      "architecture": "x86_64"
    },
    "pricingInfo": {
      "onDemand": 0.0116,
      "spot": 0.0035,
      "reserved1Year": 0.0067,
      "reserved3Year": 0.0045
    },
    "comparisons": [
      {
        "instanceType": "t2.small",
        "vcpus": 1,
        "memoryGb": 2.0,
        "price": 0.023,
        "priceDifference": "+98%"
      },
      {
        "instanceType": "t3.micro",
        "vcpus": 2,
        "memoryGb": 1.0,
        "price": 0.0104,
        "priceDifference": "-10%"
      }
    ],
    "recommendations": [
      {
        "type": "cost-optimization",
        "message": "Consider t3.micro for better price-performance ratio",
        "savings": "10%"
      },
      {
        "type": "performance",
        "message": "Upgrade to t3.small for better CPU performance",
        "improvement": "40%"
      }
    ]
  }
}
```

## Cache Management

### Clear Explorer Cache

```bash theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
POST /api/explorer/clear-cache
```

**Response:**

```json theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
{
  "success": true,
  "message": "Cache cleared successfully"
}
```

## Error Responses

```json theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
{
  "success": false,
  "error": "Invalid provider",
  "details": {
    "provider": "invalid-provider",
    "validProviders": ["AWS", "Azure", "GCP", "DigitalOcean"]
  }
}
```

```json theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
{
  "success": false,
  "error": "Instance type not found",
  "details": {
    "provider": "AWS",
    "region": "us-east-1",
    "instanceType": "invalid-type"
  }
}
```

## Best Practices

### Cost Optimization

* Use spot pricing history to identify cost-saving opportunities
* Compare instance types across providers
* Consider reserved instances for predictable workloads
* Monitor pricing trends over time

### Performance Analysis

* Use instance insights to compare performance characteristics
* Consider CPU, memory, and network requirements
* Evaluate different instance families for specific workloads
* Monitor actual performance vs. specifications

### Data Freshness

* Explorer data is cached for performance
* Use clear-cache endpoint when you need fresh data
* Consider caching strategies for your applications
* Monitor cache hit rates and performance

For detailed schema definitions, refer to the OpenAPI specification published alongside the backend service.
