---
title: "Validate infrastructure against a traffic forecast"
method: POST
path: "/predictions/validate"
tags: ["Optimize & Predict"]
---

# Validate infrastructure against a traffic forecast

`POST /predictions/validate`

## Request

- Base URL: `https://www.cloudworldmodel.ai/api`
- URL: `https://www.cloudworldmodel.ai/api/predictions/validate`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-PAYMENT`
  - API key in header `PAYMENT-SIGNATURE`

Tests whether current infrastructure can handle a predicted traffic pattern.
Returns validation results with bottlenecks and recommendations.

When a `webhookUrl` is provided, the following payload is POSTed to that URL
when the job completes (example shown for the AWS EC2 validation request above):

```json
{
  "event": "prediction.completed",
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "jobType": "prediction_validation",
  "status": "completed",
  "completedAt": "2025-11-23T10:35:00Z",
  "data": {
    "validationResult": {
      "passed": false,
      "summary": "Infrastructure will fail under peak load due to CPU saturation",
      "peakMetrics": {
        "timestamp": 60,
        "traffic": 12000,
        "cpuUsage": 98,
        "latencyP95": 820,
        "errorRate": 8.4,
        "costPerHour": 3.20
      },
      "bottlenecksDetected": [
        "CPU saturation at 98%",
        "Error rate exceeds 5%"
      ],
      "failurePoints": [
        { "timestamp": 55, "traffic": 10500, "reason": "CPU saturation" }
      ],
      "recommendations": [
        "Scale out to 5 instances before peak",
        "Increase CPU threshold to 75%"
      ]
    }
  }
}
```

The request is signed with HMAC-SHA256; verify the `X-Webhook-Signature` header
against your `webhookSecret` before processing the payload.

## Request body

- object
  - `simulationId` string, required: ID of simulation to test
  - `trafficForecast` object, required
    - `name` string, required: Name of the traffic forecast
    - `description` string: Optional description
    - `dataPoints` object[], required: Traffic data points over time
      - `timestamp` number, required: Time offset from the start of the forecast, in simulation steps; points must be ordered by increasing timestamps.
      - `rps` number, required: Forecast request rate in requests per second at this timestamp.
      - `label` string
    - `peakRPS` number: Peak requests per second
    - `avgRPS` number: Average requests per second
  - `testSteps` integer: Number of simulation steps to run
  - `webhookUrl` string, uri: Optional HTTPS URL to receive webhook notification when job completes
  - `webhookSecret` string: Optional secret for HMAC-SHA256 webhook signature verification

## Response `202`

Validation job accepted

- object
  - `job` object
    - `id` string, uuid
    - `status` 'pending' | 'running'
    - `type` string
    - `createdAt` string, date-time
  - `message` string

## Other responses

- `400`: Invalid request data — structured field-level error
- `401`: Authentication required or invalid API key
- `402`: Payment required — the endpoint is metered and no API key was provided. The response body follows the [x402 v2 protocol](https://x402.org) and describes one or more USDC payment options that the caller can select before retrying the request. Base is always the first option and uses `X-PAYMENT`. When an `accepts` entry for Solana is present, it is an additional USDC-SPL option that uses `PAYMENT-SIGNATURE` and its `extra.feePayer` value. The server verifies either payment through the PayAI facilitator at `https://facilitator.payai.network`. The `PAYMENT-REQUIRED` response header carries this entire JSON body as a base64-encoded string for protocol-aware clients. Call `GET /api/billing/x402/config` to retrieve the current price table and wallet address and `paymentOptions` before constructing a payment.
- `404`: Resource not found

---

[API](https://skmtc.dev/cloudworldmodel/apis/cloud-world-model-agent-api.md) · [All operations](https://skmtc.dev/cloudworldmodel/apis/cloud-world-model-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cloudworldmodel/apis/cloud-world-model-agent-api/revisions/ecc3ad1ff07f?raw)
