---
title: Mark a deployment as failed by version
description: Update a deployment's change failure status, identifying the deployment by its service, environment, and version instead of its ID.
breadcrumbs: Documentation > API > Mark a deployment as failed by version
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/llms.txt).

# Mark a deployment as failed by version

## v2 (latest)

| Datadog site      | API endpoint                                                |
| ----------------- | ----------------------------------------------------------- |
| app.datadoghq.com | PATCH https://api.datadoghq.com/api/v2/dora/deployments     |
| us3.datadoghq.com | PATCH https://api.us3.datadoghq.com/api/v2/dora/deployments |
| us5.datadoghq.com | PATCH https://api.us5.datadoghq.com/api/v2/dora/deployments |
| app.datadoghq.eu  | PATCH https://api.datadoghq.eu/api/v2/dora/deployments      |
| ap1.datadoghq.com | PATCH https://api.ap1.datadoghq.com/api/v2/dora/deployments |
| ap2.datadoghq.com | PATCH https://api.ap2.datadoghq.com/api/v2/dora/deployments |
| uk1.datadoghq.com | PATCH https://api.uk1.datadoghq.com/api/v2/dora/deployments |
| app.ddog-gov.com  | PATCH https://api.ddog-gov.com/api/v2/dora/deployments      |
| us2.ddog-gov.com  | PATCH https://api.us2.ddog-gov.com/api/v2/dora/deployments  |

### Overview

Update a deployment's change failure status, identifying the deployment by its service, environment, and version instead of its ID. Use this to mark a deployment as a change failure or back to stable. You can optionally include remediation details to enable failed deployment recovery time calculation. If multiple deployments match the given service, environment, and version, the most recently finished one is updated.

This endpoint requires the `dora_metrics_write` permission.

### Request

#### Body Data (required)

{% tabs %}
{% tab label="Model" %}
| Parent field | Field                       | Type    | Description                                                                                                                                                                                         |
| ------------ | --------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]           | object  | The JSON:API data for patching a deployment identified by service, environment, and version.                                                                                                        |
| data         | attributes [*required*]     | object  | Attributes for patching a DORA deployment event identified by service, environment, and version.                                                                                                    |
| attributes   | change_failure [*required*] | boolean | Indicates whether the deployment resulted in a change failure.                                                                                                                                      |
| attributes   | env [*required*]            | string  | The environment the deployment was performed in.                                                                                                                                                    |
| attributes   | remediation                 | <oneOf> | Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. Specify either `id` or `version` to identify the remediation deployment, but not both. |
| remediation  | Object 1                    | object  | Remediation details identified by the ID of the remediation deployment.                                                                                                                             |
| Object 1     | id [*required*]             | string  | The ID of the remediation deployment.                                                                                                                                                               |
| Object 1     | type [*required*]           | enum    | The type of remediation action taken. Required when the failed deployment must be linked to a remediation deployment. Allowed enum values: `rollback`, `rollforward`.                               |
| remediation  | Object 2                    | object  | Remediation details identified by the version of the remediation deployment, matched against the same service and environment as the failed deployment.                                             |
| Object 2     | type [*required*]           | enum    | The type of remediation action taken. Required when the failed deployment must be linked to a remediation deployment. Allowed enum values: `rollback`, `rollforward`.                               |
| Object 2     | version [*required*]        | string  | The version of the remediation deployment.                                                                                                                                                          |
| attributes   | service [*required*]        | string  | The name of the service that was deployed.                                                                                                                                                          |
| attributes   | version [*required*]        | string  | The version deployed. This can be seen in the Service Catalog or in the APM Deployment Tracking.                                                                                                    |
| data         | type [*required*]           | enum    | JSON:API type for DORA deployment patch request. Allowed enum values: `dora_deployment_patch_request`. Default: `dora_deployment_patch_request`.                                                    |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "change_failure": true,
      "env": "prod",
      "remediation": {
        "id": "eG42zNIkVjM",
        "type": "rollback"
      },
      "service": "my-service",
      "version": "v1.2.3"
    },
    "type": "dora_deployment_patch_request"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="202" %}
Accepted
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Not Authorized

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/dora/deployments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "change_failure": true,
      "env": "production",
      "service": "my-service",
      "version": "v1.2.3"
    },
    "type": "dora_deployment_patch_request"
  }
}
EOF
```
{% /tab %}
{% /tabs %}
