# Calculate a cost forecast

`POST https://cost-explorer.public.global.vexxhost.net/v1/cost_forecasts`

Projects the trailing daily average over a future period, up to 90 days. The result is an estimate.

Authentication: `X-Auth-Token: <token>` header or `Authorization: Bearer <token>` header. See https://docs.vexxhost.com/identity/authentication.md.

## Request body (application/json)

- `allow_partial` (boolean): When a region does not answer, forecast from the regions that did and list the rest in missing_regions, instead of failing the forecast.
- `filter` (object)
  - `project_ids` (array of string, nullable)
  - `regions` (array of string, nullable)
  - `services` (array of string, one of `compute`, `volume`, `image`, `object`, nullable)
  - `usage_types` (array of string, nullable)
- `granularity` (string, one of `daily`, `monthly`, required)
- `lookback_days` (integer, int64)
- `metric` (string, one of `cost`)
- `time_period` (object, required)
  - `end` (string, date-time, required): Exclusive interval end (RFC3339).
  - `start` (string, date-time, required): Inclusive UTC interval start (RFC3339).

## Responses

### 200 — OK

`application/json`:

- `as_of` (string, date-time, required)
- `estimated` (boolean, required)
- `forecast_results_by_time` (array of object, nullable, required)
  - `mean_value` (string, required)
  - `time_period` (object, required)
    - `end` (string, date-time, required): Exclusive interval end (RFC3339).
    - `start` (string, date-time, required): Inclusive UTC interval start (RFC3339).
- `history_period` (object, required)
  - `end` (string, date-time, required): Exclusive interval end (RFC3339).
  - `start` (string, date-time, required): Inclusive UTC interval start (RFC3339).
- `missing_regions` (array of string, nullable): Regions left out of an allow_partial forecast because they did not answer.
- `model` (string, required)
- `regions` (array of object, nullable): The regions the history covers and how far each one's data is complete.
  - `data_through` (string, date-time, required)
  - `name` (string, required)
- `total` (object, required)
  - `amount` (string, required)
  - `unit` (string, required)

### 400 — Bad Request

`application/problem+json`:

- `detail` (string): A human-readable explanation specific to this occurrence of the problem. Example: `Property foo is required but is missing.`.
- `errors` (array of object, nullable): Optional list of individual error details
  - `location` (string): Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
  - `message` (string): Error message text
  - `value` (object): The value at the given location
- `instance` (string, uri): A URI reference that identifies the specific occurrence of the problem. Example: `https://example.com/error-log/abc123`.
- `status` (integer, int64): HTTP status code Example: `400`.
- `title` (string): A short, human-readable summary of the problem type. This value should not change between occurrences of the error. Example: `Bad Request`.
- `type` (string, uri): A URI reference to human-readable documentation for the error. Example: `https://example.com/errors/example`.

### 401 — Unauthorized

Same `application/problem+json` body as 400.

### 403 — Forbidden

Same `application/problem+json` body as 400.

### 413 — Request Entity Too Large

Same `application/problem+json` body as 400.

### 422 — Unprocessable Entity

Same `application/problem+json` body as 400.

### 429 — Too Many Requests

Same `application/problem+json` body as 400.

### 500 — Internal Server Error

Same `application/problem+json` body as 400.

### 503 — Service Unavailable

Same `application/problem+json` body as 400.

### 504 — Gateway Timeout

Same `application/problem+json` body as 400.

Full schema: https://docs.vexxhost.com/cost-explorer/openapi.json
