> This page is for Gateway.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# Replace a project's DLP settings

PUT https://api-gateway.merge.dev/v1/projects/{project_id}/dlp-settings
Content-Type: application/json

Replaces the override as a whole. Entity types you omit inherit the organization's rule; an empty override map means inherit everything, the same as DELETE. A project pinned to an API key uses this policy as written. A project named per request (project_id body field or X-Project-Id header) may only tighten the organization policy; anything that loosens it is ignored at request time.

Reference: https://docs.merge.dev/merge-gateway/management-api/projects/update-project-dlp-settings

## Authentication

- `Authorization` header (bearer token, required) — A management key (prefixed `mgmt_`), created on the dashboard's **API keys** page under **Management keys**. Distinct from a regular gateway API key, and never used to call models.

## Request

### Path parameters

- `project_id` (string, required)

### Body (application/json)

This endpoint expects a ProjectDlpOverrideRequest.

- `override` (map from string to DlpEntityOverride, optional) — Keyed by entity type, for example US_SSN. An entity must already exist for the organization, either as a seeded rule or a custom one. Defaults to an empty map, which clears the override

## Response

### 200

The project's settings, with the effective policy resolved.

- `override` (map from string to DlpEntityOverride, optional) — What this project sets, keyed by entity type. Keys the project does not set are absent, and unset halves come back null
- `entities` (list of ProjectDlpEntityState, optional) — Every entity in the organization's catalog, with the merge applied

## Errors

### 403 Forbidden Error

The management key lacks the `manage_projects` scope.

- `detail` (string, optional) — Human-readable error message.

### 404 Not Found Error

Project not found, or it belongs to another organization.

- `detail` (string, optional) — Human-readable error message.

### 422 Unprocessable Entity Error

Unknown entity type, invalid action, or a write past the per-organization override limits.

- `detail` (string, optional) — Human-readable error message.

## Types

### DlpEntityOverride

A project's override for one entity type. Both fields are optional; omit one to inherit that half from the organization's rule.

- `enabled` (boolean, optional, nullable) — Whether this entity is scanned for this project
- `action` (enum, optional, nullable) — What to do on a match
  - Allowed values: `log`, `redact`, `block`

### ProjectDlpEntityState

How one entity type resolves for a project.

- `entity_type` (string, optional)
- `display_name` (string, optional, nullable)
- `category` (string, optional)
- `is_seeded` (boolean, optional) — Whether this entity comes from the seeded rule set
- `org_action` (string, optional, nullable) — What the organization does with it. Null means not scanned
- `effective_action` (string, optional, nullable) — What this project does with it after its override. Null means not scanned
- `overridden` (boolean, optional) — Whether the project overrides this entity

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "override": {},
  "entities": [
    {
      "entity_type": "string",
      "display_name": "string",
      "category": "string",
      "is_seeded": true,
      "org_action": "string",
      "effective_action": "string",
      "overridden": true
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api-gateway.merge.dev/v1/projects/project_id/dlp-settings"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-gateway.merge.dev/v1/projects/project_id/dlp-settings';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-gateway.merge.dev/v1/projects/project_id/dlp-settings"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api-gateway.merge.dev/v1/projects/project_id/dlp-settings")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api-gateway.merge.dev/v1/projects/project_id/dlp-settings")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api-gateway.merge.dev/v1/projects/project_id/dlp-settings', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api-gateway.merge.dev/v1/projects/project_id/dlp-settings");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-gateway.merge.dev/v1/projects/project_id/dlp-settings")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```