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

# Get Policy (Legacy)

> Retrieve a policy by name

<Warning>
  **Archived**: This endpoint is legacy. Use the new [Get Guardrail](/api-reference/guardrails-api-reference/endpoint/get-guardrail) endpoint instead, which supports separate input/output detector configurations.
</Warning>


## OpenAPI

````yaml GET /guardrails/get-policy
openapi: 3.0.0
info:
  title: Enkrypt AI APIs
  version: 2.0.0
servers:
  - url: https://api.enkryptai.com
security:
  - apiKeyAuth: []
tags:
  - name: Guardrails
  - name: Code of Conduct
  - name: Endpoints
  - name: Datasets
  - name: Redteam
  - name: Deployments
  - name: AI Proxy
  - name: Leaderboard
  - name: Archived
  - name: MCP Hub
    description: >-
      MCP Hub vulnerability scanning APIs. Submitting scans (the POST endpoints)
      is open to all authenticated callers. The scan **retrieval** APIs — Get
      Scan Job Status, Get Complete Scan Results, List Scans, and Get MCP Hub
      Scan Statistics (the GET endpoints) — are an **enterprise data-license
      feature**: they require your organization to have MCP Hub API access
      enabled by Enkrypt, otherwise they return `403`. Contact us at
      support@enkryptai.com to enable access.
  - name: MCP Registry Servers
  - name: MCP Gateways
  - name: MCP Playground
paths:
  /guardrails/get-policy:
    get:
      tags:
        - Archived
      summary: Get Policy
      operationId: get_policy
      parameters:
        - name: X-Enkrypt-Policy
          in: header
          required: true
          schema:
            title: Policy Name
            type: string
            description: The policy name
            example: Test Guardrails Policy
        - name: X-Enkrypt-Refresh-Cache
          in: header
          required: false
          schema:
            title: Refresh Cache
            type: boolean
            description: Refresh the cache if data is stale
            example: false
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GuardrailsPolicyResponseObject'
      deprecated: true
components:
  schemas:
    GuardrailsPolicyResponseObject:
      title: GuardrailsPolicyResponseObject
      allOf:
        - $ref: '#/components/schemas/GuardrailsPolicyRequestObject'
      properties:
        created_at:
          title: Created At
          type: string
          example: '2024-10-07T11:23:03.695943+00:00'
        updated_at:
          title: Updated At
          type: string
          example: '2024-10-07T11:23:03.695943+00:00'
        policy_id:
          title: Policy ID
          type: integer
          example: 1234567890
        project_name:
          title: Project Name
          type: string
          example: default
    GuardrailsPolicyRequestObject:
      title: GuardrailsPolicyRequestObject
      type: object
      properties:
        name:
          title: Name
          type: string
        description:
          title: Description
          type: string
        detectors:
          $ref: '#/components/schemas/GuardrailsDetectorsObject'
      required:
        - name
        - description
        - Guardrails
    GuardrailsDetectorsObject:
      title: GuardrailsDetectorsObject
      type: object
      properties:
        topic_detector:
          type: object
          title: TopicDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            topic:
              type: array
              title: Topic
              items:
                type: string
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        nsfw:
          type: object
          title: NSFWDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        toxicity:
          type: object
          title: ToxicityDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        pii:
          type: object
          title: PIIDetector
          required:
            - enabled
            - entities
          properties:
            enabled:
              type: boolean
              title: Enabled
            entities:
              type: array
              title: Entities
              items:
                type: string
                enum:
                  - pii
                  - secrets
                  - ip_address
                  - url
        injection_attack:
          type: object
          title: InjectionAttackDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        keyword_detector:
          type: object
          title: KeywordDetector
          required:
            - enabled
            - banned_keywords
          properties:
            enabled:
              type: boolean
              title: Enabled
            banned_keywords:
              type: array
              title: Banned Keywords
              items:
                type: string
        system_prompt:
          type: object
          title: SystemPromptDetector
          required:
            - enabled
            - index
          properties:
            enabled:
              type: boolean
              title: Enabled
              example: false
            index:
              type: string
              title: Index
              enum:
                - system
              description: Index
              example: system
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        copyright_ip:
          type: object
          title: CopyrightIPDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
              example: false
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        policy_violation:
          type: object
          title: PolicyAdherenceDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
            policy_text:
              type: string
              title: Policy Text
              description: Optional policy text to use if not using coc_policy_name
            coc_policy_name:
              type: string
              title: COC Policy Name
              description: >-
                The name of the saved COC policy to use instead of using
                policy_text
            need_explanation:
              type: boolean
              title: Need Explanation
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
        bias:
          type: object
          title: BiasDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
        sponge_attack:
          type: object
          title: SpongeAttackDetector
          required:
            - enabled
          properties:
            enabled:
              type: boolean
              title: Enabled
              example: false
            block_message:
              type: string
              title: Block Message
              description: >-
                Optional custom message returned when this detector triggers a
                block. If not provided, a built-in default message is used.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: apikey

````