# Coremarket API

> Get VM sizes and price quotes from Coremarket over HTTP.

- Web page: https://documentation.federated.computer/developer-tools/coremarket/api/

Everything Coremarket shows in its web app is also available as a JSON API at `http://localhost:8999/api/v1`.

## Authenticate

Create an API key in Coremarket. Keys look like `cmk_<8 characters>_<secret>`. Send it in either header:

```
X-API-Key: cmk_...
Authorization: Bearer cmk_...
```

## Get a quote

This asks for the five cheapest options for the Good preset in Europe, with GDPR compliance, and latency to Paris and Berlin, showing only the best option at each provider:

```
curl -s -H "X-API-Key: $KEY" \
  "http://localhost:8999/api/v1/quote?tier=good&continent=europe&compliance=gdpr&cities=par,ber&best_per_provider=true&limit=5"
```

## Endpoints

| Endpoint | Returns |
|---|---|
| `/quote` | Priced VM options for a set of applications or a preset |
| `/size` | The CPU, memory, and disk a set of applications needs, without prices |
| `/apps` | The applications Coremarket can size |
| `/tiers` | The presets (Base, Good, Better, Best) |
| `/providers` | The cloud providers |
| `/regions` | Their regions, with compliance |
| `/cities` | The cities latency can be estimated to |
| `/latency/measure` | Measures latency to a region |
| `/prices/refresh` | Refreshes live prices |

The full reference, with every parameter, is built into Coremarket at `/docs` (or `/redoc`). The OpenAPI description is at `/openapi.json`, and `/healthz` reports whether it's running.
