---
title: "Create a chat rule"
method: POST
path: "/api/v3/workspaces/{workspace}/chat-config/rules"
tags: ["Rules"]
---

# Create a chat rule

`POST /api/v3/workspaces/{workspace}/chat-config/rules`

Create a rule. Workspace and persona scopes require workspace admin; user scope is self-owned.

## Path parameters

- `workspace` string, required

## Request body

- RuleCreate
  - `name` string, required
  - `rule_content` string, required — Instruction text loaded into assistant context
  - `scope_type` 'workspace' | 'persona' | 'user', required — workspace/persona require workspace admin; user scope is self-owned
  - `scope_id` string, nullable — Required for persona scope (persona short name). Ignored for workspace scope and forced to the caller for user scope.
  - `is_active` boolean

## Response `201`

Rule created

- Rule — A chat rule. Rules are loaded directly into the AI Assistant's prompt context to shape how findings are interpreted.
  - `id` integer — Unique rule identifier
  - `name` string
  - `rule_content` string — The instruction loaded into assistant context
  - `scope_type` 'workspace' | 'persona' | 'user'
  - `scope_id` string, nullable — Scope target (workspace name, persona full name, or user email)
  - `workspace_name` string
  - `is_active` boolean
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `403` — Workspace admin required for workspace/persona scope

---

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