# How to Check, Buy and Cancel Site Security Pro with the xCloud Public API and MCP

> Check whether a WordPress site is protected, buy Site Security Pro or cancel it with the xCloud Public API or any AI agent connected to xCloud MCP.

You can check whether a WordPress site is protected by Site Security Pro, buy it, or cancel it with three Public API calls on one site: `GET`, `POST` and `DELETE` on `/api/v1/sites/{uuid}/site-security-pro`. The same three actions are tools in any AI agent connected to xCloud MCP. Buying charges your team's card on file, exactly like the purchase on the site's **Security** page.

Use it when you add client sites from a script and want each one protected, or when an agent reports which sites are not covered and you want to fix that in one conversation. For what Site Security Pro does on the site, see [How to Set up Site Security PRO with xCloud](/docs/set-up-site-security-pro/).

## What you can do

| Action | Public API | MCP tool | Token scope | Team permission |
|---|---|---|---|---|
| Check status and price | `GET /api/v1/sites/{uuid}/site-security-pro` | `sites_site-security-pro_show` | `read:addons` | `site:vulnerability-scan` (run vulnerability scans) |
| Buy it | `POST /api/v1/sites/{uuid}/site-security-pro` | `sites_site-security-pro_purchase` | `write:addons` | `site:manage-update` (manage WordPress updates) and `addon:create` |
| Cancel it | `DELETE /api/v1/sites/{uuid}/site-security-pro` | `sites_site-security-pro_cancel` | `write:addons` | `site:manage-update` |
| Pay an open invoice | `POST /api/v1/payments/{invoice}/pay` | `payments_pay` | `write:addons` | `billing:create` |

Buying and cancelling each allow 10 requests a minute.

## Prerequisites

- An xCloud API token with the scopes in the table. See [How to Access the xCloud API](/docs/how-to-access-the-xcloud-api/) to create one.
- A team role with the permissions in the table. See [Team Roles & Permissions in xCloud](/docs/team-roles-permissions-in-xcloud/).
- A **WordPress** site on a team with a **paid plan**. Site Security Pro is not offered on the free plan, for non-WordPress, staging or disabled sites, or to white-label teams.
- To buy it, a payment method on the team, and billing with no unpaid invoices.
- For MCP, an AI agent connected to xCloud MCP. See [How to Connect xCloud MCP to Your AI Agent](/docs/how-to-connect-xcloud-mcp-to-ai-agent/).

You need the site's UUID. List your sites with `GET /api/v1/sites` to find it.

## Step 1: Check the site's protection

Read the site's Site Security Pro status. This call changes nothing.

```bash
export XCLOUD_TOKEN='YOUR_API_TOKEN'
export SITE_UUID='b2c3d4e5-f6a7-8901-bcde-f12345678901'

curl "https://app.xcloud.host/api/v1/sites/$SITE_UUID/site-security-pro" \
  --header "Authorization: Bearer $XCLOUD_TOKEN" \
  --header 'Accept: application/json'
```

**Expected result:** a `200` response. A site that is bought and protected looks like this:

```json
{
  "success": true,
  "message": "Success",
  "data": {
    "site": { "uuid": "b2c3d4e5-f6a7-8901-bcde-f12345678901", "name": "example.com" },
    "purchased": true,
    "protection": "active",
    "connected": true,
    "plugin_active": true,
    "findings_count": 2,
    "pending_tasks": [],
    "last_synced_at": "2026-11-18T08:30:00+00:00",
    "stale": false,
    "can_purchase": false,
    "offer": null,
    "term_offers": null
  }
}
```

`protection` tells you whether the site is safe:

| `protection` | Meaning | What to do |
|---|---|---|
| `active` | Bought and connected. The site is protected | Nothing |
| `plugin_off` | Bought, but the Patchstack plugin is deactivated. The site is not protected | Click **Activate** on the site's **Security** → **Patchstack** page |
| `activating` | Setup is running | Check again in a minute |
| `setup_needed` | Paid for, but setup failed or never finished. The site is not protected | Click **Retry** on the site's **Security** → **Patchstack** page |
| `null` | Not bought | Buy it in Step 2 |

The other fields:

