---
title: "Rebuild Framework Rules V2"
method: POST
path: "/tools/v2/rebuild"
---

# Rebuild Framework Rules V2

`POST /tools/v2/rebuild`

## 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/rebuild`
- Auth: one of:
  - HTTP bearer
  - OpenID Connect (`https://account.qualityclouds.com//realms/ai-production/.well-known/openid-configuration`)

Delete an existing tool and rebuild it asynchronously with new parameters.

Resolves the target_key from the existing tool, deletes the tool (including cascade),
then validates and starts the async build pipeline — identical to POST /build.

Raises:
    HTTPException 404: If tool does not exist or is not accessible by the user.
    HTTPException 500: If the delete operation fails.
    HTTPException 422: If the resolved target is invalid or impact areas are unknown.
    HTTPException 400: For unexpected errors during validation.

## Request body

- BuildFrameworkRulesRebuildBody: HTTP body for rebuilding framework rules from an existing tool. Identical to BuildFrameworkRulesBody but uses tool_id instead of target_key. The target_key is resolved internally from the existing tool. Attributes: tool_id: ID of the existing tool to rebuild 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 ce_type_ids: Optional explicit ce_types (None = LLM chooses) agent_feature_ids: Optional explicit agent_features (None = LLM chooses)
  - `tool_id` 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: Force all generated rules to target only these glob path patterns.

## 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)
