# How to manage WordPress sites (https://developer.godaddy.com/en/docs/api-users/hosting/manage-wordpress-sites)

---
title: How to manage WordPress sites
description: >-
  List WordPress sites, rename one, read its PHP and WordPress versions, and
  publish state, unpublish it, and delete it with the Hosting API.
keywords: >-
  list WordPress sites, rename WordPress site, PATCH /apps/{appId}, WordPress
  version, PHP version, GET /apps/{appId}/publish-state, unpublish WordPress
  site, delete WordPress site, gddy hosting app unpublish, MHWP
agentNotes:
  scopes:
    - 'hosting.application:read'
    - 'hosting.application:update'
    - 'hosting.application:delete'
    - 'hosting.deployment:execute'
  rateLimit: >-
    PUT /apps/{appId}/publish-state: 10 req/min and 100 req/hour per customer.
    Other WordPress site routes: 600 req/min per customer. A 429 can have an
    empty body and RateLimit-Limit, RateLimit-Remaining, and RateLimit-Reset
    headers. Wait the number of seconds in Retry-After if present, otherwise in
    RateLimit-Reset, before retrying.
  idempotent: true
  destructive: true
  failureRecovery: >-
    Reads, renames, and unpublishes are safe to retry. Delete is irreversible:
    confirm the site id first. A repeat DELETE during teardown returns 204 and
    starts nothing new. On 503 UPSTREAM_UNAVAILABLE with Retry-After: 5, wait 5
    seconds and retry. On 409 PUBLISH_STATE_CHANGE_IN_PROGRESS, poll the running
    publish if there is one, then retry; otherwise retry after a few seconds.
related:
  tutorials:
    - title: How to create and publish a WordPress site
      href: /docs/api-users/hosting/create-wordpress-site
  concepts:
    - title: About WordPress sites
      href: /docs/api-users/hosting/about-wordpress-sites
    - title: Hosting core concepts
      href: /docs/api-users/hosting/concepts
  guides:
    - title: Troubleshoot Hosting
      href: /docs/api-users/troubleshoot/hosting
    - title: CLI workflow reference
      href: /docs/api-users/cli/reference
  apis:
    - title: List applications
      href: /docs/references/rest/hosting/list-apps
    - title: Update an application
      href: /docs/references/rest/hosting/update-app
    - title: Get runtime configuration
      href: /docs/references/rest/hosting/get-runtime
    - title: Get an application's publish state
      href: /docs/references/rest/hosting/get-publish-state
    - title: Set an application's publish state
      href: /docs/references/rest/hosting/set-publish-state
    - title: Delete an application
      href: /docs/references/rest/hosting/delete-app
pageId: e14734e0-88ec-4434-8542-c8b46b5e6b7a
---

## Overview

This page covers the Hosting API v1 tasks for an existing WordPress site (`appType=MHWP`). You list sites, rename one, read its PHP and WordPress versions and its publish state, unpublish it, and delete it.

Renames are synchronous and return the updated site. An unpublish returns an `AppOperation` that you poll with `GET /v1/hosting/app-operations/{operationId}`. A delete returns `204 No Content` and removes the site in the background, with no operation to poll.

