---
title: Update an IaC custom rule
description: Update a custom IaC (Infrastructure as Code) rule by storing a new revision.
breadcrumbs: Docs > API > Update an IaC custom rule
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Update an IaC custom rule

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in Preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

| Datadog site      | API endpoint                                                                                 |
| ----------------- | -------------------------------------------------------------------------------------------- |
| app.datadoghq.com | PATCH https://api.datadoghq.com/api/v2/security/code_security/iac_custom_rules/{rule_id}     |
| us3.datadoghq.com | PATCH https://api.us3.datadoghq.com/api/v2/security/code_security/iac_custom_rules/{rule_id} |
| us5.datadoghq.com | PATCH https://api.us5.datadoghq.com/api/v2/security/code_security/iac_custom_rules/{rule_id} |
| app.datadoghq.eu  | PATCH https://api.datadoghq.eu/api/v2/security/code_security/iac_custom_rules/{rule_id}      |
| ap1.datadoghq.com | PATCH https://api.ap1.datadoghq.com/api/v2/security/code_security/iac_custom_rules/{rule_id} |
| ap2.datadoghq.com | PATCH https://api.ap2.datadoghq.com/api/v2/security/code_security/iac_custom_rules/{rule_id} |
| uk1.datadoghq.com | PATCH https://api.uk1.datadoghq.com/api/v2/security/code_security/iac_custom_rules/{rule_id} |
| app.ddog-gov.com  | PATCH https://api.ddog-gov.com/api/v2/security/code_security/iac_custom_rules/{rule_id}      |
| us2.ddog-gov.com  | PATCH https://api.us2.ddog-gov.com/api/v2/security/code_security/iac_custom_rules/{rule_id}  |

### Overview

Update a custom IaC (Infrastructure as Code) rule by storing a new revision.
The request sets only the fields that the API exposes.
Attributes that the request omits keep their current values, and so do the fields that the API doesn't
expose: overrides, framework associations, aggregation, and test files.
A `sample_file` replaces all the test files of the rule with that one sample.
Set `provider`, `cwe_id`, or `sample_file` to an empty string to remove it.
The new revision runs in scans when the rule is published.
When the new revision is published, the API compiles its Rego first.
If compilation fails, the request returns `400` with the errors in `detail` and stores nothing.
A published rule whose `platform` doesn't support custom rules can't be updated or published.
Unpublish it first, or set a supported `platform` in the same request.
To change only the publication state, use `PATCH /api/v2/security/code_security/iac_custom_rules/{rule_id}/publish`.
The request returns `409` when the body `id` doesn't match the `rule_id` path parameter,
or when another request changes the rule at the same time. In that case, get the rule again and retry.

This endpoint requires all of the following permissions:

- `appsec_vm_read`
- `appsec_vm_write`

### Arguments

#### Path Parameters

| Field                | Type   | Description                                                                                     |
| -------------------- | ------ | ----------------------------------------------------------------------------------------------- |
| rule_id [*required*] | string | The ID of the IaC custom rule, for example `custom-terraform-aws-s3-bucket-without-encryption`. |

### Request

#### Body Data (required)

