Skip to main content
Fragment packages define which APIM policy fragments are deployed and where they are inserted into an API policy. Each package includes:
  • package.json, which lists the package name, version, inbound fragments, and outbound fragments.
  • XML policy fragments that APIM executes during inbound or outbound processing.

v2 Request Evaluations

Package: v2-request-evals Inbound fragments:
  • hl-oauth-token-management
  • hl-v2-request-evaluations
Outbound fragments:
  • hl-v2-surface-runtime-action
This package calls POST /detection/v2/request-evaluations before APIM forwards the request to the backend. HiddenLayer returns the original request, a redacted request, or a provider-shaped block response. When HiddenLayer returns hl-runtime-action: BLOCK, APIM returns the block response without calling the backend.

v2 Response Evaluations

Package: v2-response-evals Inbound fragments:
  • hl-oauth-token-management
  • hl-v2-response-evals-inbound
Outbound fragments:
  • hl-v2-response-evaluations
This package captures request context in inbound processing and calls POST /detection/v2/response-evaluations in outbound processing. HiddenLayer returns the original response, a redacted response, or a provider-shaped block response. The response package skips response evaluation for:
  • model discovery requests such as GET /v1/models
  • streaming requests
  • empty responses
  • non-JSON responses

v1 Interactions

Package: v1-interactions Inbound fragments:
  • hl-oauth-token-management
  • hl-interactions-input
Outbound fragments:
  • hl-interactions-output
This legacy package constructs a structured HiddenLayer interactions payload and calls POST /detection/v1/interactions for input and output evaluation.

Provider Compatibility

Provider support is determined by the package, not by APIM:
Choosing a package for non-OpenAI providersPick v2-request-evals and/or v2-response-evals. The APIM fragments stay provider-agnostic; provider support is governed by HiddenLayer’s v2 evaluation APIs. If a new provider is added to HiddenLayer Runtime, no APIM fragment change is required — set HL-Provider-Id on the request if HiddenLayer cannot infer the provider from the payload alone.

Header Behavior

The v2 packages forward these headers to HiddenLayer when available: HiddenLayer metadata headers are removed before APIM forwards the request to the backend.