---
title: Update App Protection Level
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > App Builder
---

# Update App Protection Level{% #update-app-protection-level %}

{% tab title="v2" %}

| Datadog site      | API endpoint                                                                          |
| ----------------- | ------------------------------------------------------------------------------------- |
| ap1.datadoghq.com | PATCH https://api.ap1.datadoghq.com/api/v2/app-builder/apps/{app_id}/protection-level |
| ap2.datadoghq.com | PATCH https://api.ap2.datadoghq.com/api/v2/app-builder/apps/{app_id}/protection-level |
| app.datadoghq.eu  | PATCH https://api.datadoghq.eu/api/v2/app-builder/apps/{app_id}/protection-level      |
| app.ddog-gov.com  | PATCH https://api.ddog-gov.com/api/v2/app-builder/apps/{app_id}/protection-level      |
| us2.ddog-gov.com  | PATCH https://api.us2.ddog-gov.com/api/v2/app-builder/apps/{app_id}/protection-level  |
| app.datadoghq.com | PATCH https://api.datadoghq.com/api/v2/app-builder/apps/{app_id}/protection-level     |
| us3.datadoghq.com | PATCH https://api.us3.datadoghq.com/api/v2/app-builder/apps/{app_id}/protection-level |
| us5.datadoghq.com | PATCH https://api.us5.datadoghq.com/api/v2/app-builder/apps/{app_id}/protection-level |

### Overview

Update the publication protection level of an app. When set to `approval_required`, future publishes must go through an approval workflow before going live. This endpoint requires the `apps_write` permission.

### Arguments

#### Path Parameters

| Name                     | Type   | Description        |
| ------------------------ | ------ | ------------------ |
| app_id [*required*] | string | The ID of the app. |

### Request

#### Body Data (required)



{% tab title="Model" %}