Go to [How to create and publish a WordPress site](https://developer.godaddy.com/docs/api-users/hosting/create-wordpress-site) for creating a site and taking it live. The code blocks use `$BASE_URL` for the API host (`https://api.godaddy.com`), `$GODADDY_PAT` for your Personal Access Token, and `$APP_ID` for the site id, like `MHWP-a1b2c3d4e5`.

## Prerequisites

The following prerequisites are required before you can manage WordPress sites:

* an Airo App Builder subscription with at least one WordPress site
* (*API only*) a [Personal Access Token](https://developer.godaddy.com/personal-access-token) with `hosting.application:read`, plus `hosting.application:update` to rename, `hosting.deployment:execute` to unpublish, and `hosting.application:delete` to delete
* (*API only*) `jq` for the curl examples
* (*CLI only*) the [GoDaddy CLI](https://developer.godaddy.com/docs/api-users/cli/set-up) installed and signed in

## List sites

`GET /v1/hosting/apps?appType=MHWP` returns a page of WordPress sites in `items`. The default page size is 25 and the maximum is 100. Follow `links[rel=next].href` for the next page.

The following procedure lists the WordPress sites on your account.

* List the sites:

  ```bash tab="(Recommended) CLI"
  gddy hosting app list --app-type MHWP
  ```

  ```bash tab="curl"
  curl -s "$BASE_URL/v1/hosting/apps?appType=MHWP&pageSize=100" \
    -H "Authorization: Bearer $GODADDY_PAT" \
    | jq '{sites: [.items[] | {id, name, status}], next: [.links[]? | select(.rel == "next") | .href]}'
  ```

  ```js tab="Node"
  const sites = [];
  let url = `${process.env.BASE_URL}/v1/hosting/apps?appType=MHWP&pageSize=100`;
  while (url) {
    const res = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.GODADDY_PAT}` },
    });
    const page = await res.json();
    sites.push(...page.items);
    const next = page.links?.find(l => l.rel === 'next')?.href;
    // links[].href is a path such as /v1/hosting/apps?..., so add the host.
    url = next ? `${process.env.BASE_URL}${next}` : null;
  }
  ```

  ```python tab="Python"
  import os, requests

  sites = []
  url = f"{os.environ['BASE_URL']}/v1/hosting/apps?appType=MHWP&pageSize=100"
  while url:
      page = requests.get(
          url,
          headers={"Authorization": f"Bearer {os.environ['GODADDY_PAT']}"},
      ).json()
      sites.extend(page["items"])
      href = next((l["href"] for l in page.get("links", []) if l["rel"] == "next"), None)
      # links[].href is a path such as /v1/hosting/apps?..., so add the host.
      url = f"{os.environ['BASE_URL']}{href}" if href else None
  ```

  ```go tab="Go"
  var sites []interface{}
  url := os.Getenv("BASE_URL") + "/v1/hosting/apps?appType=MHWP&pageSize=100"
  for url != "" {
      req, _ := http.NewRequest("GET", url, nil)
      req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
      resp, _ := http.DefaultClient.Do(req)
      var page map[string]interface{}
      json.NewDecoder(resp.Body).Decode(&page)
      resp.Body.Close()
      sites = append(sites, page["items"].([]interface{})...)
      url = ""
      links, _ := page["links"].([]interface{})
      for _, l := range links {
          if link := l.(map[string]interface{}); link["rel"] == "next" {
              // links[].href is a path such as /v1/hosting/apps?..., so add the host.
              url = os.Getenv("BASE_URL") + link["href"].(string)
          }
      }
  }
  ```

The list leaves out sites that are being deleted. Add `totalRequired=true` to get `totalItems` and `totalPages`. Any query parameter the endpoint doesn't define returns `400`.

## Rename a site

`PATCH /v1/hosting/apps/{appId}` takes a JSON Patch body and returns `200` with the updated site. WordPress sites accept one operation: `replace` on `/name`.

The new name must be 1–200 characters. Renaming doesn't change the WordPress site title.

The following procedure renames a site.

* Replace the site name:

  ```bash tab="(Recommended) CLI"
  gddy hosting app update --app-id "$APP_ID" --name my-renamed-site
  ```

  ```bash tab="curl"
  curl -s -X PATCH "$BASE_URL/v1/hosting/apps/$APP_ID" \
    -H "Authorization: Bearer $GODADDY_PAT" \
    -H "Content-Type: application/json-patch+json" \
    -d '[{"op":"replace","path":"/name","value":"my-renamed-site"}]' | jq '{id, name}'
  ```

  ```js tab="Node"
  const res = await fetch(`${process.env.BASE_URL}/v1/hosting/apps/${process.env.APP_ID}`, {
    method: 'PATCH',
    headers: {
      Authorization: `Bearer ${process.env.GODADDY_PAT}`,
      'Content-Type': 'application/json-patch+json',
    },
    body: JSON.stringify([{ op: 'replace', path: '/name', value: 'my-renamed-site' }]),
  });
  const site = await res.json();
  ```

  ```python tab="Python"
  resp = requests.patch(
      f"{os.environ['BASE_URL']}/v1/hosting/apps/{os.environ['APP_ID']}",
      headers={
          "Authorization": f"Bearer {os.environ['GODADDY_PAT']}",
          "Content-Type": "application/json-patch+json",
      },
      data='[{"op":"replace","path":"/name","value":"my-renamed-site"}]',
  )
  site = resp.json()
  ```

  ```go tab="Go"
  body := strings.NewReader(`[{"op":"replace","path":"/name","value":"my-renamed-site"}]`)
  req, _ := http.NewRequest("PATCH", os.Getenv("BASE_URL")+"/v1/hosting/apps/"+os.Getenv("APP_ID"), body)
  req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
  req.Header.Set("Content-Type", "application/json-patch+json")
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  ```

A `replace` on `/rootPath` returns `422` `ROOT_PATH_NOT_APPLICABLE`, because a WordPress site serves from a fixed document root. Any other operation or path returns `400`.

## Read runtime versions

`GET /v1/hosting/apps/{appId}/runtime` returns an array with one entry per runtime component: `PHP` and `WORDPRESS`, each with its `version`.

The following procedure reads the PHP and WordPress versions of a site.

* Read the runtime versions:

  ```bash tab="(Recommended) CLI"
  gddy hosting runtime get --app-id "$APP_ID"
  ```

  ```bash tab="curl"
  curl -s "$BASE_URL/v1/hosting/apps/$APP_ID/runtime" \
    -H "Authorization: Bearer $GODADDY_PAT" | jq .
  ```

  ```js tab="Node"
  const res = await fetch(`${process.env.BASE_URL}/v1/hosting/apps/${process.env.APP_ID}/runtime`, {
    headers: { Authorization: `Bearer ${process.env.GODADDY_PAT}` },
  });
  const runtimes = await res.json();
  const wordpress = runtimes.find(r => r.runtime === 'WORDPRESS')?.version;
  ```

  ```python tab="Python"
  resp = requests.get(
      f"{os.environ['BASE_URL']}/v1/hosting/apps/{os.environ['APP_ID']}/runtime",
      headers={"Authorization": f"Bearer {os.environ['GODADDY_PAT']}"},
  )
  versions = {r["runtime"]: r["version"] for r in resp.json()}
  ```

  ```go tab="Go"
  req, _ := http.NewRequest("GET", os.Getenv("BASE_URL")+"/v1/hosting/apps/"+os.Getenv("APP_ID")+"/runtime", nil)
  req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  var runtimes []map[string]string
  json.NewDecoder(resp.Body).Decode(&runtimes)
  ```

Older sites might return only the `WORDPRESS` entry. An empty array isn't an error, so handle a missing entry in your code.

## Read the publish state

`GET /v1/hosting/apps/{appId}/publish-state` returns `published`: `true` when the site is live at `urls.publish`, `false` when it shows its holding page. The response omits `firstPublishedAt` until the site is first published, and `updatedAt` until the state is first set.

The following procedure reads whether a site is published.

* Read the publish state:

  ```bash tab="curl"
  curl -s "$BASE_URL/v1/hosting/apps/$APP_ID/publish-state" \
    -H "Authorization: Bearer $GODADDY_PAT" | jq '{published, firstPublishedAt, updatedAt}'
  ```

  ```js tab="Node"
  const res = await fetch(
    `${process.env.BASE_URL}/v1/hosting/apps/${process.env.APP_ID}/publish-state`,
    { headers: { Authorization: `Bearer ${process.env.GODADDY_PAT}` } },
  );
  const { published } = await res.json();
  ```

  ```python tab="Python"
  resp = requests.get(
      f"{os.environ['BASE_URL']}/v1/hosting/apps/{os.environ['APP_ID']}/publish-state",
      headers={"Authorization": f"Bearer {os.environ['GODADDY_PAT']}"},
  )
  published = resp.json()["published"]
  ```

  ```go tab="Go"
  req, _ := http.NewRequest("GET", os.Getenv("BASE_URL")+"/v1/hosting/apps/"+os.Getenv("APP_ID")+"/publish-state", nil)
  req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  var state map[string]interface{}
  json.NewDecoder(resp.Body).Decode(&state)
  published := state["published"].(bool)
  ```

`updatedAt` can advance for reasons other than a change to `published`, so compare `published` itself to detect a change.

## Unpublish a site

`PUT /v1/hosting/apps/{appId}/publish-state` with exactly `{"published": false}` puts the holding page back in front of the site. It returns `202 Accepted` with an `AppOperation` of `type` `SET_PUBLISH_STATE`.

Unpublishing skips the subscription and plan-limit checks, so it works on an inactive subscription too. Unpublishing a live site frees a published-site slot on your Airo App Builder plan, which sets how many sites can be published at once. The free plan allows none. Go to [Set an application's publish state](https://developer.godaddy.com/docs/references/rest/hosting/set-publish-state) for how the limit works.

The following procedure unpublishes a site.

* Set the publish state to `false`:

  ```bash tab="(Recommended) CLI"
  gddy hosting app unpublish --app-id "$APP_ID"
  ```

  ```bash tab="curl"
  curl -s -X PUT "$BASE_URL/v1/hosting/apps/$APP_ID/publish-state" \
    -H "Authorization: Bearer $GODADDY_PAT" \
    -H "Content-Type: application/json" \
    -d '{ "published": false }' | jq '{operationId, type, status}'
  ```

  ```js tab="Node"
  const res = await fetch(
    `${process.env.BASE_URL}/v1/hosting/apps/${process.env.APP_ID}/publish-state`,
    {
      method: 'PUT',
      headers: {
        Authorization: `Bearer ${process.env.GODADDY_PAT}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ published: false }),
    },
  );
  const { operationId, status } = await res.json();
  ```

  ```python tab="Python"
  resp = requests.put(
      f"{os.environ['BASE_URL']}/v1/hosting/apps/{os.environ['APP_ID']}/publish-state",
      headers={"Authorization": f"Bearer {os.environ['GODADDY_PAT']}"},
      json={"published": False},
  )
  operation_id = resp.json()["operationId"]
  ```

  ```go tab="Go"
  body := strings.NewReader(`{"published":false}`)
  req, _ := http.NewRequest("PUT",
      os.Getenv("BASE_URL")+"/v1/hosting/apps/"+os.Getenv("APP_ID")+"/publish-state", body)
  req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
  req.Header.Set("Content-Type", "application/json")
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  var op map[string]interface{}
  json.NewDecoder(resp.Body).Decode(&op)
  ```

Poll `GET /v1/hosting/app-operations/{operationId}` every 2–5 seconds until `status` is `COMPLETED` or `FAILED`. Go to [Poll the publish operation](https://developer.godaddy.com/docs/api-users/hosting/create-wordpress-site#poll-the-publish-operation-with-the-api) for the polling code.

An unpublish of a site that's already unpublished returns an operation that's already `COMPLETED`. While a publish of the site is still running, an unpublish returns `409` `PUBLISH_STATE_CHANGE_IN_PROGRESS`.

## Delete a site

Deleting a WordPress site removes it permanently. You can't undo it.

`DELETE /v1/hosting/apps/{appId}` returns `204 No Content` and starts removing the site. There's no operation to poll.

The following procedure deletes a site.

* Delete the site:

  ```bash tab="(Recommended) CLI"
  gddy hosting app delete --app-id "$APP_ID"
  ```

  ```bash tab="curl"
  curl -s -o /dev/null -w "%{http_code}\n" -X DELETE "$BASE_URL/v1/hosting/apps/$APP_ID" \
    -H "Authorization: Bearer $GODADDY_PAT"
  ```

  ```js tab="Node"
  const res = await fetch(`${process.env.BASE_URL}/v1/hosting/apps/${process.env.APP_ID}`, {
    method: 'DELETE',
    headers: { Authorization: `Bearer ${process.env.GODADDY_PAT}` },
  });
  if (res.status !== 204) throw new Error(`Delete failed: ${res.status}`);
  ```

  ```python tab="Python"
  resp = requests.delete(
      f"{os.environ['BASE_URL']}/v1/hosting/apps/{os.environ['APP_ID']}",
      headers={"Authorization": f"Bearer {os.environ['GODADDY_PAT']}"},
  )
  assert resp.status_code == 204, resp.status_code
  ```

  ```go tab="Go"
  req, _ := http.NewRequest("DELETE", os.Getenv("BASE_URL")+"/v1/hosting/apps/"+os.Getenv("APP_ID"), nil)
  req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
  resp, _ := http.DefaultClient.Do(req)
  resp.Body.Close()
  if resp.StatusCode != 204 {
      log.Fatalf("delete failed: %d", resp.StatusCode)
  }
  ```

While the site is being removed, `GET /v1/hosting/apps/{appId}` returns it with `status` `DELETING`. After removal ends, the same call returns `404` `APP_NOT_FOUND`. A repeat `DELETE` during removal returns `204` and starts nothing new. After removal, it returns `404`.

## Example responses

### List response

`GET /v1/hosting/apps?appType=MHWP` returns the sites in `items`. A `next` link means there's another page:

```json
{
  "items": [
    {
      "id": "MHWP-a1b2c3d4e5",
      "name": "my-site",
      "appType": "MHWP",
      "status": "ACTIVE",
      "urls": { "publish": "https://my-site.myftpupload.com" },
      "createdAt": "2026-11-09T14:02:11Z",
      "updatedAt": "2026-11-09T14:02:52Z",
      "links": [
        { "rel": "self", "href": "/v1/hosting/apps/MHWP-a1b2c3d4e5" }
      ]
    }
  ],
  "links": [
    { "rel": "self", "href": "/v1/hosting/apps?appType=MHWP&pageSize=100" }
  ]
}
```

### Rename response

`PATCH /v1/hosting/apps/{appId}` returns the full site with the new `name`:

```json
{
  "id": "MHWP-a1b2c3d4e5",
  "name": "my-renamed-site",
  "appType": "MHWP",
  "status": "ACTIVE",
  "urls": { "publish": "https://my-site.myftpupload.com" },
  "createdAt": "2026-11-09T14:02:11Z",
  "updatedAt": "2026-11-09T15:10:04Z",
  "links": [
    { "rel": "self", "href": "/v1/hosting/apps/MHWP-a1b2c3d4e5" }
  ]
}
```

### Runtime response

`GET /v1/hosting/apps/{appId}/runtime` returns one entry per runtime component:

```json
[
  { "runtime": "PHP", "version": "8.3" },
  { "runtime": "WORDPRESS", "version": "7.1.4" }
]
```

### Publish state response

`GET /v1/hosting/apps/{appId}/publish-state` for a site that's live:

```json
{
  "published": true,
  "firstPublishedAt": "2026-11-09T14:05:30Z",
  "updatedAt": "2026-11-09T14:05:30Z",
  "links": [
    { "rel": "self", "href": "/v1/hosting/apps/MHWP-a1b2c3d4e5/publish-state" }
  ]
}
```

### Unpublish response

`PUT /v1/hosting/apps/{appId}/publish-state` returns a `SET_PUBLISH_STATE` operation with no `app`:

```json
{
  "operationId": "MHWP-q4r5s6t7",
  "type": "SET_PUBLISH_STATE",
  "status": "PENDING",
  "createdAt": "2026-11-09T15:10:04Z",
  "links": [
    { "rel": "self", "href": "/v1/hosting/app-operations/MHWP-q4r5s6t7" },
    { "rel": "poll", "href": "/v1/hosting/app-operations/MHWP-q4r5s6t7" }
  ]
}
```

## Common errors

WordPress site errors use the envelope `{name, correlationId, message, details}`. Branch on `details[].issue`, not on `name` or `message`. The following table lists the errors these tasks can return:

| Status             | Issue code                            | Cause                                                                                                                                       | What to do                                                                                                                                                                                 |
| ------------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `400`              | `VALIDATION_FAILED`                   | The name, patch, publish-state body, or list query parameters aren't valid                                                                  | Read `details[].field`, fix the request, and retry                                                                                                                                         |
| `401`              | (empty body)                          | The PAT is expired or revoked, or it doesn't have the scope the call needs. A PAT without the scope can get an empty `401` instead of `403` | Check the scope for the call. A missing scope can return `401` or `403`, so handle both. Create a new PAT if needed                                                                        |
| `401`              | `OAUTH_REQUIRED`, `INVALID_TOKEN`     | No bearer token, or the token is invalid                                                                                                    | Send `Authorization: Bearer $GODADDY_PAT` with a current PAT                                                                                                                               |
| `403`              | `INSUFFICIENT_SCOPE`, `ACCESS_DENIED` | The token doesn't have the scope the call needs, or the account can't use the API. For a missing scope the body can be empty                | Add the scope: create a new PAT with it, or sign in to `gddy` again and approve it. Or use an account with API access                                                                      |
| `404`              | `APP_NOT_FOUND`                       | The id doesn't exist, doesn't belong to your account, or the site's removal has ended                                                       | Check the id with `GET /v1/hosting/apps?appType=MHWP`                                                                                                                                      |
| `409`              | `PUBLISH_STATE_CHANGE_IN_PROGRESS`    | A publish of the site is running, or another publish-state request on the subscription is being accepted                                    | If a publish is running, poll its operation, then retry the unpublish. Otherwise retry after a few seconds                                                                                 |
| `422`              | `ROOT_PATH_NOT_APPLICABLE`            | The patch tried to change `/rootPath`                                                                                                       | Change `/name` only                                                                                                                                                                        |
| `422`              | `APP_DELETING`                        | The site is being deleted, so it can't be renamed or unpublished                                                                            | Stop sending writes for this site                                                                                                                                                          |
| `429`              | (empty body)                          | The rate limit is reached                                                                                                                   | Wait the number of seconds in `Retry-After` if it's present, otherwise in `RateLimit-Reset`, then retry. Go to [Troubleshoot Hosting](https://developer.godaddy.com/docs/api-users/troubleshoot/hosting) for the limits |
| `501`              | `NOT_APPLICABLE`                      | The id belongs to a Node.js app, which has no publish state                                                                                 | Use a WordPress site id (`MHWP-` prefix)                                                                                                                                                   |
| `503`              | `UPSTREAM_UNAVAILABLE`                | Another write holds the site's lock                                                                                                         | Wait for the `Retry-After` value (5 seconds), then retry                                                                                                                                   |
| Operation `FAILED` | `PUBLISH_STATE_CHANGE_FAILED`         | The unpublish didn't finish, and the site keeps its previous state                                                                          | Retry the `PUT`. Contact GoDaddy support with the `correlationId` if it fails again                                                                                                        |

Go to [Troubleshoot Hosting](https://developer.godaddy.com/docs/api-users/troubleshoot/hosting) for every error a WordPress site request can return.
