# Set an application's publish state (https://developer.godaddy.com/en/docs/references/rest/hosting/set-publish-state)

---
title: Set an application's publish state
description: Sets the application's publish state.
full: true
pageId: 54c285c4-2cfa-4a60-addd-31737196ffe0
---

Full description

> Sets the application's publish state. `&#123; "published": true &#125;` takes the site live at `urls.publish`; `&#123; "published": false &#125;` takes it back behind its Coming Soon page. Returns `202 Accepted` with an `AppOperation` that carries no `app`; the `Location` header and `links[rel=self]` give the poll URL. Poll `GET /app-operations/&#123;operationId&#125;` until `status` is `COMPLETED` or `FAILED`, then read `GET /apps/&#123;appId&#125;/publish-state`. A request for the state the application is already in is accepted with `202` and runs no change; the returned `AppOperation` is already `COMPLETED`.   The body is a `PublishState` carrying only `published`: exactly `&#123; "published": <boolean> &#125;`. A body that lacks `published`, whose `published` is not a boolean, or that has any other field, the read-only `firstPublishedAt`, `updatedAt` and `links` included, is a `400`.   Going live is subject to the subscription's plan: a plan that allows no live sites, or one whose live-site limit is reached, answers `422` with `details[].issue` `PUBLISH_LIMIT_EXCEEDED`. The limit is checked again as the change runs, so a concurrent publish that takes the last slot ends the operation `FAILED` with `error.details[].issue` `PUBLISH_LIMIT_EXCEEDED`; any other failure ends it `FAILED` with `PUBLISH_STATE_CHANGE_FAILED`. A subscription that is not active cannot take a site live and answers `403` with `details[].issue` `SUBSCRIPTION_INACTIVE`. Taking a site offline is never limited. An application whose `status` is `DELETING` answers `422` with `details[].issue` `APP_DELETING`, whichever state is requested. While another write holds the application's lock, the request answers `503` with `details[].issue` `UPSTREAM_UNAVAILABLE` and `Retry-After: 5`; retry after that delay.   The request is idempotent by nature, so `Idempotency-Key` is not used. While a change for this application is still running, a `PUT` for the same state returns `202` with that running operation; a `PUT` for the opposite state is refused with `409` and `details[].issue` `PUBLISH_STATE_CHANGE_IN_PROGRESS`. Poll the running operation, then retry. The same `409` is returned for a moment while another publish-state request on the same subscription is being accepted; retry shortly.   Offered for the same products as `GET /apps/&#123;appId&#125;/publish-state`; `NODEJS-` ids answer `501` `NOT_APPLICABLE`.

## PUT /apps/{appId}/publish-state

Set an application's publish state

Sets the application's publish state. `{ "published": true }` takes the site live at `urls.publish`; `{ "published": false }` takes it back behind its Coming Soon page. Returns `202 Accepted` with an `AppOperation` that carries no `app`; the `Location` header and `links[rel=self]` give the poll URL. Poll `GET /app-operations/{operationId}` until `status` is `COMPLETED` or `FAILED`, then read `GET /apps/{appId}/publish-state`. A request for the state the application is already in is accepted with `202` and runs no change; the returned `AppOperation` is already `COMPLETED`.

The body is a `PublishState` carrying only `published`: exactly `{ "published": <boolean> }`. A body that lacks `published`, whose `published` is not a boolean, or that has any other field, the read-only `firstPublishedAt`, `updatedAt` and `links` included, is a `400`.

Going live is subject to the subscription's plan: a plan that allows no live sites, or one whose live-site limit is reached, answers `422` with `details[].issue` `PUBLISH_LIMIT_EXCEEDED`. The limit is checked again as the change runs, so a concurrent publish that takes the last slot ends the operation `FAILED` with `error.details[].issue` `PUBLISH_LIMIT_EXCEEDED`; any other failure ends it `FAILED` with `PUBLISH_STATE_CHANGE_FAILED`. A subscription that is not active cannot take a site live and answers `403` with `details[].issue` `SUBSCRIPTION_INACTIVE`. Taking a site offline is never limited. An application whose `status` is `DELETING` answers `422` with `details[].issue` `APP_DELETING`, whichever state is requested. While another write holds the application's lock, the request answers `503` with `details[].issue` `UPSTREAM_UNAVAILABLE` and `Retry-After: 5`; retry after that delay.