- `findings_count`: open known vulnerabilities in plugins, themes or core found by Patchstack (ignored ones are not counted). For the list, call `GET /api/v1/sites/{uuid}/vulnerabilities`.
- `pending_tasks`: Site Security Pro work still running on the site, such as `activate`, `scan` or `cancel`.
- `last_synced_at` and `stale`: when Patchstack last answered for the site. `stale: true` means the newest refresh failed, so the findings may be out of date.
- `can_purchase`: `true` when you could buy it for this site now (it is `false` on the free plan, for non-WordPress, staging or disabled sites, when the site already has Site Security Pro, or when your role cannot buy add-ons). Only when it is `true` do `offer` and `term_offers` carry the price in USD: `price` is the renewal price and `first_price` the first charge when it differs. `term_offers` has one entry for `monthly` and one for `yearly` (`null` when that term is not on sale).

## Step 2: Buy Site Security Pro

Check the price in `term_offers` first, then send the purchase. Leave the body empty for the monthly term, or send `"term": "yearly"`:

```bash
curl -X POST "https://app.xcloud.host/api/v1/sites/$SITE_UUID/site-security-pro" \
  --header "Authorization: Bearer $XCLOUD_TOKEN" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{ "term": "yearly" }'
```

**Expected result:** a `202` response when the payment went through. Setup (connecting the site to Patchstack and installing the plugin) then runs in the background. The message usually reads as shown; a firewall warning can be added to the end of it:

```json
{
  "success": true,
  "message": "Site Security Pro activation has started. We will notify you when it is ready.",
  "data": {
    "task": "activate",
    "status": {
      "purchased": true,
      "protection": "activating",
      "pending_tasks": ["activate"]
    }
  }
}
```

(`status` carries the full Step 1 fields; it is shortened here.) Call Step 1 every minute or so until `protection` is `active`. When `task` is `null`, the payment went through but setup could not start, and the message reads `Payment received, but Site Security Pro activation could not be started for every site. Use Retry on the site's Security page.` Click **Retry** on the site's **Security** → **Patchstack** page.

A site that already has Site Security Pro, or whose domain is already protected under another site, answers `409` and nothing is charged. The same `409` comes back while another Site Security Pro change is running on the site.

## Step 3: Finish a payment that needs you

When the bank or the card needs you, the purchase answers `402` with the open invoice:

```json
{
  "success": false,
  "message": "Payment requires additional authentication.",
  "data": {
    "payment_status": "requires_action",
    "authentication_url": "https://app.xcloud.host/invoice/XC-INV-20261118-1234",
    "invoice_number": "XC-INV-20261118-1234"
  }
}
```

- `requires_action`: open `authentication_url` in a browser and confirm the payment with your bank.
- `failed`: the card was declined. Fix the team's payment method, then pay the same invoice. Do not buy again. If `invoice_number` is null, no invoice was kept: fix the payment method and send the purchase again.

```bash
curl -X POST 'https://app.xcloud.host/api/v1/payments/XC-INV-20261118-1234/pay' \
  --header "Authorization: Bearer $XCLOUD_TOKEN" \
  --header 'Accept: application/json'
```

**Expected result:** a `200` response with `"payment_status": "paid"`. Then check the site again with Step 1.

A `402` with `"data": null` means nothing was created: the team has no payment method, or its billing has unpaid invoices. Add a card or settle the invoices under billing in the dashboard, then try again.

## Step 4: Cancel Site Security Pro

Cancelling removes the site from Patchstack, uninstalls the plugin from the site and ends the add-on, which stops the renewal. To pause protection and keep the subscription, use **Deactivate** in the dashboard instead.

```bash
curl -X DELETE "https://app.xcloud.host/api/v1/sites/$SITE_UUID/site-security-pro" \
  --header "Authorization: Bearer $XCLOUD_TOKEN" \
  --header 'Accept: application/json'
```

**Expected result:** a `202` response with the message `Site Security Pro cancellation has started. We will notify you when it is done.` and `"task": "cancel"`. Call Step 1 until `purchased` is `false`.

A site without Site Security Pro answers `422`. When other Site Security Pro work is still running on the site (setup, a scan or a plugin change), the cancel answers `409` and nothing is queued: wait until `pending_tasks` is empty, then send it again.

To work on a site in another team granted to your token, add the `X-Team-Id` header. See [Multi-Team API Tokens and MCP Access](/docs/multi-team-api-tokens-and-mcp-access/).

