---
title: "Validate a code rule's draft"
method: POST
path: "/v25-10-beta/agentic-logic/rules/{ruleId}/draft/validate"
tags: ["Agentic Logic"]
---

# Validate a code rule's draft

`POST /v25-10-beta/agentic-logic/rules/{ruleId}/draft/validate`

## Request

- Base URL: `https://api.intelligems.io`
- URL: `https://api.intelligems.io/v25-10-beta/agentic-logic/rules/{ruleId}/draft/validate`
- Auth: API key in header `intelligems-access-token`
- TypeScript: <https://skmtc.dev/intelligems/apis/intelligems-external-api-v25-10-beta/docs/v25-10-beta/agentic-logic/rules/:ruleId/draft/validate/post.ts> (a function with typed inputs; its response is checked against the schema)

```http
POST /v25-10-beta/agentic-logic/rules/{ruleId}/draft/validate
```

Runs the publish pipeline's `static_contract` check (the `evaluate` export
contract, ESM compatibility, and the sandbox source guard) on the saved draft.
Nothing is published or persisted.

- No body. The response is `{ "valid": true }` or
  `{ "valid": false, "message": "...", "details": { ... } | null }`, where
  `details` carries the gate's structured fields (for example
  `reason: "missing_evaluate_export"`, or `reason: "source_guard_refusal"` with
  `construct` and `remedy`).
- A failed check is a `200` with `valid: false`, not an error.
- A builder rule answers 409: it has no code draft, so validate its template
  params instead. A code rule with no saved draft source answers 404.
- Only the first publish gate runs; a valid draft can still fail a later gate
  (tests, budgets, deployment) when it is published.

Use the `intelligems-access-token` header. The token selects the organization; do not send `orgId`. The organization must have Agentic Logic enabled.

**Rate Limit:** 50 requests per 30s window, refilling 25 tokens every 30s.

## Path parameters

- `ruleId` string, uuid, required

## Response `200`

OK

- union
  - object
    - `valid` true, required
  - object
    - `valid` false, required
    - `message` string, required
    - `details` object, nullable, required

## Other responses

- `429`: Too Many Requests

## Changes

- **2026-11-06** `7b769b2f90b1`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/intelligems/apis/intelligems-external-api-v25-10-beta/changes/v25-10-beta/agentic-logic/rules/:ruleId/draft/validate/post.md)

---

[API](https://skmtc.dev/intelligems/apis/intelligems-external-api-v25-10-beta.md) - [All operations](https://skmtc.dev/intelligems/apis/intelligems-external-api-v25-10-beta/llms.txt) - [OpenAPI document](https://skmtc.dev/intelligems/apis/intelligems-external-api-v25-10-beta/revisions/7b769b2f90b1?raw)