The request is idempotent by nature, so `Idempotency-Key` is not used. While a change for this application is still running, a `PUT` for the same state returns `202` with that running operation; a `PUT` for the opposite state is refused with `409` and `details[].issue` `PUBLISH_STATE_CHANGE_IN_PROGRESS`. Poll the running operation, then retry. The same `409` is returned for a moment while another publish-state request on the same subscription is being accepted; retry shortly.

Offered for the same products as `GET /apps/{appId}/publish-state`; `NODEJS-` ids answer `501` `NOT_APPLICABLE`.


### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `appId` | string | yes | Application identifier in `{PRODUCT}-{id}` form. The prefix is the application type in upper case — an upper-case letter followed by any number of upper-case letters, digits, or underscores — then a hyphen, then the identifier. For `NODEJS`, the suffix is a 10-character nanoid. Example: `NODEJS-aBcDeFgHiJ`. For `MHWP`, the suffix is a 10-character nanoid of lower-case letters and digits only. Example: `MHWP-a1b2c3d4e5`. |

### Header parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `traceparent` | string | no | W3C Trace Context identifier for this request. Clients should send a `traceparent` on every request so the trace can be correlated across services. See https://www.w3.org/TR/trace-context/ for the format. |

### Request body (required)

Content-Type: `application/json`

Schema:

- schema reference: `#/x-ext/e9cab7e`

### Responses

**202** — Publish-state change accepted. Poll `links[rel=self]` until `status` is `COMPLETED` or `FAILED`; the operation carries no `app`.

Content-Type: `application/json`

Schema:

- schema reference: `#/x-ext/0bebd09`

**400** — The request body or parameters did not pass schema validation.

Content-Type: `application/json`

Schema:

- schema reference: `#/components/schemas/Error`

**401** — Authentication credentials are missing or invalid. The response body may be empty and may not include `details[].issue`, so clients should not rely on the body to handle this status.

Content-Type: `application/json`

Schema:

- schema reference: `#/components/schemas/Error`

**403** — The caller is authenticated, but the request is not permitted: the access token does not carry the scope this operation requires, the operation is disabled for this account, or the account is not entitled to it. An entitlement `403` names the reason in `details[].issue`: for example `PUT /apps/{appId}/publish-state` answers `SUBSCRIPTION_INACTIVE` when the subscription that owns the application is not active, and `POST /apps?appType=MHWP` answers `WORDPRESS_NOT_ENABLED` when WordPress is not enabled for this account. When the access token does not carry the required scope, the response body may be empty and may not include `details[].issue`, so clients should not rely on the body to handle that case.

Content-Type: `application/json`

Schema:

- schema reference: `#/components/schemas/Error`

**404** — The requested resource does not exist.

Content-Type: `application/json`

Schema:

- schema reference: `#/components/schemas/Error`

**409** — The request conflicts with the current state of the resource.

Content-Type: `application/json`

Schema:

- schema reference: `#/components/schemas/Error`

**422** — The request was well-formed but could not be processed due to a business rule violation.

Content-Type: `application/json`

Schema:

- schema reference: `#/components/schemas/Error`

**429** — Rate limit exceeded. A `429` response may come in one of two shapes: an empty body with `RateLimit-Limit`, `RateLimit-Remaining`, and `RateLimit-Reset` headers; or a JSON `Error` body with `Retry-After` and `RateLimit-*` headers. Clients should honour whichever headers are present and should not assume a JSON body is available on every `429`.

Content-Type: `application/json`

Schema:

- schema reference: `#/components/schemas/Error`

**501** — The request is contract-valid, but the operation, or a value the request names, is not applicable to this deployment. `details[].issue` is always `NOT_APPLICABLE`. For example, deployments and restarts are offered for `NODEJS` applications only, and a hosting product this deployment does not serve is answered here rather than with a `400`.

Content-Type: `application/json`

Schema:

- schema reference: `#/components/schemas/Error`

**503** — The service is temporarily unable to handle the request. Retry after a short delay. May include a `Retry-After` header hinting at when to retry. When a dependency the request needs could not be read, such as the plan limit behind `PUT /apps/{appId}/publish-state`, `details[].issue` is `UPSTREAM_UNAVAILABLE`. For `MHWP` applications, `PATCH /apps/{appId}`, `DELETE /apps/{appId}` and `PUT /apps/{appId}/publish-state` also answer `503` with `details[].issue` `UPSTREAM_UNAVAILABLE` and `Retry-After: 5` while another write holds the application's lock.

Content-Type: `application/json`

Schema:

- schema reference: `#/components/schemas/Error`

**Security:** requires `bearerAuth`.
