---
title: "Create Rule Handler"
method: POST
path: "/api/rules"
tags: ["runtime_mutations", "rules"]
---

# Create Rule Handler

`POST /api/rules`

## Request body

- CreateRuleRequest
  - `name` string, required
  - `description` string
  - `content` string
  - `rule_type` 'always' | 'manual' | 'pipeline'
  - `globs` string[]
  - `workspace_id` string, nullable
  - `kind` 'rule' | 'file-path' — Discriminator for which UI/dialog should render a rule. ``rule`` (default) is a free-form natural-language rule. ``file_path`` is a structured rule whose body is generated from its path. The injected prompt content is the same for both — kind only affects the editor that opens for the rule.
  - `file_path` string, nullable
  - `pipeline` object, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

## Changes

- **2026-08-19** `bc8a81bf3914` — 1 warning, 1 info
  - removed the request property `project_id`
  - added the new optional request property `workspace_id`
- **2026-08-06** `b83470407807` — 2 info
  - added the new optional request property `pipeline`
  - added the new `pipeline` enum value to the request property `rule_type`

[Change history](https://skmtc.dev/quadrillion/apis/quadrillion-cloud-api/changes/api/rules/post.md)

---

[API](https://skmtc.dev/quadrillion/apis/quadrillion-cloud-api.md) · [All operations](https://skmtc.dev/quadrillion/apis/quadrillion-cloud-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/quadrillion/quadrillion-cloud-api/revisions/f4de1bab5efb/schema)
