---
title: "List custom rules"
method: POST
path: "/api/v2/rules/list"
tags: ["Rules"]
---

# List custom rules

`POST /api/v2/rules/list`

## Request

- Base URL: `https://zeropath.com`
- URL: `https://zeropath.com/api/v2/rules/list`
- Auth: API key in header `X-ZeroPath-API-Token-Id` and API key in header `X-ZeroPath-API-Token-Secret`

List all custom rules for the organization, optionally filtered by repository, newest first. Supports cursor-based pagination via `limit` and `cursor`. A cursor marks the position after the last rule of its page, so rules created or deleted between page requests never make a later page repeat or skip a rule.

## Request body

- ListRulesInput
  - `organizationId` string
  - `repositoryId` string: Filter rules by repository
  - `cursor` string: Opaque cursor for pagination (obtained from nextCursor in previous response)
  - `limit` integer: Number of rules to return per page

## Response `200`

Successful response

- RuleListResponse
  - `items` Rule[], required
    - `id` string, required
    - `name` string, required
    - `rule` string, required: Natural language description of the security rule
    - `globPattern` string, required
    - `sourceTypes` string[], required
    - `source` 'USER' | 'SECURITY_COMPASS'
    - `repositoryIds` string[], required
    - `scope` 'allRepositories' | 'repositories' | 'tags', required
    - `tags` RuleTag[], required
      - `id` string, required
      - `name` string, required
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required
  - `totalCount` integer, required
  - `hasMore` boolean, required
  - `nextCursor` string, nullable, required

## Other responses

- `400`: Error Response
- `401`: Error Response

---

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