| Parent field | Field                             | Type   | Description                                                                                                                                                                                         |
| ------------ | --------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data                              | object | Data for updating an app's publication protection level.                                                                                                                                            |
| data         | attributes                        | object | Attributes for updating an app's publication protection level.                                                                                                                                      |
| attributes   | protectionLevel [*required*] | enum   | The publication protection level of the app. `approval_required` means changes must go through an approval workflow before being published. Allowed enum values: `direct_publish,approval_required` |
| data         | type                              | enum   | The protection-level resource type. Allowed enum values: `protectionLevel`                                                                                                                          |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "protectionLevel": "approval_required"
    },
    "type": "protectionLevel"
  }
}
```

{% /tab %}

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
The response object after an app is successfully updated.

| Parent field         | Field                        | Type            | Description                                                                                                                                                                                                                                                                     |
| -------------------- | ---------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                      | data                         | object          | The data object containing the updated app definition.                                                                                                                                                                                                                          |
| data                 | attributes [*required*] | object          | The updated app definition attributes, such as name, description, and components.                                                                                                                                                                                               |
| attributes           | components                   | [object]        | The UI components that make up the app.                                                                                                                                                                                                                                         |
| components           | events                       | [object]        | Events to listen for on the grid component.                                                                                                                                                                                                                                     |
| events               | name                         | enum            | The triggering action for the event. Allowed enum values: `pageChange,tableRowClick,_tableRowButtonClick,change,submit,click,toggleOpen,close,open,executionFinished`                                                                                                           |
| events               | type                         | enum            | The response to the event. Allowed enum values: `custom,setComponentState,triggerQuery,openModal,closeModal,openUrl,downloadFile,setStateVariableValue`                                                                                                                         |
| components           | id                           | string          | The ID of the grid component. This property is deprecated; use `name` to identify individual components instead.                                                                                                                                                                |
| components           | name [*required*]       | string          | A unique identifier for this grid component. This name is also visible in the app editor.                                                                                                                                                                                       |
| components           | properties [*required*] | object          | Properties of a grid component.                                                                                                                                                                                                                                                 |
| properties           | backgroundColor              | string          | The background color of the grid.                                                                                                                                                                                                                                               |
| properties           | children                     | [object]        | The child components of the grid.                                                                                                                                                                                                                                               |
| children             | events                       | [object]        | Events to listen for on the UI component.                                                                                                                                                                                                                                       |
| events               | name                         | enum            | The triggering action for the event. Allowed enum values: `pageChange,tableRowClick,_tableRowButtonClick,change,submit,click,toggleOpen,close,open,executionFinished`                                                                                                           |
| events               | type                         | enum            | The response to the event. Allowed enum values: `custom,setComponentState,triggerQuery,openModal,closeModal,openUrl,downloadFile,setStateVariableValue`                                                                                                                         |
| children             | id                           | string          | The ID of the UI component. This property is deprecated; use `name` to identify individual components instead.                                                                                                                                                                  |
| children             | name [*required*]       | string          | A unique identifier for this UI component. This name is also visible in the app editor.                                                                                                                                                                                         |
| children             | properties [*required*] | object          | Properties of a UI component. Different component types can have their own additional unique properties. See the [components documentation](https://docs.datadoghq.com/service_management/app_builder/components.md) for more detail on each component type and its properties. |
| properties           | children                     | [object]        | The child components of the UI component.                                                                                                                                                                                                                                       |
| properties           | isVisible                    |  <oneOf>   | Whether the UI component is visible. If this is a string, it must be a valid JavaScript expression that evaluates to a boolean.                                                                                                                                                 |
| isVisible            | Option 1                     | boolean         |
| isVisible            | Option 2                     | string          | If this is a string, it must be a valid JavaScript expression that evaluates to a boolean.                                                                                                                                                                                      |
| children             | type [*required*]       | enum            | The UI component type. Allowed enum values: `table,textInput,textArea,button,text,select,modal,schemaForm,checkbox,tabs`                                                                                                                                                        |
| properties           | isVisible                    |  <oneOf>   | Whether the grid component and its children are visible. If a string, it must be a valid JavaScript expression that evaluates to a boolean.                                                                                                                                     |
| isVisible            | Option 1                     | string          |
| isVisible            | Option 2                     | boolean         |
| components           | type [*required*]       | enum            | The grid component type. Allowed enum values: `grid`                                                                                                                                                                                                                            |
| attributes           | description                  | string          | The human-readable description for the app.                                                                                                                                                                                                                                     |
| attributes           | favorite                     | boolean         | Whether the app is marked as a favorite by the current user.                                                                                                                                                                                                                    |
| attributes           | name                         | string          | The name of the app.                                                                                                                                                                                                                                                            |
| attributes           | queries                      | [ <oneOf>] | An array of queries, such as external actions and state variables, that the app uses.                                                                                                                                                                                           |
| queries              | Option 1                     | object          | An action query. This query type is used to trigger an action, such as sending a HTTP request.                                                                                                                                                                                  |
| Option 1             | events                       | [object]        | Events to listen for downstream of the action query.                                                                                                                                                                                                                            |
| events               | name                         | enum            | The triggering action for the event. Allowed enum values: `pageChange,tableRowClick,_tableRowButtonClick,change,submit,click,toggleOpen,close,open,executionFinished`                                                                                                           |
| events               | type                         | enum            | The response to the event. Allowed enum values: `custom,setComponentState,triggerQuery,openModal,closeModal,openUrl,downloadFile,setStateVariableValue`                                                                                                                         |
| Option 1             | id [*required*]         | uuid            | The ID of the action query.                                                                                                                                                                                                                                                     |
| Option 1             | name [*required*]       | string          | A unique identifier for this action query. This name is also used to access the query's result throughout the app.                                                                                                                                                              |
| Option 1             | properties [*required*] | object          | The properties of the action query.                                                                                                                                                                                                                                             |
| properties           | condition                    |  <oneOf>   | Whether to run this query. If specified, the query will only run if this condition evaluates to `true` in JavaScript and all other conditions are also met.                                                                                                                     |
| condition            | Option 1                     | boolean         |
| condition            | Option 2                     | string          |
| properties           | debounceInMs                 |  <oneOf>   | The minimum time in milliseconds that must pass before the query can be triggered again. This is useful for preventing accidental double-clicks from triggering the query multiple times.                                                                                       |
| debounceInMs         | Option 1                     | double          |
| debounceInMs         | Option 2                     | string          | If this is a string, it must be a valid JavaScript expression that evaluates to a number.                                                                                                                                                                                       |
| properties           | mockedOutputs                |  <oneOf>   | The mocked outputs of the action query. This is useful for testing the app without actually running the action.                                                                                                                                                                 |
| mockedOutputs        | Option 1                     | string          |
| mockedOutputs        | Option 2                     | object          | The mocked outputs of the action query.                                                                                                                                                                                                                                         |
| Option 2             | enabled [*required*]    |  <oneOf>   | Whether to enable the mocked outputs for testing.                                                                                                                                                                                                                               |
| enabled              | Option 1                     | boolean         |
| enabled              | Option 2                     | string          | If this is a string, it must be a valid JavaScript expression that evaluates to a boolean.                                                                                                                                                                                      |
| Option 2             | outputs                      | string          | The mocked outputs of the action query, serialized as JSON.                                                                                                                                                                                                                     |
| properties           | onlyTriggerManually          |  <oneOf>   | Determines when this query is executed. If set to `false`, the query will run when the app loads and whenever any query arguments change. If set to `true`, the query will only run when manually triggered from elsewhere in the app.                                          |
| onlyTriggerManually  | Option 1                     | boolean         |
| onlyTriggerManually  | Option 2                     | string          | If this is a string, it must be a valid JavaScript expression that evaluates to a boolean.                                                                                                                                                                                      |
| properties           | outputs                      | string          | The post-query transformation function, which is a JavaScript function that changes the query's `.outputs` property after the query's execution.                                                                                                                                |
| properties           | pollingIntervalInMs          |  <oneOf>   | If specified, the app will poll the query at the specified interval in milliseconds. The minimum polling interval is 15 seconds. The query will only poll when the app's browser tab is active.                                                                                 |
| pollingIntervalInMs  | Option 1                     | double          |
| pollingIntervalInMs  | Option 2                     | string          | If this is a string, it must be a valid JavaScript expression that evaluates to a number.                                                                                                                                                                                       |
| properties           | requiresConfirmation         |  <oneOf>   | Whether to prompt the user to confirm this query before it runs.                                                                                                                                                                                                                |
| requiresConfirmation | Option 1                     | boolean         |
| requiresConfirmation | Option 2                     | string          | If this is a string, it must be a valid JavaScript expression that evaluates to a boolean.                                                                                                                                                                                      |
| properties           | showToastOnError             |  <oneOf>   | Whether to display a toast to the user when the query returns an error.                                                                                                                                                                                                         |
| showToastOnError     | Option 1                     | boolean         |
| showToastOnError     | Option 2                     | string          | If this is a string, it must be a valid JavaScript expression that evaluates to a boolean.                                                                                                                                                                                      |
| properties           | spec [*required*]       |  <oneOf>   | The definition of the action query.                                                                                                                                                                                                                                             |
| spec                 | Option 1                     | string          |
| spec                 | Option 2                     | object          | The action query spec object.                                                                                                                                                                                                                                                   |
| Option 2             | connectionGroup              | object          | The connection group to use for an action query.                                                                                                                                                                                                                                |
| connectionGroup      | id                           | uuid            | The ID of the connection group.                                                                                                                                                                                                                                                 |
| connectionGroup      | tags                         | [string]        | The tags of the connection group.                                                                                                                                                                                                                                               |
| Option 2             | connectionId                 | string          | The ID of the custom connection to use for this action query.                                                                                                                                                                                                                   |
| Option 2             | fqn [*required*]        | string          | The fully qualified name of the action type.                                                                                                                                                                                                                                    |
| Option 2             | inputs                       |  <oneOf>   | The inputs to the action query. These are the values that are passed to the action when it is triggered.                                                                                                                                                                        |
| inputs               | Option 1                     | string          |
| inputs               | Option 2                     | object          | The inputs to the action query. See the [Actions Catalog](https://docs.datadoghq.com/actions/actions_catalog.md) for more detail on each action and its inputs.                                                                                                                 |
| Option 1             | type [*required*]       | enum            | The action query type. Allowed enum values: `action`                                                                                                                                                                                                                            |
| queries              | Option 2                     | object          | A data transformer, which is custom JavaScript code that executes and transforms data when its inputs change.                                                                                                                                                                   |
| Option 2             | id [*required*]         | uuid            | The ID of the data transformer.                                                                                                                                                                                                                                                 |
| Option 2             | name [*required*]       | string          | A unique identifier for this data transformer. This name is also used to access the transformer's result throughout the app.                                                                                                                                                    |
| Option 2             | properties [*required*] | object          | The properties of the data transformer.                                                                                                                                                                                                                                         |
| properties           | outputs                      | string          | A JavaScript function that returns the transformed data.                                                                                                                                                                                                                        |
| Option 2             | type [*required*]       | enum            | The data transform type. Allowed enum values: `dataTransform`                                                                                                                                                                                                                   |
| queries              | Option 3                     | object          | A variable, which can be set and read by other components in the app.                                                                                                                                                                                                           |
| Option 3             | id [*required*]         | uuid            | The ID of the state variable.                                                                                                                                                                                                                                                   |
| Option 3             | name [*required*]       | string          | A unique identifier for this state variable. This name is also used to access the variable's value throughout the app.                                                                                                                                                          |
| Option 3             | properties [*required*] | object          | The properties of the state variable.                                                                                                                                                                                                                                           |
| properties           | defaultValue                 |                 | The default value of the state variable.                                                                                                                                                                                                                                        |
| Option 3             | type [*required*]       | enum            | The state variable type. Allowed enum values: `stateVariable`                                                                                                                                                                                                                   |
| attributes           | rootInstanceName             | string          | The name of the root component of the app. This must be a `grid` component that contains all other components.                                                                                                                                                                  |
| attributes           | tags                         | [string]        | A list of tags for the app, which can be used to filter apps.                                                                                                                                                                                                                   |
| data                 | id [*required*]         | uuid            | The ID of the updated app.                                                                                                                                                                                                                                                      |
| data                 | type [*required*]       | enum            | The app definition type. Allowed enum values: `appDefinitions`                                                                                                                                                                                                                  |
|                      | included                     | [object]        | Data on the version of the app that was published.                                                                                                                                                                                                                              |
| included             | attributes                   | object          | The attributes object containing the version ID of the published app.                                                                                                                                                                                                           |
| attributes           | app_version_id               | uuid            | The version ID of the app that was published. For an unpublished app, this is always the nil UUID (`00000000-0000-0000-0000-000000000000`).                                                                                                                                     |
| included             | id                           | uuid            | The deployment ID.                                                                                                                                                                                                                                                              |
| included             | meta                         | object          | Metadata object containing the publication creation information.                                                                                                                                                                                                                |
| meta                 | created_at                   | date-time       | Timestamp of when the app was published.                                                                                                                                                                                                                                        |
| meta                 | user_id                      | int64           | The ID of the user who published the app.                                                                                                                                                                                                                                       |
| meta                 | user_name                    | string          | The name (or email address) of the user who published the app.                                                                                                                                                                                                                  |
| meta                 | user_uuid                    | uuid            | The UUID of the user who published the app.                                                                                                                                                                                                                                     |
| included             | type                         | enum            | The deployment type. Allowed enum values: `deployment`                                                                                                                                                                                                                          |
|                      | meta                         | object          | Metadata of an app.                                                                                                                                                                                                                                                             |
| meta                 | created_at                   | date-time       | Timestamp of when the app was created.                                                                                                                                                                                                                                          |
| meta                 | deleted_at                   | date-time       | Timestamp of when the app was deleted.                                                                                                                                                                                                                                          |
| meta                 | org_id                       | int64           | The Datadog organization ID that owns the app.                                                                                                                                                                                                                                  |
| meta                 | updated_at                   | date-time       | Timestamp of when the app was last updated.                                                                                                                                                                                                                                     |
| meta                 | updated_since_deployment     | boolean         | Whether the app was updated since it was last published. Published apps are pinned to a specific version and do not automatically update when the app is updated.                                                                                                               |
| meta                 | user_id                      | int64           | The ID of the user who created the app.                                                                                                                                                                                                                                         |
| meta                 | user_name                    | string          | The name (or email address) of the user who created the app.                                                                                                                                                                                                                    |
| meta                 | user_uuid                    | uuid            | The UUID of the user who created the app.                                                                                                                                                                                                                                       |
| meta                 | version                      | int64           | The version number of the app. This starts at 1 and increments with each update.                                                                                                                                                                                                |
|                      | relationship                 | object          | The app's publication relationship and custom connections.                                                                                                                                                                                                                      |
| relationship         | connections                  | [object]        | Array of custom connections used by the app.                                                                                                                                                                                                                                    |
| connections          | attributes                   | object          | The custom connection attributes.                                                                                                                                                                                                                                               |
| attributes           | name                         | string          | The name of the custom connection.                                                                                                                                                                                                                                              |
| attributes           | onPremRunner                 | object          | Information about the Private Action Runner used by the custom connection, if the custom connection is associated with a Private Action Runner.                                                                                                                                 |
| onPremRunner         | id                           | string          | The Private Action Runner ID.                                                                                                                                                                                                                                                   |
| onPremRunner         | url                          | string          | The URL of the Private Action Runner.                                                                                                                                                                                                                                           |
| connections          | id                           | uuid            | The ID of the custom connection.                                                                                                                                                                                                                                                |
| connections          | type                         | enum            | The custom connection type. Allowed enum values: `custom_connections`                                                                                                                                                                                                           |
| relationship         | deployment                   | object          | Information pointing to the app's publication status.                                                                                                                                                                                                                           |
| deployment           | data                         | object          | Data object containing the deployment ID.                                                                                                                                                                                                                                       |
| data                 | id                           | uuid            | The deployment ID.                                                                                                                                                                                                                                                              |
| data                 | type                         | enum            | The deployment type. Allowed enum values: `deployment`                                                                                                                                                                                                                          |
| deployment           | meta                         | object          | Metadata object containing the publication creation information.                                                                                                                                                                                                                |
| meta                 | created_at                   | date-time       | Timestamp of when the app was published.                                                                                                                                                                                                                                        |
| meta                 | user_id                      | int64           | The ID of the user who published the app.                                                                                                                                                                                                                                       |
| meta                 | user_name                    | string          | The name (or email address) of the user who published the app.                                                                                                                                                                                                                  |
| meta                 | user_uuid                    | uuid            | The UUID of the user who published the app.                                                                                                                                                                                                                                     |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "components": [
        {
          "events": [
            {
              "name": "click",
              "type": "triggerQuery"
            }
          ],
          "id": "string",
          "name": "",
          "properties": {
            "backgroundColor": "string",
            "children": [
              {
                "events": [
                  {
                    "name": "click",
                    "type": "triggerQuery"
                  }
                ],
                "id": "string",
                "name": "",
                "properties": {
                  "children": [],
                  "isVisible": {
                    "type": "undefined"
                  }
                },
                "type": "text"
              }
            ],
            "isVisible": {
              "type": "undefined"
            }
          },
          "type": "grid"
        }
      ],
      "description": "string",
      "favorite": false,
      "name": "string",
      "queries": [
        {
          "events": [
            {
              "name": "click",
              "type": "triggerQuery"
            }
          ],
          "id": "65bb1f25-52e1-4510-9f8d-22d1516ed693",
          "name": "fetchPendingOrders",
          "properties": {
            "condition": {
              "type": "undefined"
            },
            "debounceInMs": {
              "example": "undefined",
              "format": "undefined",
              "type": "undefined"
            },
            "mockedOutputs": {
              "type": "undefined"
            },
            "onlyTriggerManually": {
              "type": "undefined"
            },
            "outputs": "${((outputs) => {return outputs.body.data})(self.rawOutputs)}",
            "pollingIntervalInMs": {
              "example": "undefined",
              "format": "undefined",
              "minimum": "undefined",
              "type": "undefined"
            },
            "requiresConfirmation": {
              "type": "undefined"
            },
            "showToastOnError": {
              "type": "undefined"
            },
            "spec": {
              "type": ""
            }
          },
          "type": "action"
        }
      ],
      "rootInstanceName": "string",
      "tags": [
        "service:webshop-backend",
        "team:webshop"
      ]
    },
    "id": "65bb1f25-52e1-4510-9f8d-22d1516ed693",
    "type": "appDefinitions"
  },
  "included": [
    {
      "attributes": {
        "app_version_id": "65bb1f25-52e1-4510-9f8d-22d1516ed693"
      },
      "id": "65bb1f25-52e1-4510-9f8d-22d1516ed693",
      "meta": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "user_id": "integer",
        "user_name": "string",
        "user_uuid": "65bb1f25-52e1-4510-9f8d-22d1516ed693"
      },
      "type": "deployment"
    }
  ],
  "meta": {
    "created_at": "2019-09-19T10:00:00.000Z",
    "deleted_at": "2019-09-19T10:00:00.000Z",
    "org_id": "integer",
    "updated_at": "2019-09-19T10:00:00.000Z",
    "updated_since_deployment": false,
    "user_id": "integer",
    "user_name": "string",
    "user_uuid": "65bb1f25-52e1-4510-9f8d-22d1516ed693",
    "version": "integer"
  },
  "relationship": {
    "connections": [
      {
        "attributes": {
          "name": "string",
          "onPremRunner": {
            "id": "string",
            "url": "string"
          }
        },
        "id": "65bb1f25-52e1-4510-9f8d-22d1516ed693",
        "type": "custom_connections"
      }
    ],
    "deployment": {
      "data": {
        "id": "65bb1f25-52e1-4510-9f8d-22d1516ed693",
        "type": "deployment"
      },
      "meta": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "user_id": "integer",
        "user_name": "string",
        "user_uuid": "65bb1f25-52e1-4510-9f8d-22d1516ed693"
      }
    }
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="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 title="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 %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="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 title="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 %}

{% /tab %}

{% tab title="404" %}
Not Found
{% tab title="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 title="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 %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

### Code Example

##### 
                          \## default
# 
 \# Path parameters export app_id="65bb1f25-52e1-4510-9f8d-22d1516ed693" \# Curl command curl -X PATCH "https://api.datadoghq.com/api/v2/app-builder/apps/${app_id}/protection-level" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "protectionLevel": "approval_required"
    },
    "type": "protectionLevel"
  }
}
EOF 
                        
##### 

```go
// Update App Protection Level returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
	"github.com/google/uuid"
)

