# API keys and REST examples

Create a Pro API key and call the Wattlas REST endpoints or headless MCP server.

Source: https://docs.wattlas.io/agents/api-keys-and-rest-examples/

## Create a key

1. Sign in on a Pro account in the browser.
2. Open Account, then API keys.
3. Press Create a key (or New key), give it a name up to 60 characters and copy it.

Keys start with `wlt_` followed by 48 hex characters. An account can hold up to 10 active keys. API keys cannot create or revoke other keys, access billing or call Ask Wattlas. You can still view and revoke existing keys on the Account page after Pro ends.

## Authenticate

As a bearer token:

```
curl -H "Authorization: Bearer wlt_..." https://app.wattlas.io/api/projects
```

Or in the `X-API-Key` header:

```
curl -H "X-API-Key: wlt_..." https://app.wattlas.io/api/projects
```

The same key also works as `Authorization: Bearer wlt_...` against the MCP server at `https://app.wattlas.io/mcp`.

## Endpoints

All read endpoints below require an active Pro API key (or Pro browser session).

| Endpoint | What it returns |
| --- | --- |
| `GET /api/projects` | Paginated campuses matching the filters below, plus aggregate counts and `mw_total` |
| `GET /api/projects/{id}` | Full record for one campus (accepts canonical `c_...` id or public page slug; counts toward detail budget) |
| `GET /api/map` | Coordinates, stage, tier, precision and MW for matching campuses with a map pin |
| `GET /api/metros` | All US metro power-market profiles (optional `?state=VA`) |
| `GET /api/metros/{id}` | One metro profile by metro id (for example `northern_virginia`) |
| `GET /api/changes` | Dated non-tracker records, newest first (supports `state`, `moved=1`, `kind`, `watch=1`, `page`, `per`) |
| `GET /api/overview` | Default Pipeline aggregates by stage, state, owner, risk, resource use, aerial phase and tax incentives |
| `GET /api/facets` | Filter counts for states, stages, owners and aerial phases in the active scope |
| `GET /api/watchlist` | Campuses currently on the account's watchlist |
| `GET /api/export.csv` | Matching campuses as formula-safe CSV (`wattlas-projects.csv`, max 2,000 rows per export) |
| `POST /api/feedback` | Submit a `bug` or `inaccuracy` report (`kind`, `message`, optional `project_id`, `path`; 20/UTC day) |

## Filters for /api/projects, /api/map and /api/export.csv

| Parameter | Values |
| --- | --- |
| `state` | One or more comma-separated two-letter codes (for example `VA,TX`) |
| `stage` | One or more comma-separated stages (`listed`, `announced`, `zoning_filed`, `zoning_approved`, `site_permit`, `building_permit`, `construction`, `operating`, `withdrawn`) |
| `tier` | `verified`, `single` or `lead` (comma-separated) |
| `mw_min`, `mw_max` | Numbers in MW; matches when the campus range overlaps yours |
| `owner` | Exact owner name (case-insensitive) |
| `q` | Search text across name, aliases, owner, land owner and county |
| `opposition` | `1` for campuses with any opposition record |
| `water` | `high` for High or Extremely High water stress |
| `aerial` | Comma-separated: `greenfield_undeveloped`, `active_grading_pad`, `shell_under_construction`, `completed_dc_campus` or `ahead` |
| `resource` | `water` or `power` for campuses with a disclosed figure |
| `id` | Comma-separated campus ids (redirects resolved automatically) |
| `watching` | `1` for watched campuses only |
| `show` | `operating` or `unconfirmed` (omit for Pipeline) |
| `all` | `1` to drop the default solid evidence test in Pipeline |
| `include_leads` | `1` to include unconfirmed leads alongside Pipeline |
| `sort` | `date`, `mw` or `name` (`/api/projects` and `/api/export.csv`) |
| `dir` | `asc` or `desc` |
| `page` | Positive integer page number (`/api/projects`, default 1) |
| `per` | Integer 1 to 200 (`/api/projects`, default 50) |

## Examples

Filter construction campuses in Virginia sorted by capacity:

```
curl -H "Authorization: Bearer wlt_..." \
  "https://app.wattlas.io/api/projects?state=VA&stage=construction&sort=mw&per=20"
```

```
{ "total", "total_all", "mw_total", "with_mw", "items": [ ... ] }
```

Fetch one campus by id or public slug:

```
curl -H "Authorization: Bearer wlt_..." \
  "https://app.wattlas.io/api/projects/c_5cda962849"
```

Export a filtered slice as CSV (cells starting with `=`, `+`, `-` or `@` are prefixed with `'` for spreadsheet safety):

```
curl -H "Authorization: Bearer wlt_..." \
  -o tx-construction.csv \
  "https://app.wattlas.io/api/export.csv?state=TX&stage=construction"
```

## Errors

| Status | Meaning |
| --- | --- |
| `400` | Invalid filter value, unknown stage/tier, or export over 2,000 rows |
| `401` | Missing, revoked or unknown API key |
| `402` | The account does not have an active Pro plan |
| `404` | Campus or metro not found |
| `429` | Daily or 30-day detail/export/report budget reached |

See [Limits and quotas](/agents/limits-and-quotas/) for exact daily and 30-day budgets, including bulk access under Team and data.

## What to watch for

An API key is shown once, when you create it. Store it like a password; if it leaks, revoke it on the Account page and create a new one.
