---
title: "Test a dynamic policy"
method: POST
path: "/api/v1/dynamic-policies/{id}/test"
tags: ["Testing"]
deprecated: true
---

# Test a dynamic policy

`POST /api/v1/dynamic-policies/{id}/test`

## Request

- Base URL: `https://agent.getaxonflow.com`
- URL: `https://agent.getaxonflow.com/api/v1/dynamic-policies/{id}/test`
- Auth: none declared. Required headers: `X-Tenant-ID`
- TypeScript: <https://skmtc.dev/getaxonflow/apis/axonflow-policy-management-api/docs/api/v1/dynamic-policies/:id/test/post.ts> (a function with typed inputs; its response is checked against the schema)

> **Deprecated.**

Evaluate a dynamic policy against sample input without executing
actions. `query` is required.

## Request body

- TestPolicyRequest
  - `query` string, required: Sample query to test against
  - `user` object: User context for testing
  - `request_type` string: Type of request being simulated
  - `context` object: Additional context for testing

## Response `200`

Test results

- TestPolicyResponse
  - `matched` boolean: Whether the policy conditions matched
  - `blocked` boolean: Whether a block action would trigger
  - `actions` object[]: Actions that would be triggered
    - `type` string
    - `config` object
    - `message` string
  - `explanation` string: Human-readable explanation of the result
  - `eval_time_ms` number, float: Evaluation time in milliseconds

## Other responses

- `400`: Request validation failed
- `401`: Missing or invalid tenant ID
- `404`: Policy not found
- `500`: Internal server error

---

[API](https://skmtc.dev/getaxonflow/apis/axonflow-policy-management-api.md) - [All operations](https://skmtc.dev/getaxonflow/apis/axonflow-policy-management-api/llms.txt) - [OpenAPI document](https://skmtc.dev/getaxonflow/apis/axonflow-policy-management-api/revisions/302fbde24320?raw)
