---
title: "Evaluate Rules"
method: POST
path: "/api/rule-engine/evaluate"
---

# Evaluate Rules

`POST /api/rule-engine/evaluate`

Evaluates all active rules against the provided input fields and returns matching rule IDs, linked entities, and optionally their full data.

## Request body

- object
  - `entity_type` 'context' | 'prompt' | 'evaluation', required — Filter results to entities of this type.
  - `fields` object, required — Key-value map of input values to evaluate against rule conditions.
  - `include_entity_data` boolean — When true, fetches full entity records and includes them in entity_data.
  - `entity_inputs` object — Extra inputs specific to the entity type. Used for prompts to control compilation.
    - `variables` object — Variables to substitute into prompt templates.
    - `version` string — Specific prompt version to retrieve.
    - `shouldCompile` boolean — Set to false to return raw prompt without variable substitution.

## Response `200`

Successfully evaluated rules.

- object
  - `matchingRuleIds` string[]
  - `entities` object[]
    - `rule_id` string, uuid
    - `entity_type` string
    - `entity_id` string, uuid
  - `entity_data` object — Full entity records, keyed as "entity_type:entity_id". Only populated for context and prompt entity types today - evaluation entities never populate entity_data.

## Other responses

- `400` — Invalid request body or missing required fields.
- `401` — Missing or invalid API key.

---

[API](https://skmtc.net/openlit/apis/manage-models-export-pricing.md) · [All operations](https://skmtc.net/openlit/apis/manage-models-export-pricing/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openlit/manage-models-export-pricing/versions/915bd0d0fbcb/schema)