## Manage Site Security Pro with an AI agent over MCP

In an MCP client connected to xCloud, ask in plain language:

```text
Which of my WordPress sites are not protected by Site Security Pro?
Show me the monthly and yearly price, then wait for my OK before you buy it for example.com.
```

The agent reads each site with `sites_site-security-pro_show`, which changes nothing. Buying (`sites_site-security-pro_purchase`) and cancelling (`sites_site-security-pro_cancel`) are marked as destructive, so the agent must explain what will happen and get your approval before it runs them, and most MCP clients ask you too. Before a purchase, the agent tells you the price of the term it will buy. On the compact MCP profile, the agent runs `sites.site-security-pro.show` through `xcloud_execute_read`, and the purchase and cancel through `xcloud_execute_destructive`.

**Expected result:** the agent lists each site's `protection`, the price, and waits for your approval. After a purchase it reports `activating`, then `active` once setup is done.

The xCloud Assistant in the dashboard can check a site's status, but it cannot buy or cancel Site Security Pro. Do those in the dashboard, with the API, or with your own MCP agent.

## Troubleshooting

| Response | Cause | Fix |
|---|---|---|
| `401` | No bearer token, or the token was revoked | Send `Authorization: Bearer <token>` with an active token |
| `403` | The token lacks the scope, or your role lacks the team permission. A missing `addon:create` on a purchase answers with `missing_permission: addon:create` | Use a token with the scope in the table and ask the team owner for the permission |
| `403` on purchase | The team is on the free plan | Upgrade the team plan first |
| `404` | Wrong site UUID, a site in a team your token cannot reach, or a white-label team | Check the UUID and the `X-Team-Id` header |
| `402` | No payment method, unpaid invoices, or the payment needs you or was declined | See Step 3 |
| `409` on purchase | The site or its domain already has Site Security Pro, or another Site Security Pro change is running on the site | Check the site with Step 1 and wait until `pending_tasks` is empty. Nothing was charged. |
| `409` on cancel | Other Site Security Pro work is still running, or the site is busy with another change | Wait until `pending_tasks` is empty, then try again |
| `422` on purchase | The site is not WordPress; `term` is not `monthly` or `yearly`; the chosen term is not on sale (`Site Security Pro is not available for purchase right now.`); or another purchase for the same domain is in progress (`Another purchase for this domain is in progress. Please try again in a moment.`) | Choose a WordPress site, fix `term`, pick the other term, or wait a moment and try again |
| `422` on cancel | Site Security Pro is not enabled for the site | Nothing to cancel |
| `429` | More than 10 purchase or cancel requests in a minute | Wait a minute |

## Frequently asked questions

### Does buying Site Security Pro through the API charge my card right away?

Yes. The purchase is charged to your team's default payment method, the same as buying it on the site's Security page. A team without a payment method gets a 402 response and nothing is created. Read the price first from can_purchase and term_offers in the status response.

### What does setup_needed mean?

The site is paid for, but its setup failed or never finished, so it is not protected yet. Open the site's Security → Patchstack page in the dashboard and click Retry.

### Does cancelling remove the Patchstack plugin from my site?

Yes. Cancelling removes the site from Patchstack, uninstalls the plugin and ends the add-on, which stops the renewal. To pause protection without ending the subscription, use Deactivate on the site's Security → Patchstack page instead.

### Can the xCloud Assistant in the dashboard buy or cancel Site Security Pro?

No. The Assistant can check a site's Site Security Pro status, but buying and cancelling are not available to it, because one charges your card and the other ends a paid add-on. Use the dashboard, the Public API or your own AI agent connected to xCloud MCP.

## Next steps

- Read the full request and response format in the [xCloud Public API reference](https://app.xcloud.host/api/v1/docs), and authentication and rate limits in the [xCloud API documentation overview](/docs/xcloud-api/).
- Update the vulnerable plugins and themes Site Security Pro finds on many sites at once with [the bulk vulnerability fix](/docs/fix-vulnerabilities-on-many-sites-with-xcloud-public-api-and-mcp/).
- See every security issue across your sites and servers in one place with the [Security Center](/docs/find-and-fix-security-issues-with-xcloud-security-center/).

If you run into any issues with Site Security Pro through the API or MCP, feel free to reach out to our [support team](/docs/access-built-in-support-portal-in-xcloud/) for help.
