# 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
---

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

## 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`.


### 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`. 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.

Content-Type: `application/json`

Schema:

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

**403** — The caller is authenticated, but the request is not permitted: either the access token does not carry the scope this operation requires, or the operation is disabled for this account.

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 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.

Content-Type: `application/json`

Schema:

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

**Security:** requires `bearerAuth`.
