---
title: "Test Policy Matching"
method: POST
path: "/policy/test"
tags: ["policy management"]
---

# Test Policy Matching

`POST /policy/test`

Test which policies would match a given request context.

This is useful for debugging and understanding policy behavior.

Request body:
```json
{
    "team_alias": "healthcare-team",
    "key_alias": "my-api-key",
    "model": "gpt-4"
}
```

Returns:
- matching_policies: List of policy names that match
- resolved_guardrails: Final list of guardrails that would be applied

## Request body

- PolicyMatchContext — Context used to match a request against policies. Contains the team alias, key alias, and model from the incoming request.
  - `team_alias` string, nullable — Team alias from the request.
  - `key_alias` string, nullable — API key alias from the request.
  - `model` string, nullable — Model name from the request.
  - `tags` string[], nullable — Tags from key/team metadata.

## Response `200`

Successful Response

- PolicyTestResponse — Response for /policy/test endpoint.
  - `context` PolicyMatchContext, required — Context used to match a request against policies. Contains the team alias, key alias, and model from the incoming request.
    - `team_alias` string, nullable — Team alias from the request.
    - `key_alias` string, nullable — API key alias from the request.
    - `model` string, nullable — Model name from the request.
    - `tags` string[], nullable — Tags from key/team metadata.
  - `matching_policies` string[], required
  - `resolved_guardrails` string[], required
  - `message` string, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/sea-lion/apis/litellm-api.md) · [All operations](https://skmtc.net/sea-lion/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sea-lion/litellm-api/revisions/1e929292ddd5/schema)
