---
title: "Build Framework Rules V2"
method: POST
path: "/tools/v2/build"
---

# Build Framework Rules V2

`POST /tools/v2/build`

## Request

- Base URL: `https://api.qualityclouds.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.qualityclouds.ai/tools/v2/build`
- Auth: one of:
  - HTTP bearer
  - OpenID Connect (`https://account.qualityclouds.com//realms/ai-production/.well-known/openid-configuration`)

Async build of framework-specific rules using LLM.

Validates the request synchronously (same rules as v1) and returns HTTP 202 after persisting
a minimal ``base_tools`` row so ``GET /api/v2/tool-builder-status/{tool_id}`` RBAC can resolve
the tool immediately. The actual build and a subsequent partial scan run in a background thread.

Raises:
    HTTPException 422: If target does not exist, is not Framework/Language/Platform, or impact areas are invalid.
    HTTPException 400: For unexpected errors during validation.

## Request body

- BuildFrameworkRulesBody: HTTP body for building framework rules endpoint. Attributes: target_key: Framework target key (e.g., "laravel", "flask") repository_id: Repository identifier framework_version: Framework version (optional, defaults to "latest") num_rules_to_build: Number of rules to generate (optional, default 30) build_instructions: Optional user instructions for the prompt impact_areas_ids: Optional list of impact area IDs to constrain categories tool_name: Optional custom name to derive tool_id from (avoids unique key when creating multiple tools for the same target) ce_type_ids: Optional explicit ce_types (None = LLM chooses from catalog) agent_feature_ids: Optional explicit agent_features (None = LLM chooses) stack_profile_id: Optional curated profile to copy scope from (build v2)
  - `target_key` string, required
  - `repository_id` string, required
  - `framework_version` string, nullable
  - `num_rules_to_build` integer, nullable
  - `build_instructions` string, nullable
  - `impact_areas_ids` string[], nullable
  - `tool_name` string, nullable
  - `ce_type_ids` string[], nullable
  - `agent_feature_ids` string[], nullable
  - `stack_profile_id` string, uuid, nullable
  - `files_whitelist` string[], nullable: Restrict all generated rules to these glob path patterns. Examples: 'src/controllers/**/*.php', 'app/Http/**', '**/*Service.py'. Uses forward slashes and standard glob wildcards (* = single level, ** = recursive). Leave empty or null to let the LLM decide per rule.

## Response `202`

Successful Response

- BuildFrameworkRulesV2Response: HTTP 202 Accepted response for the async build endpoint. Attributes: status: Always "accepted" to indicate the request has been queued. message: Human-readable confirmation message. tool_id: Deterministic ID of the tool that will be persisted. Clients can use this to poll status or trigger actions once the build completes.
  - `status` 'accepted'
  - `message` string, required
  - `tool_id` string, required

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `422`: Validation Error

---

[API](https://skmtc.dev/qualityclouds/apis/qai-orchestrator-api.md) · [All operations](https://skmtc.dev/qualityclouds/apis/qai-orchestrator-api/llms.txt) · [OpenAPI document](https://skmtc.dev/qualityclouds/apis/qai-orchestrator-api/revisions/250c849925af?raw)
