Skip to main content
Detail rules are custom analysis patterns that teach Detail to find specific problems in your codebase. You can create rules by describing what you want to catch, by referencing existing bug IDs, or by pointing Detail at specific commit SHAs. Rule creation is asynchronous: you submit a request and receive a request ID, then poll for completion to retrieve the generated rule.

POST /public/v1/rules

Starts an asynchronous rule creation job. Detail analyses the input you provide — a description, existing bugs, or commits — and generates the rule files. Returns a ruleCreationRequestId you can use to poll for job status.

Request body

string
required
The repository ID the rule should be associated with. Must match the pattern repo_*.
object
required
The inputs Detail uses to generate the rule. All sub-fields are optional — if you omit all of them, Detail automatically proposes rules based on the repository’s existing bug history.

Response

string
The ID of the new rule creation request, prefixed with rcr_. Use this to poll GET /public/v1/rules/requests/{rcr_id} for job status.

Example response


GET /public/v1/rules

Returns all completed rules for a repository, ordered newest first. This endpoint only returns rules that have been successfully generated — use GET /public/v1/rules/requests to see rules that are still in progress.

Query parameters

string
required
The repository ID to list rules for. Must match the pattern repo_*.

Response

RuleListItem[]
Array of rule summary objects.

Example response


GET /public/v1/rules/{rule_id}

Returns full details for a completed rule, including the generated rule files. Use this after polling the request status endpoint and confirming that the job has a complete status.

Path parameters

string
required
The rule ID to retrieve. Must match the pattern rule_*.

Response

string
Unique rule identifier, prefixed with rule_.
string
Human-readable name Detail assigned to the rule.
object
A map of filename to file content strings. Each key is a file path and each value is the text content of that rule file.
integer
Unix timestamp (milliseconds) when the rule was created.

Example response


GET /public/v1/rules/requests

Returns all rule creation requests for a repository, ordered newest first. Each entry includes the original input, current status, and — once complete — a summary of the rules that were generated.

Query parameters

string
required
The repository ID to list rule creation requests for. Must match the pattern repo_*.

Response

RuleRequestStatus[]
Array of rule creation request objects. See GET /public/v1/rules/requests/{rcr_id} for the full field reference.

GET /public/v1/rules/requests/{rcr_id}

Returns the current status and provenance of a rule creation job. Poll this endpoint after calling POST /public/v1/rules until status is complete or failed.

Path parameters

string
required
The rule creation request ID to look up. Must match the pattern rcr_*.

Response

string
The rule creation request ID, prefixed with rcr_.
string
Current status of the job. One of:
  • pending — the job is queued and has not started
  • complete — the job finished and rules are available
  • failed — the job encountered an error
object
The CreateRuleInput submitted when the job was created — the description, bugIds, and commitShas you originally passed.
RuleRequestResult[]
Rules generated by this job. Empty until status is complete.
integer
Unix timestamp (milliseconds) when the request was created.
integer
Unix timestamp (milliseconds) when the job completed. Only present once the job has finished.

Example response

Full polling example

Rule generation typically completes within 30–60 seconds. We recommend polling every 5–10 seconds with a maximum of 20 attempts before surfacing an error to your users.