---
title: "Improve your prompts security with instruction defense"
method: POST
path: "/keep"
---

# Improve your prompts security with instruction defense

`POST /keep`

This endpoint accepts a text prompt, strips PII, and checks it for prompt injection, returning an injection score.

## Request body

- KeepRequest
  - `randomise_xml_tag` boolean — Whether to randomise the XML tag that is used to escape user input in your prompt.
  - `prompt` string, required — The base prompt you want to build a keep for

## Response `200`

Successful operation.

- KeepResponse
  - `canary` string — The canary string that is used to detect prompt injection.
  - `shielded_prompt` string, required — The shielded prompt.
  - `xml_tag` string, required — The XML tag that is used to escape user input in your prompt.

## Other responses

- `400` — Bad request. The prompt field is missing or invalid.
- `500` — Internal server error.

---

[API](https://skmtc.net/safetorun/apis/promptdefender-pii-and-prompt-injection-verification-service.md) · [All operations](https://skmtc.net/safetorun/apis/promptdefender-pii-and-prompt-injection-verification-service/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/safetorun/promptdefender-pii-and-prompt-injection-verification-service/revisions/d7e556f931cd/schema)
