# Trigger a deployment (https://developer.godaddy.com/en/docs/references/rest/hosting/create-deployment)

---
title: Trigger a deployment
description: Builds the latest imported source and deploys it to the publish environment.
full: true
pageId: 503262b9-70e8-4985-8334-d45e71d262cc
---

Full description

> Builds the latest imported source and deploys it to the publish environment. Returns `202 Accepted`. Poll `GET /apps/&#123;appId&#125;/deployments/&#123;deploymentId&#125;` until `status` is `COMPLETED` or `FAILED`.   This endpoint is only applicable to Node.js applications (`appType: NODEJS`): a deployment builds the imported source and publishes it through the Node.js application agent, which other hosting products do not have. Other product types return `501`.   For a Node.js application not built in Airo, when the account's live-site limit is reached, the request answers `422` with `details[].issue` `PUBLISH_LIMIT_EXCEEDED`, the same code `PUT /apps/&#123;appId&#125;/publish-state` uses for `MHWP`. Other `422` issue codes may apply.  For a Node.js application built in Airo, going live is governed by the application's Airo App Builder plan. When that plan does not allow the application to go live, for example a free plan or a plan whose live-site limit is reached, the request answers `422` with `details[].issue` `PLAN_UPGRADE_REQUIRED`. The fix is to upgrade the plan: the error carries a `links` entry with `rel: upgrade` (`links[rel=upgrade]`) whose `href` is the Airo App Builder plan page for the application. Treat `href` as opaque; do not build or parse it.  When a Node.js application built in Airo is suspended, the request answers `422` with `details[].issue` `APP_SUSPENDED` and nothing is published.  Publishing a Node.js application built in Airo through the API is being rolled out. Until it is offered for the caller, the request answers `501` with `details[].issue` `NOT_APPLICABLE` and nothing is published.  When the application's plan cannot be checked, the request answers `503` with `details[].issue` `UPSTREAM_UNAVAILABLE` and a `Retry-After` header, and nothing is published. Retry after that delay.

## POST /apps/{appId}/deployments

Trigger a deployment

Builds the latest imported source and deploys it to the publish environment. Returns `202 Accepted`. Poll `GET /apps/{appId}/deployments/{deploymentId}` until `status` is `COMPLETED` or `FAILED`.

This endpoint is only applicable to Node.js applications (`appType: NODEJS`): a deployment builds the imported source and publishes it through the Node.js application agent, which other hosting products do not have. Other product types return `501`.

For a Node.js application not built in Airo, when the account's live-site limit is reached, the request answers `422` with `details[].issue` `PUBLISH_LIMIT_EXCEEDED`, the same code `PUT /apps/{appId}/publish-state` uses for `MHWP`. Other `422` issue codes may apply.
For a Node.js application built in Airo, going live is governed by the application's Airo App Builder plan. When that plan does not allow the application to go live, for example a free plan or a plan whose live-site limit is reached, the request answers `422` with `details[].issue` `PLAN_UPGRADE_REQUIRED`. The fix is to upgrade the plan: the error carries a `links` entry with `rel: upgrade` (`links[rel=upgrade]`) whose `href` is the Airo App Builder plan page for the application. Treat `href` as opaque; do not build or parse it.
When a Node.js application built in Airo is suspended, the request answers `422` with `details[].issue` `APP_SUSPENDED` and nothing is published.
Publishing a Node.js application built in Airo through the API is being rolled out. Until it is offered for the caller, the request answers `501` with `details[].issue` `NOT_APPLICABLE` and nothing is published.
When the application's plan cannot be checked, the request answers `503` with `details[].issue` `UPSTREAM_UNAVAILABLE` and a `Retry-After` header, and nothing is published. Retry after that delay.


### Header parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Idempotency-Key` | string <uuid> | no | Client-generated UUID that makes a request safe to retry. Supplying the same key on a retry with an identical request body returns the original response without triggering a second operation. Retrying with the same key while the first request is still in flight returns `409 Conflict` with `details[].issue` `IDEMPOTENCY_IN_PROGRESS`. Reusing a key with a different request body returns `422 Unprocessable Entity` with `details[].issue` `IDEMPOTENCY_KEY_MISMATCH`. Keys are retained for 24 hours after the operation completes, after which the key may be reused. |

### Responses

**202** — Deployment accepted. Poll `links[rel=self]` until status is terminal.

Content-Type: `application/json`

Schema:

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

**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`

**422** — The deployment request was well-formed but could not be processed due to a business rule violation. `details[].issue` is `PLAN_UPGRADE_REQUIRED` for a Node.js application built in Airo whose Airo App Builder plan does not allow it to go live, `APP_SUSPENDED` for a Node.js application built in Airo that is suspended, or `PUBLISH_LIMIT_EXCEEDED` for a Node.js application not built in Airo when the account's live-site limit is reached. Other issue codes may apply.

Content-Type: `application/json`

```json
{
  "name": "UnprocessableEntity",
  "correlationId": "6f1c2a9e-1b7d-4c55-9f0e-3c1d2b4a5e6f",
  "message": "This application needs a paid plan to publish.",
  "details": [
    {
      "issue": "PLAN_UPGRADE_REQUIRED",
      "description": "Plan 'free' allows 0 published apps (0 used)."
    }
  ],
  "links": [
    {
      "rel": "upgrade",
      "href": "https://www.example.com/airo/plans/NODEJS-aBcDeFgHiJ"
    }
  ]
}
```

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 or to this application. `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`. Node.js applications built in Airo answer `501` for `GET` and `PUT /apps/{appId}/subscription`, for `DELETE /apps/{appId}` until deleting them through the API is offered for the caller, and for `POST /apps/{appId}/deployments` until publishing them through the API is offered for the caller.

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` or the plan check behind `POST /apps/{appId}/deployments`, `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`.
