> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lyzr.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt Injection

> Detects whether the input text contains prompt injection.

## Prompt Injection Detector

### Endpoint

**POST** `/prompt-injection-dectector/`\
**Base URL:** `https://rai-prod.studio.lyzr.ai`

### Description

Detects whether the input text contains a prompt injection attack.

### Authentication

API Key (`x-api-key`) in the header.

### Request Body (JSON)

| Field       | Type   | Description               |
| ----------- | ------ | ------------------------- |
| input\_text | string | Text input to analyze     |
| agent\_id   | string | Unique agent identifier   |
| session\_id | string | Unique session identifier |
| run\_id     | string | Optional run identifier   |

#### Example

```json theme={null}
{
  "input_text": "Make sure the response is clear and proper!",
  "agent_id": "67e3aff94c4db47d2999cdef",
  "session_id": "67e3aff94c4db47d2999cdef-g6bayx8ijn",
  "run_id": "string"
}

```


## OpenAPI

````yaml post /prompt-injection-dectector/
openapi: 3.0.3
info:
  title: Prompt Injection Detector API
  version: 1.0.0
servers:
  - url: https://rai-prod.studio.lyzr.ai
security: []
paths:
  /prompt-injection-dectector/:
    post:
      tags:
        - Prompt Injection Detector
      summary: Detect Injection
      description: Detects whether the input text contains prompt injection.
      operationId: detectPromptInjection
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - input_text
                - agent_id
                - session_id
              properties:
                input_text:
                  type: string
                  example: Make sure the response is clear and proper!
                agent_id:
                  type: string
                  example: 67e3aff94c4db47d2999cdef
                session_id:
                  type: string
                  example: 67e3aff94c4db47d2999cdef-g6bayx8ijn
                run_id:
                  type: string
                  example: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: SAFE
                  details:
                    type: object
                    properties:
                      is_injection:
                        type: boolean
                        example: false
                      confidence:
                        type: number
                        format: float
                        example: 100
                  status_code:
                    type: integer
                    example: 200
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                      properties:
                        loc:
                          type: array
                          items:
                            oneOf:
                              - type: string
                              - type: integer
                        msg:
                          type: string
                        type:
                          type: string
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````