# Delete a deployment

From **GitHub v3 REST API**.

`DELETE /repos/{owner}/{repo}/deployments/{deployment_id}`

If the repository only has one deployment, you can delete the deployment regardless of its status. If the repository has more than one deployment, you can only delete inactive deployments. This ensures that repositories with multiple deployments will always have an active deployment. Anyone with `repo` or `repo_deployment` scopes can delete a deployment.

To set a deployment as inactive, you must:

*   Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment.
*   Mark the active deployment as inactive by adding any non-successful deployment status.

For more information, see "[Create a deployment](https://docs.github.com/enterprise-server@3.0/rest/reference/repos/#create-a-deployment)" and "[Create a deployment status](https://docs.github.com/enterprise-server@3.0/rest/reference/repos#create-a-deployment-status)."

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

### `deployment_id`

- Location: path
- Required: true
- Type: `integer`

deployment_id parameter

## Responses

### `204`

Response

### `404`

Resource not found

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error Simple

```json
{"description":"Validation Error Simple","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"type":"string"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error Simple","type":"object"}
```

## Request examples

### cURL

```shell
curl --request DELETE \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/deployments/{deployment_id}
```