{% tabs %}
{% tab label="Model" %}
| Parent field | Field                   | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------ | ----------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]       | object  | The changes to the IaC custom rule.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| data         | attributes [*required*] | object  | The attributes to change. Omitted attributes keep their current values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| attributes   | category                | enum    | The category of the misconfiguration that the rule detects. - `access_control`: Access to resources. - `availability`: Resilience and uptime of resources. - `backup`: Backups, snapshots, and versioning. - `best_practices`: General configuration practices. - `bill_of_materials`: Inventory of the components that the configuration declares. - `build_process`: Build and image instructions. - `encryption`: Encryption of data at rest and in transit. - `insecure_configurations`: Settings that weaken security. - `insecure_defaults`: Default values that weaken security. - `least_privilege`: Permissions broader than the resource needs. - `networking_and_firewall`: Network exposure and firewall rules. - `observability`: Logging, monitoring, and auditing. - `resource_management`: Resource limits and quotas. - `secret_management`: Secrets and credentials in the configuration. - `structure_and_semantics`: Syntax and structure of the configuration. - `supply_chain`: Origin and integrity of dependencies and images. Allowed enum values: `access_control`, `availability`, `backup`, `best_practices`, `bill_of_materials`, `build_process`, `encryption`, `insecure_configurations`, `insecure_defaults`, `least_privilege`, `networking_and_firewall`, `observability`, `resource_management`, `secret_management`, `structure_and_semantics`, `supply_chain`. |
| attributes   | cwe_id                  | string  | The CWE (Common Weakness Enumeration) ID of the weakness that the rule detects, in the `CWE-<number>` format. An empty string removes it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| attributes   | description             | string  | What the rule detects and why it matters, at most 10,000 bytes in UTF-8.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| attributes   | is_published            | boolean | `true` to publish the rule, so that scans run it. `false` to unpublish it, so that scans skip it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| attributes   | name                    | string  | The display name of the rule, between 1 and 60 bytes in UTF-8.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| attributes   | platform                | enum    | The IaC (Infrastructure as Code) platform of the files that the rule scans. - `ansible`: Ansible playbooks. - `cicd`: GitHub Actions workflows. - `cloudformation`: AWS CloudFormation templates. - `docker_compose`: Docker Compose files. - `dockerfile`: Dockerfiles. - `kubernetes`: Kubernetes manifests. - `terraform`: Terraform configuration files. List operations filter on it with `filter[platform]=terraform`. Allowed enum values: `ansible`, `cicd`, `cloudformation`, `docker_compose`, `dockerfile`, `kubernetes`, `terraform`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| attributes   | provider                | string  | The cloud or service provider that the rule targets, at most 64 bytes in UTF-8, for example `aws`. An empty string removes it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| attributes   | rego_query              | string  | The Rego source of the rule, in plain text, at most 75,000 bytes in UTF-8.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| attributes   | sample_file             | string  | An example IaC file, in plain text, at most 75,000 bytes in UTF-8. An empty string removes it. It replaces all the test files of the rule.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| attributes   | severity                | enum    | The severity of the findings that the rule reports. - `critical`: The highest severity. - `high`: The second highest severity. - `medium`: The middle severity. - `low`: The second lowest severity. - `info`: The lowest severity, for informational findings. Allowed enum values: `critical`, `high`, `medium`, `low`, `info`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| data         | id [*required*]         | string  | The ID of the rule. It must match the `rule_id` path parameter.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| data         | type [*required*]       | enum    | The type of the resource. The value is always `iac_custom_rules`. Allowed enum values: `iac_custom_rules`. Default: `iac_custom_rules`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "category": "encryption",
      "cwe_id": "CWE-311",
      "description": "S3 buckets must encrypt data at rest.",
      "is_published": true,
      "name": "S3 bucket without encryption",
      "platform": "terraform",
      "provider": "aws",
      "rego_query": "package datadog\n\nDatadogPolicy contains result if {\n\tsome i, doc in input.document\n\tsome type, resources in doc.resource\n\tsome name, resource in resources\n\ttype == \"aws_s3_bucket\"\n\tnot resource.server_side_encryption_configuration\n\tresult := {\n\t\t\"documentId\": doc.id,\n\t\t\"resourceType\": type,\n\t\t\"resourceName\": name,\n\t\t\"searchKey\": sprintf(\"resource.%s.%s\", [type, name]),\n\t}\n}",
      "sample_file": "resource \"aws_s3_bucket\" \"my_bucket\" {\n  bucket = \"my-bucket\"\n}",
      "severity": "high"
    },
    "id": "custom-terraform-aws-s3-bucket-without-encryption",
    "type": "iac_custom_rules"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
An IaC custom rule.

