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

# Test Policy Matching

`POST /policy/test`

## Request

- Base URL: `https://api.vibebrowser.app` (the document declares no server; this is the origin it was published from)
- URL: `https://api.vibebrowser.app/policy/test`
- Auth: one of:
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`
  - API key in header `x-litellm-api-key`

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.dev/vibebrowser/apis/litellm-api.md) · [All operations](https://skmtc.dev/vibebrowser/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc.dev/vibebrowser/apis/litellm-api/revisions/23d8a3c192b6?raw)
