Endpoints
AI Rules
How to read the AI rules that apply in a project using the public API
AI rules are the team's guidelines for AI-written content, such as how test cases are worded. QA Sphere adds them to its own AI requests, and agents that write content through the API can follow them too.
Rules are managed in the QA Sphere UI; the API only reads them.
Rule scope says where a rule comes from. The rules that apply in a project are its own rules and the global rules enabled for it:
project: the project's own rule.global: a rule set once for several projects.
Rule type says what a rule applies to:
system: built-in rules, such as the project's context (its overview description, unless the rule has its own text) and the guidelines for writing test cases with AI.all: applied to every AI request.tcase: applied when writing test cases.tcase-singleandtcase-bulkare deprecated variants that older rules can still have.issue: applied when writing bug reports.manual: applied only when picked for a request.
AI Rule Object
{
id: string // AI rule ID
name: string // Name of the rule
scope: string // Rule scope (`project` | `global`)
type: string // Rule type (`system` | `all` | `tcase` | `tcase-single` | `tcase-bulk` | `issue` | `manual`)
enabled: boolean // Whether the rule is applied
prompt: string // The guidance itself, as text; the Project Info system rule's is the project overview, in HTML, unless the rule has its own text
createdBy: number // ID of the user who created the rule
createdAt: datetime // Creation time
updatedAt: datetime // Last update time
}List AI Rules
GET/api/public/v0/project/{project_id}/ai-rule
Lists the AI rules that apply in the project. Any project member can list them.
Query Parameters
| Parameter | Type | Description | Default | Example |
|---|---|---|---|---|
types | string | Only rules of these types: system, all, tcase, tcase-single, tcase-bulk, issue or manual. Repeat the parameter for multiple values. | No filter | types=tcase |
enabled | boolean | Only enabled (true) or disabled (false) rules. | No filter | enabled=true |
- To follow the same guidance QA Sphere does when writing test cases, use the enabled rules of types
system,allandtcase:types=system&types=all&types=tcase&enabled=true.
Response
Status: 200 OK
{
aiRules: AIRule[] // See AI Rule Object, sorted by name
}Example Request
curl \
-H "Authorization: ApiKey your.api.key.here" \
"https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/ai-rule?types=tcase&enabled=true"Example Response
{
"aiRules": [
{
"id": "1CJo8oDjj_vkGo2rQAdzz4F",
"name": "Step wording",
"scope": "project",
"type": "tcase",
"enabled": true,
"prompt": "Write each step as a single imperative sentence.",
"createdBy": 1,
"createdAt": "2025-01-15T10:30:00Z",
"updatedAt": "2025-01-15T10:30:00Z"
}
]
}