func main() {
	body := datadogV2.UpdateAppProtectionLevelRequest{
		Data: &datadogV2.UpdateAppProtectionLevelRequestData{
			Attributes: &datadogV2.UpdateAppProtectionLevelRequestDataAttributes{
				ProtectionLevel: datadogV2.APPPROTECTIONLEVEL_APPROVAL_REQUIRED,
			},
			Type: datadogV2.APPPROTECTIONLEVELTYPE_PROTECTIONLEVEL.Ptr(),
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewAppBuilderApi(apiClient)
	resp, r, err := api.UpdateProtectionLevel(ctx, uuid.MustParse("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `AppBuilderApi.UpdateProtectionLevel`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `AppBuilderApi.UpdateProtectionLevel`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
##### 

```java
// Update App Protection Level returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.AppBuilderApi;
import com.datadog.api.client.v2.model.AppProtectionLevel;
import com.datadog.api.client.v2.model.AppProtectionLevelType;
import com.datadog.api.client.v2.model.UpdateAppProtectionLevelRequest;
import com.datadog.api.client.v2.model.UpdateAppProtectionLevelRequestData;
import com.datadog.api.client.v2.model.UpdateAppProtectionLevelRequestDataAttributes;
import com.datadog.api.client.v2.model.UpdateAppResponse;
import java.util.UUID;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    AppBuilderApi apiInstance = new AppBuilderApi(defaultClient);

    UpdateAppProtectionLevelRequest body =
        new UpdateAppProtectionLevelRequest()
            .data(
                new UpdateAppProtectionLevelRequestData()
                    .attributes(
                        new UpdateAppProtectionLevelRequestDataAttributes()
                            .protectionLevel(AppProtectionLevel.APPROVAL_REQUIRED))
                    .type(AppProtectionLevelType.PROTECTIONLEVEL));

    try {
      UpdateAppResponse result =
          apiInstance.updateProtectionLevel(
              UUID.fromString("65bb1f25-52e1-4510-9f8d-22d1516ed693"), body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AppBuilderApi#updateProtectionLevel");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
##### 

```python
"""
Update App Protection Level returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.app_builder_api import AppBuilderApi
from datadog_api_client.v2.model.app_protection_level import AppProtectionLevel
from datadog_api_client.v2.model.app_protection_level_type import AppProtectionLevelType
from datadog_api_client.v2.model.update_app_protection_level_request import UpdateAppProtectionLevelRequest
from datadog_api_client.v2.model.update_app_protection_level_request_data import UpdateAppProtectionLevelRequestData
from datadog_api_client.v2.model.update_app_protection_level_request_data_attributes import (
    UpdateAppProtectionLevelRequestDataAttributes,
)
from uuid import UUID

body = UpdateAppProtectionLevelRequest(
    data=UpdateAppProtectionLevelRequestData(
        attributes=UpdateAppProtectionLevelRequestDataAttributes(
            protection_level=AppProtectionLevel.APPROVAL_REQUIRED,
        ),
        type=AppProtectionLevelType.PROTECTIONLEVEL,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = AppBuilderApi(api_client)
    response = api_instance.update_protection_level(app_id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body=body)

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
##### 

```ruby
# Update App Protection Level returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::AppBuilderAPI.new

body = DatadogAPIClient::V2::UpdateAppProtectionLevelRequest.new({
  data: DatadogAPIClient::V2::UpdateAppProtectionLevelRequestData.new({
    attributes: DatadogAPIClient::V2::UpdateAppProtectionLevelRequestDataAttributes.new({
      protection_level: DatadogAPIClient::V2::AppProtectionLevel::APPROVAL_REQUIRED,
    }),
    type: DatadogAPIClient::V2::AppProtectionLevelType::PROTECTIONLEVEL,
  }),
})
p api_instance.update_protection_level("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", body)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
##### 

```rust
// Update App Protection Level returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_app_builder::AppBuilderAPI;
use datadog_api_client::datadogV2::model::AppProtectionLevel;
use datadog_api_client::datadogV2::model::AppProtectionLevelType;
use datadog_api_client::datadogV2::model::UpdateAppProtectionLevelRequest;
use datadog_api_client::datadogV2::model::UpdateAppProtectionLevelRequestData;
use datadog_api_client::datadogV2::model::UpdateAppProtectionLevelRequestDataAttributes;
use uuid::Uuid;

#[tokio::main]
async fn main() {
    let body = UpdateAppProtectionLevelRequest::new().data(
        UpdateAppProtectionLevelRequestData::new()
            .attributes(UpdateAppProtectionLevelRequestDataAttributes::new(
                AppProtectionLevel::APPROVAL_REQUIRED,
            ))
            .type_(AppProtectionLevelType::PROTECTIONLEVEL),
    );
    let configuration = datadog::Configuration::new();
    let api = AppBuilderAPI::with_config(configuration);
    let resp = api
        .update_protection_level(
            Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"),
            body,
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
##### 

```typescript
/**
 * Update App Protection Level returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.AppBuilderApi(configuration);

const params: v2.AppBuilderApiUpdateProtectionLevelRequest = {
  body: {
    data: {
      attributes: {
        protectionLevel: "approval_required",
      },
      type: "protectionLevel",
    },
  },
  appId: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
};

apiInstance
  .updateProtectionLevel(params)
  .then((data: v2.UpdateAppResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
{% /tab %}