| Parent field | Field                       | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------ | --------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]           | object  | An IaC custom rule and its current revision.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| data         | attributes [*required*]     | object  | The attributes of an IaC custom rule, from its current revision.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| attributes   | category [*required*]       | enum    | The category of the misconfiguration that the rule detects. - `access_control`: Access to resources. - `availability`: Resilience and uptime of resources. - `backup`: Backups, snapshots, and versioning. - `best_practices`: General configuration practices. - `bill_of_materials`: Inventory of the components that the configuration declares. - `build_process`: Build and image instructions. - `encryption`: Encryption of data at rest and in transit. - `insecure_configurations`: Settings that weaken security. - `insecure_defaults`: Default values that weaken security. - `least_privilege`: Permissions broader than the resource needs. - `networking_and_firewall`: Network exposure and firewall rules. - `observability`: Logging, monitoring, and auditing. - `resource_management`: Resource limits and quotas. - `secret_management`: Secrets and credentials in the configuration. - `structure_and_semantics`: Syntax and structure of the configuration. - `supply_chain`: Origin and integrity of dependencies and images. Allowed enum values: `access_control`, `availability`, `backup`, `best_practices`, `bill_of_materials`, `build_process`, `encryption`, `insecure_configurations`, `insecure_defaults`, `least_privilege`, `networking_and_firewall`, `observability`, `resource_management`, `secret_management`, `structure_and_semantics`, `supply_chain`.                                                                                                                                                                                                                       |
| attributes   | created_at [*required*]     | int64   | The creation time of the rule, in milliseconds since the Unix epoch, in UTC.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| attributes   | created_by_id [*required*]  | string  | The UUID (universally unique identifier) of the user who created the rule.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| attributes   | cwe_id [*required*]         | string  | The CWE (Common Weakness Enumeration) ID of the weakness that the rule detects, in the `CWE-<number>` format. `null` when the rule has no CWE ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| attributes   | description [*required*]    | string  | What the rule detects and why it matters, at most 10,000 bytes in UTF-8. Search it with `filter[query]`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| attributes   | is_published [*required*]   | boolean | `true` when scans run the rule. `false` when the rule is a draft, which scans skip. Filter with `filter[is_published]=true`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| attributes   | modified_at [*required*]    | int64   | The creation time of the current revision, in milliseconds since the Unix epoch, in UTC.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| attributes   | modified_by_id [*required*] | string  | The UUID of the user who stored the current revision.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| attributes   | name [*required*]           | string  | The display name of the rule, between 1 and 60 bytes in UTF-8. Search it with `filter[query]`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| attributes   | platform [*required*]       | enum    | The IaC (Infrastructure as Code) platform of the files that the rule scans, as stored. Rules created outside this API can have a platform that custom rules don't support. Scans don't run these rules, and create, update, and validate requests don't accept that platform. - `ansible`: Ansible playbooks. - `azure_resource_manager`: Azure Resource Manager templates. Custom rules don't support it. - `buildah`: Buildah files. Custom rules don't support it. - `cicd`: GitHub Actions workflows. - `cloudformation`: AWS CloudFormation templates. - `common`: Rules that aren't specific to one platform. Custom rules don't support it. - `crossplane`: Crossplane manifests. Custom rules don't support it. - `docker_compose`: Docker Compose files. - `dockerfile`: Dockerfiles. - `google_deployment_manager`: Google Cloud Deployment Manager templates. Custom rules don't support it. - `grpc`: gRPC Protocol Buffers definitions. Custom rules don't support it. - `knative`: Knative manifests. Custom rules don't support it. - `kubernetes`: Kubernetes manifests. - `openapi`: OpenAPI definitions. Custom rules don't support it. - `pulumi`: Pulumi programs. Custom rules don't support it. - `serverless_fw`: Serverless Framework files. Custom rules don't support it. - `terraform`: Terraform configuration files. Allowed enum values: `ansible`, `azure_resource_manager`, `buildah`, `cicd`, `cloudformation`, `common`, `crossplane`, `docker_compose`, `dockerfile`, `google_deployment_manager`, `grpc`, `knative`, `kubernetes`, `openapi`, `pulumi`, `serverless_fw`, `terraform`. |
| attributes   | provider [*required*]       | string  | The cloud or service provider that the rule targets, in lowercase, for example `aws`. `null` when the rule has no provider. Filter with `filter[provider]=aws`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| attributes   | rego_query [*required*]     | string  | The Rego source of the rule, in plain text.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| attributes   | sample_file [*required*]    | string  | An example IaC file, in plain text, that contains the misconfiguration that the rule detects. `null` when the rule has no sample file.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| attributes   | severity [*required*]       | enum    | The severity of the findings that the rule reports. - `critical`: The highest severity. - `high`: The second highest severity. - `medium`: The middle severity. - `low`: The second lowest severity. - `info`: The lowest severity, for informational findings. Allowed enum values: `critical`, `high`, `medium`, `low`, `info`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| attributes   | version [*required*]        | int64   | The number of the current revision, starting at `1`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| data         | id [*required*]             | string  | The ID of the rule, for example `custom-terraform-aws-s3-bucket-without-encryption`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| data         | type [*required*]           | enum    | The type of the resource. The value is always `iac_custom_rules`. Allowed enum values: `iac_custom_rules`. Default: `iac_custom_rules`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "category": "encryption",
      "created_at": 1793271987422,
      "created_by_id": "00000000-0000-0000-0000-000000001234",
      "cwe_id": "CWE-311",
      "description": "S3 buckets must encrypt data at rest.",
      "is_published": false,
      "modified_at": 1793271987422,
      "modified_by_id": "00000000-0000-0000-0000-000000001234",
      "name": "S3 bucket without encryption",
      "platform": "terraform",
      "provider": "aws",
      "rego_query": "package datadog\n\nDatadogPolicy contains result if {\n\tsome i, doc in input.document\n\tsome type, resources in doc.resource\n\tsome name, resource in resources\n\ttype == \"aws_s3_bucket\"\n\tnot resource.server_side_encryption_configuration\n\tresult := {\n\t\t\"documentId\": doc.id,\n\t\t\"resourceType\": type,\n\t\t\"resourceName\": name,\n\t\t\"searchKey\": sprintf(\"resource.%s.%s\", [type, name]),\n\t}\n}",
      "sample_file": "resource \"aws_s3_bucket\" \"my_bucket\" {\n  bucket = \"my-bucket\"\n}",
      "severity": "high",
      "version": 1
    },
    "id": "custom-terraform-aws-s3-bucket-without-encryption",
    "type": "iac_custom_rules"
  }
}
```
{% /tab %}
{% /tabs %}
{% /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       | code                | string   | An application-specific error code.                                             |
| 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": [
    {
      "code": "invalid_request",
      "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" %}
Forbidden

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

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| 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": [
    {
      "code": "invalid_request",
      "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="409" %}
Conflict

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| 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": [
    {
      "code": "invalid_request",
      "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="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
# Path parameters
export rule_id="custom-terraform-aws-s3-bucket-without-encryption"

# 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/security/code_security/iac_custom_rules/${rule_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "severity": "critical"
    },
    "id": "custom-terraform-aws-s3-bucket-without-encryption",
    "type": "iac_custom_rules"
  }
}
EOF
```
{% /tab %}
{% /tabs %}
