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

# Managed Policy

> The org-managed update policy for this enrolled device (resolved from the
API key's org + its ``shadow_fleet_management`` entitlement). The desktop agent polls
this and lets it override the local user preference (managed wins).

This poll is also the device's heartbeat: it is the only authenticated call
every enrolled agent makes on a fixed cadence whether or not anyone is using
AI on that machine, so it is where ``devices.last_seen_at`` is stamped, and,
from ``X-PG-Agent-Version``, what the machine is running while it does.

``X-PG-Proxy-Restarts`` and ``X-PG-Supervisor-State`` add whether that build
is WORKING: how often the inspection proxy has had to be restarted, and
whether the supervisor has given up on it. Together these answer the three
questions a staged rollout asks, who is alive, who is on the new build, and
is it failing on them.

``X-PG-Capture-Health`` adds whether the running proxy is CAPTURING: today's
counts, per AI tool, of connections it terminated, handshakes the client
aborted (a certificate-pinned app), requests it could not forward, and
connections that produced no scan. None of those reaches the Engine, so
without them a device failing to capture reads exactly like one nobody
used. ``X-PG-OS``, ``X-PG-OS-Build``, ``X-PG-CPU-Arch`` and
``X-PG-Agent-Arch`` say what the machine is.

Counts, closed sets and a narrow build string, never free text. The agent's
supervisor also holds a ``last_error`` carrying paths and OS messages from
the user's machine; it stays there.

Guide: [Enroll your team's devices](https://docs.promptguard.co/shadow-ai/fleet-enrollment#org-managed-updates)



## OpenAPI

````yaml /api-reference/openapi-developer.json get /api/v1/agent/managed-policy
openapi: 3.1.0
info:
  title: PromptGuard Developer API
  description: >-
    Public API for developers to integrate PromptGuard security into their
    applications
  version: 1.0.0
servers:
  - url: https://api.promptguard.co
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/agent/managed-policy:
    get:
      tags:
        - agent
      summary: Managed Policy
      description: >-
        The org-managed update policy for this enrolled device (resolved from
        the

        API key's org + its ``shadow_fleet_management`` entitlement). The
        desktop agent polls

        this and lets it override the local user preference (managed wins).


        This poll is also the device's heartbeat: it is the only authenticated
        call

        every enrolled agent makes on a fixed cadence whether or not anyone is
        using

        AI on that machine, so it is where ``devices.last_seen_at`` is stamped,
        and,

        from ``X-PG-Agent-Version``, what the machine is running while it does.


        ``X-PG-Proxy-Restarts`` and ``X-PG-Supervisor-State`` add whether that
        build

        is WORKING: how often the inspection proxy has had to be restarted, and

        whether the supervisor has given up on it. Together these answer the
        three

        questions a staged rollout asks, who is alive, who is on the new build,
        and

        is it failing on them.


        ``X-PG-Capture-Health`` adds whether the running proxy is CAPTURING:
        today's

        counts, per AI tool, of connections it terminated, handshakes the client

        aborted (a certificate-pinned app), requests it could not forward, and

        connections that produced no scan. None of those reaches the Engine, so

        without them a device failing to capture reads exactly like one nobody

        used. ``X-PG-OS``, ``X-PG-OS-Build``, ``X-PG-CPU-Arch`` and

        ``X-PG-Agent-Arch`` say what the machine is.


        Counts, closed sets and a narrow build string, never free text. The
        agent's

        supervisor also holds a ``last_error`` carrying paths and OS messages
        from

        the user's machine; it stays there.


        Guide: [Enroll your team's
        devices](https://docs.promptguard.co/shadow-ai/fleet-enrollment#org-managed-updates)
      operationId: managed_policy_api_v1_agent_managed_policy_get
      parameters:
        - name: x-pg-agent-version
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Pg-Agent-Version
        - name: x-pg-proxy-restarts
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Pg-Proxy-Restarts
        - name: x-pg-supervisor-state
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Pg-Supervisor-State
        - name: x-pg-capture-health
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Pg-Capture-Health
        - name: x-pg-os
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Pg-Os
        - name: x-pg-os-build
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Pg-Os-Build
        - name: x-pg-cpu-arch
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Pg-Cpu-Arch
        - name: x-pg-agent-arch
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Pg-Agent-Arch
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedPolicyResponse'
              example:
                fleet: false
                force_update_mode: null
                pinned_channel: null
                min_version_override: null
        '401':
          description: Missing, malformed, unknown, disabled or expired API key
          content:
            application/json:
              examples:
                missing_api_key:
                  summary: No X-API-Key header
                  value:
                    error:
                      message: >-
                        PromptGuard API key required. Please provide via
                        X-API-Key header.
                      type: authentication_error
                      code: missing_api_key
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#missing_api_key
                malformed_api_key:
                  summary: Not a pg_live_ key
                  value:
                    error:
                      message: Invalid API key format
                      type: authentication_error
                      code: invalid_api_key
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#invalid_api_key
                unknown_api_key:
                  summary: No such key
                  value:
                    error:
                      message: Invalid API key
                      type: authentication_error
                      code: invalid_api_key
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#invalid_api_key
                disabled_api_key:
                  summary: Key disabled
                  value:
                    error:
                      message: API key is disabled
                      type: authentication_error
                      code: disabled_api_key
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#disabled_api_key
                expired_api_key:
                  summary: Key expired
                  value:
                    error:
                      message: API key has expired
                      type: authentication_error
                      code: expired_api_key
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#expired_api_key
              schema:
                $ref: '#/components/schemas/AuthErrorEnvelope'
        '403':
          description: Refused by the key's scopes or the organization's IP allowlist
          content:
            application/json:
              examples:
                scope_denied:
                  summary: The key's scopes exclude this endpoint
                  value:
                    error:
                      message: >-
                        This API key's scopes do not permit this endpoint.
                        Create a key with the required scope or use an
                        unrestricted key.
                      type: insufficient_scope
                      code: scope_denied
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#scope_denied
                scan_only_credential:
                  summary: A scan-only device credential
                  value:
                    error:
                      message: This credential is scan-only; endpoint not permitted.
                      type: insufficient_scope
                      code: scope_denied
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#scope_denied
                read_only_key:
                  summary: A SIEM export key
                  value:
                    error:
                      message: >-
                        This is a read-only export key. It may only GET
                        /api/v1/alerts, /api/v1/audit-events,
                        /api/v1/audit-events/stream, /api/v1/interactions and
                        /api/v1/interactions/stream.
                      type: insufficient_scope
                      code: read_only_key
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#read_only_key
                ip_not_allowed:
                  summary: Caller IP outside the allowlist
                  value:
                    error:
                      message: Request IP is not in the organization's allowlist
                      type: permission_error
                      code: ip_not_allowed
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#ip_not_allowed
                ip_allowlist_error:
                  summary: Allowlist could not be checked
                  value:
                    error:
                      message: IP allowlist validation failed
                      type: permission_error
                      code: ip_allowlist_error
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#ip_allowlist_error
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Per-minute rate limit reached; retry after `retry_after` seconds
          content:
            application/json:
              examples:
                rate_limit_exceeded:
                  summary: Per-minute limit reached
                  value:
                    error:
                      message: >-
                        Rate limit exceeded: your plan allows 60 requests per
                        minute. Please retry later.
                      type: rate_limit_exceeded
                      code: rate_limit_exceeded
                      retry_after: 42
                      doc_url: >-
                        https://docs.promptguard.co/production/error-handling#rate_limit_exceeded
              schema:
                $ref: '#/components/schemas/RateLimitErrorEnvelope'
      externalDocs:
        description: 'Guide: Enroll your team''s devices'
        url: >-
          https://docs.promptguard.co/shadow-ai/fleet-enrollment#org-managed-updates
components:
  schemas:
    ManagedPolicyResponse:
      properties:
        fleet:
          type: boolean
          title: Fleet
          default: false
        force_update_mode:
          anyOf:
            - type: string
            - type: 'null'
          title: Force Update Mode
        pinned_channel:
          anyOf:
            - type: string
            - type: 'null'
          title: Pinned Channel
        min_version_override:
          anyOf:
            - type: string
            - type: 'null'
          title: Min Version Override
      type: object
      title: ManagedPolicyResponse
      description: >-
        The managed update policy an enrolled Shadow AI device should apply.

        ``fleet`` reflects the org's ``shadow_fleet_management`` entitlement;
        when false the

        other fields are null and the device keeps its local user preference.
    AuthErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
          examples:
            - code: missing_api_key
              message: >-
                PromptGuard API key required. Please provide via X-API-Key
                header.
              type: authentication_error
      type: object
      required:
        - error
      title: AuthErrorEnvelope
    ErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: ErrorEnvelope
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
      example:
        detail:
          - type: missing
            loc:
              - body
              - messages
            msg: Field required
            input:
              direction: input
    RateLimitErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/RateLimitErrorDetail'
      type: object
      required:
        - error
      title: RateLimitErrorEnvelope
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error description
        type:
          type: string
          title: Type
          description: Error category, e.g. 'authentication_error'
        code:
          type: string
          title: Code
          description: Machine-readable error code
        doc_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Doc Url
          description: >-
            The error catalogue's entry for `code` (cause and fix); present when
            the catalogue documents the code
      type: object
      required:
        - message
        - type
        - code
      title: ErrorDetail
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    RateLimitErrorDetail:
      properties:
        message:
          type: string
          title: Message
        type:
          type: string
          title: Type
          description: '''rate_limit_exceeded'''
        code:
          type: string
          title: Code
          description: '''rate_limit_exceeded'''
        retry_after:
          type: integer
          title: Retry After
          description: Seconds until the window resets; also `Retry-After`
        doc_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Doc Url
          description: >-
            The error catalogue's entry for `code` (cause and fix); present when
            the catalogue documents the code
      type: object
      required:
        - message
        - type
        - code
        - retry_after
      title: RateLimitErrorDetail
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        PromptGuard API key for developer endpoints. Keys start with pg_live_
        and are created in the dashboard.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.