# Organization API: Organization deployments: Previews

> The 3 Organization API operations for previews.

Source: https://www.coritan.com/docs/api/reference/organizations/organization-deployments/deployments-previews/

Part of [Organization deployments](/docs/api/reference/organizations/organization-deployments/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/previews`](#op-get-api-v1-orgs-org-slug-deployments-deployment-uuid-previews) | List previews |
| DELETE | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/previews`](#op-delete-api-v1-orgs-org-slug-deployments-deployment-uuid-previews) | Close previews |
| POST | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/previews/{release_uuid}/promote`](#op-post-api-v1-orgs-org-slug-deployments-deployment-uuid-previews-release-uuid-prom) | Promote preview |

### List previews {#op-get-api-v1-orgs-org-slug-deployments-deployment-uuid-previews}

`GET /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/previews`

Whether a push to another branch or a pull request makes a preview
(``allowed``, with ``reason`` when it does not), and each branch with
live previews, the most recently pushed first: its newest release
(``latest``), the ready one its branch address serves (``serving``,
null until one is ready) and its addresses (``routed`` is false while
an address has no route yet).

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Close previews {#op-delete-api-v1-orgs-org-slug-deployments-deployment-uuid-previews}

`DELETE /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/previews`

Close the live previews of a branch, or of a pull request and of the
branch it comes from, or of both: a release on its way is canceled, a
ready one stops serving, and their addresses are removed. The next
push to the branch makes a new preview. 422 when neither is named; a
branch with no live preview answers ``closed: []``.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |  |
| `org_slug` | path | string | yes |  |
| `branch` | query | string or null | no | The branch whose live previews close |
| `pr` | query | integer or null | no | A pull request's number: its previews and its branch's close |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Promote preview {#op-post-api-v1-orgs-org-slug-deployments-deployment-uuid-previews-release-uuid-prom}

`POST /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/previews/{release_uuid}/promote`

A new production release of a preview's build: its image, its static
output or both, as the deployment serves them, with nothing built
again. The preview keeps serving at its own addresses. 409 for a
release that is not a preview (``not_preview``), one that was never
ready (``not_ready``), or one without the output the deployment needs
(``not_promotable``).

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |
| `release_uuid` | path | string (uuid) | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `201` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
