> 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.

# Delete Project PI Settings

DELETE https://api-gateway.merge.dev/v1/projects/{project_id}/pi-settings

Clear the override so the project inherits the organization's prompt
injection policy as a whole.

Needs `manage_security_rules` or `manage_projects`.

Reference: https://docs.merge.dev/merge-gateway/management-api/security-rules/delete-project-pi-settings

## Authentication

- `Authorization` header (bearer token, required) — A management key (`mgmt_...`), sent as `Authorization: Bearer <key>`. Reading /v1/routing-policies also accepts the organization's gateway API keys; writing there needs a management key.

## Request

### Path parameters

- `project_id` (string, required) — The project's `id`.

## Response

### 200

The project's prompt injection settings, now all inherited from the organization

- `effective` (PIProtectionSettingsV1, required) — The policy a request to this project runs under, when the project is pinned to an API key.
- `inherited_fields` (list of string, required) — Fields taken from the organization policy because the project doesn't set them.
- `override` (PIProtectionOverrideV1, required) — What the project sets. Fields it doesn't set are null.

## Errors

### 401 Unauthorized Error

The key is missing or invalid.

- `detail` (ErrorResponseDetail, required) — A message, or an object with a `code` to branch on and a `message`.

### 403 Forbidden Error

The key lacks the scope this route needs, or the change is not allowed.

- `detail` (ErrorResponseDetail, required) — A message, or an object with a `code` to branch on and a `message`.

### 404 Not Found Error

The resource does not exist in the key's organization.

- `detail` (ErrorResponseDetail, required) — A message, or an object with a `code` to branch on and a `message`.

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 502 Bad Gateway Error

The gateway could not be updated. Retrying the same request is safe.

- `detail` (ErrorResponseDetail, required) — A message, or an object with a `code` to branch on and a `message`.

## Types

### PIProtectionSettingsV1

A prompt injection policy.

- `pi_allowlist_patterns` (list of string, optional) — Regular expressions whose matching prompt segments skip screening. A project's patterns add to the organization's, never replacing them. A pattern that matches ordinary text, such as `.*`, is ignored.
- `pi_block_threshold` (double, optional, default: 0.57) — Direct injection: a prompt segment is blocked when its score, from 0 to 1, reaches this value. At least the organization's `pi_pass_threshold`.
- `pi_fail_closed` (boolean, optional, default: false) — Reject requests, with `code: "sidecar_error"`, when screening is unavailable. false lets them through unscreened.
- `pi_indirect_mode` (string, optional, default: off) — Indirect injection, in tool results and documents: `off`, `alert` or `block`. A separate axis from `pi_mode`.
- `pi_input_action` (string, optional, default: block) — Reserved: requests are screened as `pi_mode` says.
- `pi_log_full_text_on_block` (boolean, optional, default: false) — Log the full text of blocked prompts.
- `pi_mode` (string, optional, default: off) — Direct injection, in the prompt a user sends: `off`, `alert` (score and record, never block) or `block`.
- `pi_output_action` (string, optional, default: redact) — What the response-side check does with a leaked credential, such as an API key: `redact` replaces it with a placeholder, `observe` only records it. Other values behave like `observe`.
- `pi_pass_threshold` (double, optional, default: 0.3) — Reserved: no effect on screening yet. At most `pi_block_threshold`.
- `pi_safer_vendor_route` (string, optional, nullable) — Reserved for a future `route` action.
- `pi_tier2a_block_threshold` (double, optional, default: 0.6) — Indirect injection: the score, from 0 to 1, at which the heuristic signal fires.
- `pi_tier2b_block_threshold` (double, optional, default: 0.45) — Indirect injection: the score, from 0 to 1, at which the similarity-to-known-attacks signal fires.

### PIProtectionOverrideV1

The prompt injection fields a project sets. Fields it doesn't set inherit the organization's value, and come back null.

- `pi_allowlist_patterns` (list of string, optional, nullable) — Regular expressions whose matching prompt segments skip screening. A project's patterns add to the organization's, never replacing them. A pattern that matches ordinary text, such as `.*`, is ignored.
- `pi_block_threshold` (double, optional, nullable) — Direct injection: a prompt segment is blocked when its score, from 0 to 1, reaches this value. At least the organization's `pi_pass_threshold`.
- `pi_fail_closed` (boolean, optional, nullable) — Reject requests, with `code: "sidecar_error"`, when screening is unavailable. false lets them through unscreened.
- `pi_indirect_mode` (enum, optional, nullable) — Indirect injection, in tool results and documents: `off`, `alert` or `block`. A separate axis from `pi_mode`.
  - Allowed values: `off`, `alert`, `block`
- `pi_mode` (enum, optional, nullable) — Direct injection, in the prompt a user sends: `off`, `alert` (score and record, never block) or `block`.
  - Allowed values: `off`, `alert`, `block`
- `pi_output_action` (enum, optional, nullable) — What the response-side check does with a leaked credential, such as an API key: `redact` replaces it with a placeholder, `observe` only records it. Other values behave like `observe`.
  - Allowed values: `observe`, `redact`, `route`, `block`, `escalate`
- `pi_tier2a_block_threshold` (double, optional, nullable) — Indirect injection: the score, from 0 to 1, at which the heuristic signal fires.
- `pi_tier2b_block_threshold` (double, optional, nullable) — Indirect injection: the score, from 0 to 1, at which the similarity-to-known-attacks signal fires.

### ErrorResponseDetail

A message, or an object with a `code` to branch on and a `message`.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### ErrorDetail

A structured error. Some carry extra fields, like `count`.

- `code` (string, required) — A stable code to branch on, like `payment_method_required`.
- `message` (string, required) — A human-readable explanation.

### ValidationErrorLocItems

### ValidationErrorCtx

## Examples

**Response**

```json
{
  "effective": {
    "pi_allowlist_patterns": [
      "(?i)ignore the previous ticket"
    ],
    "pi_block_threshold": 0.7,
    "pi_fail_closed": false,
    "pi_indirect_mode": "alert",
    "pi_input_action": "block",
    "pi_log_full_text_on_block": false,
    "pi_mode": "alert",
    "pi_output_action": "redact",
    "pi_pass_threshold": 0.3,
    "pi_safer_vendor_route": null,
    "pi_tier2a_block_threshold": 0.6,
    "pi_tier2b_block_threshold": 0.45
  },
  "inherited_fields": [
    "pi_indirect_mode",
    "pi_input_action",
    "pi_output_action",
    "pi_pass_threshold",
    "pi_tier2a_block_threshold",
    "pi_tier2b_block_threshold",
    "pi_fail_closed",
    "pi_log_full_text_on_block",
    "pi_allowlist_patterns",
    "pi_safer_vendor_route"
  ],
  "override": {
    "pi_block_threshold": 0.7,
    "pi_mode": "alert"
  }
}
```

**SDK Code**

```python
import requests

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

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-gateway.merge.dev/v1/projects/project_id/pi-settings';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

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"
	"net/http"
	"io"
)

func main() {

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

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	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/pi-settings")

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

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

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.delete("https://api-gateway.merge.dev/v1/projects/project_id/pi-settings")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api-gateway.merge.dev/v1/projects/project_id/pi-settings', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api-gateway.merge.dev/v1/projects/project_id/pi-settings");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

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

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()
```