---
title: "Create review rule"
method: POST
path: "/api/v1/review-rules"
tags: ["reviewRules"]
---

# Create review rule

`POST /api/v1/review-rules`

## Request

- Base URL: `https://api.capy.ai`
- URL: `https://api.capy.ai/api/v1/review-rules`
- Auth: HTTP bearer

## Request body

- CreateReviewRuleRequest
  - `body` string, required
  - `scopes` object[]
    - `repo` string, nullable, required
    - `paths` string[], required
  - `file` ReviewRuleFileSelection, nullable
    - `repo` string, required
    - `path` string, required
  - `status` 'active' | 'inactive'

## Response `200`

ReviewRuleCreated

- ReviewRuleCreatedEncoded
  - `rule` ReviewRuleEncoded, required
    - `id` string, required
    - `body` string, required
    - `scopes` object[], required
      - `repo` string, nullable, required
      - `paths` string[], required
      - `githubRepoId` union, required
        - number
        - 'Infinity' | '-Infinity' | 'NaN'
      - `covered` boolean, required
      - `heldByCaller` boolean, required
    - `file` object, nullable, required
      - `repo` string, required
      - `path` string, required
      - `githubRepoId` union, required
        - number
        - 'Infinity' | '-Infinity' | 'NaN'
      - `covered` boolean, required
    - `status` 'active' | 'inactive', required
    - `source` 'app' | 'api' | 'tool' | 'comment', required
    - `sourceRef` string, nullable, required
    - `createdByUserId` string, nullable, required
    - `createdByName` string, nullable, required
    - `firedCount` union, required
      - number
      - 'Infinity' | '-Infinity' | 'NaN'
    - `lastFired` object, nullable, required
      - `repo` string, required
      - `prNumber` integer, required
      - `at` string, required
    - `createdAt` string, required
    - `updatedAt` string, required

## Other responses

- `400`: capy/InvalidRequest
- `401`: capy/Unauthorized
- `403`: capy/Forbidden
- `429`: capy/RateLimited

## Changes

- **2026-09-30** `7187d2287ecd`: 2 breaking, 1 info
  - the response's body type changed from `object` to no type for status `403`
  - removed the required property `_tag` from the response with the `403` status
  - added `#/components/schemas/capy_ForbiddenEncoded, #/components/schemas/capy_ForbiddenEncoded` to the response body `anyOf` list for the response status `403`
- **2026-09-24** `0de0f8cfab7d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/capy/apis/capy-api/changes/api/v1/review-rules/post.md)

---

[API](https://skmtc.dev/capy/apis/capy-api.md) - [All operations](https://skmtc.dev/capy/apis/capy-api/llms.txt) - [OpenAPI document](https://skmtc.dev/capy/apis/capy-api/revisions/4663f7dc4e39?raw)
