Skip to main content
This document introduces how to manage review rule repositories, rule groups, and rules via REST API. Rule repository management uses a three-tier structure: Rule Repository → Rule Group → Rule. You need to create a rule repository first, then create rule groups under it, and finally create rules under rule groups.
Intelligent review rule repository management uses a three-tier structure: Rule RepositoryRule GroupRule. This document introduces how to manage rule repositories via REST API.

Rule Repository Management

A rule repository is the top-level container for review rules, used to organize and manage related review rules.

Create Rule Repository

Create a review rule repository:
Request Parameters:
  • workspace_id (required): Workspace ID
  • name (required): Repository name, max length 30
Response Example:

List Rule Repositories

Get a list of all review rule repositories under the workspace, including rule groups and rules information:
Request Parameters:
  • workspace_id (required): Workspace ID
  • page (optional): Page number, default is 1
  • page_size (optional): Number of items per page, default is 10
Response Example:

Get Rule Repository

Get detailed information of a single review rule repository by repository ID:
Request Parameters:
  • workspace_id (required): Workspace ID
  • repo_id (required): Review rule repository ID
Response Example:

Update Rule Repository

Update the name of a review rule repository:
Request Parameters:
  • workspace_id (required): Workspace ID
  • repo_id (required): Rule repository ID
  • name (required): New repository name, max length 30

Delete Rule Repository

Delete review rule repositories (batch deletion supported):
Request Parameters:
  • workspace_id (required): Workspace ID
  • repo_ids (required): Array of rule repository IDs
Deleting a rule repository will also delete all rule groups and rules under it. Please proceed with caution.

Rule Group Management

A rule group is a secondary classification under a rule repository, used for more granular rule grouping and management.

Create Rule Group

Create a rule group under a rule repository:
Request Parameters:
  • workspace_id (required): Workspace ID
  • repo_id (required): Rule repository ID
  • name (required): Rule group name, max length 30
Response Example:

Update Rule Group

Update the name of a rule group:
Request Parameters:
  • workspace_id (required): Workspace ID
  • group_id (required): Rule group ID
  • name (required): New rule group name, max length 30

Delete Rule Group

Delete a rule group:
Request Parameters:
  • workspace_id (required): Workspace ID
  • group_id (required): Rule group ID
Deleting a rule group will also delete all rules under it. Please proceed with caution.

Rule Management

A rule is the smallest execution unit of review, defining specific review standards and logic.

Create Rule

Create a review rule under a rule group:

Get Category ID and Field ID

Before creating a rule, you need to get the category ID (category_id) and field ID (field_id). These IDs can be obtained through the following interfaces:

Get Category List

Get all categories under the workspace to obtain category IDs:
Response Example:
Get categories[].id from the response as the category ID (category_id).

Get Category Fields List

Get all fields under a specified category to obtain field IDs:
Response Example:
From the response, get:
  • fields[].id is the regular field ID (field_id)
  • tables[].id is the table ID (table_id)
  • tables[].fields[].id is the table field ID (field_id)
Request Parameters:
  • workspace_id (required): Workspace ID
  • repo_id (required): Rule repository ID
  • group_id (required): Rule group ID
  • name (required): Rule name
  • prompt (required): Rule prompt, describing the review rule, used to guide AI in making review judgments
  • category_ids (optional): Array of applicable category IDs, which document categories the rule applies to. Obtained via the Get Category List interface
  • risk_level (optional): Risk level, optional values: 10(high risk), 20(medium risk), 30(low risk)
  • referenced_fields (optional): Array of referenced fields, extraction fields that the rule needs to reference. Field IDs are obtained via the Get Category Fields List interface
Referenced Fields Structure:
Response Example:

Update Rule

Update a review rule:
Request Parameters:
  • workspace_id (required): Workspace ID
  • rule_id (required): Rule ID
  • Other parameters are the same as creating a rule, used to update rule properties

Delete Rule

Delete a review rule:
Request Parameters:
  • workspace_id (required): Workspace ID
  • rule_id (required): Rule ID

Complete Rule Creation Flow Example

Complete rule creation flow (including getting category ID and field ID):
Python