---
title: "Move a WordPress site onto an account key"
method: POST
path: "/site-keys/connect/exchange"
tags: ["System"]
---

# Move a WordPress site onto an account key

`POST /site-keys/connect/exchange`

Second half of connecting a site to an account. The owner picks a key on api.astroway.info/dashboard/connect, which sends the admin back to the site with a one-time `code`; the plugin exchanges it here, server side, sending its site key in `X-Api-Key`. The code lives 5 minutes; the same code from the same site key within 10 minutes returns the same answer, so a plugin that crashed before saving can ask again. The site key stops working 24 hours after the exchange. Errors: `400 INVALID_CODE`, `410 CODE_EXPIRED`, `403 SITE_MISMATCH`.

## Query parameters

- `fields` string
- `precision` integer

## Request body

- SiteConnectExchange
  - `code` string, required — The one-time code the dashboard appended to the return URL.
  - `site_url` string, uri, required — The site home URL, the same one the site key was issued for.

## Response `200`

Successful calculation

- object
  - `ok` boolean
  - `data` object
    - `key` string, nullable
    - `plan` string, nullable
    - `domain` string, nullable
    - `account` string, nullable

## Other responses

- `400` — Validation error
- `401` — Missing or invalid API key

## Changes

- **2026-09-24** `0639223269d9` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/astroway/apis/astroway-calculation-api/changes/site-keys/connect/exchange/post.md)

---

[API](https://skmtc.dev/astroway/apis/astroway-calculation-api.md) · [All operations](https://skmtc.dev/astroway/apis/astroway-calculation-api/llms.txt) · [OpenAPI document](https://skmtc.dev/astroway/apis/astroway-calculation-api/revisions/aa473bce3f00?raw)
