{"openapi":"3.0.3","info":{"title":"Detail Public API","version":"1.0.0","description":"Public API for programmatic access to Detail bug findings."},"servers":[{"url":"https://api.detail.dev","description":"Production"}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key authentication. Keys are prefixed with \"dtl_live_\" or \"dtl_test_\"."}},"schemas":{"BugId":{"type":"string","pattern":"^bug_.*"},"BugReviewId":{"type":"string","pattern":"^bfrv_.*"},"RepoId":{"type":"string","pattern":"^repo_.*"},"OrgId":{"type":"string","pattern":"^org_.*"},"BugReviewState":{"type":"string","enum":["resolved","dismissed","pending"]},"BugDismissalReason":{"type":"string","enum":["not_a_bug","wont_fix","duplicate","other"]},"BugSource":{"type":"string","enum":["review","linear","jira","asana","github_issue","bug_fix_check"]},"BugReview":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/BugReviewId","nullable":true},"state":{"$ref":"#/components/schemas/BugReviewState"},"createdAt":{"type":"integer"},"dismissalReason":{"$ref":"#/components/schemas/BugDismissalReason"},"notes":{"type":"string"},"source":{"$ref":"#/components/schemas/BugSource"},"jiraStatusName":{"type":"string"},"linearStateName":{"type":"string"},"asanaStateName":{"type":"string"}},"required":["state","createdAt"]},"IntroducedIn":{"type":"object","properties":{"sha":{"type":"string"},"date":{"type":"string"},"author":{"type":"string"},"prNumber":{"type":"integer"}},"required":["sha","date"]},"LinkedIssue":{"type":"object","properties":{"tracker":{"type":"string","enum":["linear","jira","github","slack","asana"]},"issueId":{"type":"string"},"url":{"type":"string","nullable":true}},"required":["tracker","issueId","url"]},"Bug":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/BugId"},"title":{"type":"string"},"summary":{"type":"string"},"filePath":{"type":"string","nullable":true},"createdAt":{"type":"integer"},"review":{"$ref":"#/components/schemas/BugReview"},"repoId":{"$ref":"#/components/schemas/RepoId"},"commitSha":{"type":"string","nullable":true},"isSecurityVulnerability":{"type":"boolean","nullable":true},"linkedIssues":{"type":"array","items":{"$ref":"#/components/schemas/LinkedIssue"}},"introducedIn":{"$ref":"#/components/schemas/IntroducedIn"}},"required":["id","title","summary","createdAt","repoId","linkedIssues"]},"Org":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/OrgId"},"name":{"type":"string"}},"required":["id","name"]},"Repo":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/RepoId"},"name":{"type":"string"},"ownerName":{"type":"string"},"fullName":{"type":"string"},"visibility":{"type":"string"},"primaryBranch":{"type":"string"},"orgId":{"$ref":"#/components/schemas/OrgId"},"orgName":{"type":"string"}},"required":["id","name","ownerName","fullName","visibility","primaryBranch","orgId","orgName"]},"RuleCreationRequestId":{"type":"string","pattern":"^rcr_.*"},"RuleId":{"type":"string","pattern":"^rule_.*"},"RuleStatus":{"type":"string","enum":["pending","complete","failed"]},"CreateRuleInput":{"type":"object","description":"Input for rule creation. All fields are optional. If none are provided, Detail will automatically propose rules for the repository.","properties":{"description":{"type":"string"},"bugIds":{"type":"array","items":{"type":"string"}},"commitShas":{"type":"array","items":{"type":"string"}}}},"RuleListItem":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/RuleId"},"ruleName":{"type":"string"},"createdAt":{"type":"integer"}},"required":["id","ruleName","createdAt"]},"Rule":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/RuleId"},"ruleName":{"type":"string"},"ruleFiles":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":"integer"}},"required":["id","ruleName","ruleFiles","createdAt"]},"RuleRequestResult":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/RuleId"},"ruleName":{"type":"string"}},"required":["id","ruleName"]},"RuleRequestStatus":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/RuleCreationRequestId"},"status":{"$ref":"#/components/schemas/RuleStatus"},"input":{"$ref":"#/components/schemas/CreateRuleInput"},"createdAt":{"type":"integer"},"completedAt":{"type":"integer"},"results":{"type":"array","items":{"$ref":"#/components/schemas/RuleRequestResult"}}},"required":["id","status","input","createdAt","results"]},"ApiError":{"type":"object","description":"Unified error type returned by all endpoints. Discriminate on type or statusCode.","properties":{"type":{"type":"string","enum":["DETAIL_AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","NOT_FOUND","INTERNAL_ERROR","INVALID_REQUEST_BODY","INVALID_QUERY_PARAMS","UNKNOWN_WORKFLOW_REQUEST"]},"message":{"type":"string"},"statusCode":{"type":"integer"},"requiredRole":{"type":"string"},"resource":{"type":"string"},"details":{"type":"object"}},"required":["type","message","statusCode"]},"WorkflowStatus":{"type":"string","enum":["in_progress","complete","failed","dlq"]},"ScanType":{"type":"string","enum":["default","recentChanges"]},"ScanInitiator":{"type":"string","enum":["scheduler","scanNow"]},"BugCounts":{"type":"object","properties":{"open":{"type":"integer"},"dismissed":{"type":"integer"},"resolved":{"type":"integer"},"total":{"type":"integer"}},"required":["open","dismissed","resolved","total"]},"Scan":{"type":"object","properties":{"repoId":{"$ref":"#/components/schemas/RepoId"},"repoName":{"type":"string"},"ownerName":{"type":"string"},"scanType":{"$ref":"#/components/schemas/ScanType","nullable":true},"workflowStatus":{"$ref":"#/components/schemas/WorkflowStatus","nullable":true},"createdAt":{"type":"integer"},"completedAt":{"type":"integer","nullable":true},"initiator":{"$ref":"#/components/schemas/ScanInitiator"},"workflowRequestId":{"type":"string","nullable":true},"commitSha":{"type":"string","nullable":true},"bugCounts":{"$ref":"#/components/schemas/BugCounts","nullable":true}},"required":["repoId","repoName","ownerName","createdAt","completedAt","initiator","workflowRequestId","commitSha"]}}},"paths":{"/public/v1/rules":{"post":{"operationId":"createRule","summary":"Create a rule","description":"Starts an async rule creation job. Returns an rcr_... ID to poll for job status.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"repo_id":{"$ref":"#/components/schemas/RepoId"},"input":{"$ref":"#/components/schemas/CreateRuleInput"}},"required":["repo_id","input"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ruleCreationRequestId":{"$ref":"#/components/schemas/RuleCreationRequestId"}},"required":["ruleCreationRequestId"]}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"get":{"operationId":"listRules","summary":"List rules","description":"Returns all completed rule results for a repository, newest first.","security":[{"BearerAuth":[]}],"parameters":[{"name":"repo_id","in":"query","required":true,"schema":{"$ref":"#/components/schemas/RepoId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"type":"array","items":{"$ref":"#/components/schemas/RuleListItem"}}},"required":["rules"]}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/public/v1/rules/requests":{"get":{"operationId":"listRuleRequests","summary":"List rule creation requests","description":"Returns all rule creation requests for a repository, newest first, including their status and result summaries.","security":[{"BearerAuth":[]}],"parameters":[{"name":"repo_id","in":"query","required":true,"schema":{"$ref":"#/components/schemas/RepoId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"requests":{"type":"array","items":{"$ref":"#/components/schemas/RuleRequestStatus"}}},"required":["requests"]}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/public/v1/rules/requests/{rcr_id}":{"get":{"operationId":"getRuleRequest","summary":"Get rule job status","description":"Returns status and provenance for a rule creation job. File contents are not included.","security":[{"BearerAuth":[]}],"parameters":[{"name":"rcr_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/RuleCreationRequestId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleRequestStatus"}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/public/v1/rules/{rule_id}":{"get":{"operationId":"getRule","summary":"Get a rule","description":"Returns full details for a rule result, including generated file contents.","security":[{"BearerAuth":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/RuleId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Rule"}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/public/v1/bugs":{"get":{"operationId":"listPublicBugs","summary":"List bugs","description":"Returns a paginated list of bugs for a given repository, filtered by review status.","security":[{"BearerAuth":[]}],"parameters":[{"name":"repo_id","in":"query","required":true,"schema":{"$ref":"#/components/schemas/RepoId"}},{"name":"status","in":"query","required":true,"schema":{"$ref":"#/components/schemas/BugReviewState"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"workflow_request_id","in":"query","required":false,"schema":{"type":"string","pattern":"^wr_.*"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"bugs":{"type":"array","items":{"$ref":"#/components/schemas/Bug"}},"total":{"type":"integer"}},"required":["bugs","total"]}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/public/v1/bugs/{bug_id}":{"get":{"operationId":"getPublicBug","summary":"Get a bug","description":"Returns a single bug by its ID.","security":[{"BearerAuth":[]}],"parameters":[{"name":"bug_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BugId"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bug"}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/public/v1/bugs/{bug_id}/review":{"post":{"operationId":"createPublicBugReview","summary":"Review a bug","description":"Creates or updates a review on a bug (resolve, dismiss, or reopen).","security":[{"BearerAuth":[]}],"parameters":[{"name":"bug_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BugId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/BugReviewState"},"dismissalReason":{"$ref":"#/components/schemas/BugDismissalReason"},"notes":{"type":"string"}},"required":["state"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BugReview"}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/public/v1/user":{"get":{"operationId":"getPublicUser","summary":"Get current user","description":"Returns the authenticated user's email and organization memberships.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"orgs":{"type":"array","items":{"$ref":"#/components/schemas/Org"}}},"required":["email","orgs"]}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/public/v1/repos":{"get":{"operationId":"listPublicRepos","summary":"List repositories","description":"Returns a paginated list of repositories accessible to the authenticated user.","security":[{"BearerAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"repos":{"type":"array","items":{"$ref":"#/components/schemas/Repo"}},"total":{"type":"integer"}},"required":["repos","total"]}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/public/v1/scans":{"get":{"operationId":"listPublicScans","summary":"List scans","description":"Returns a paginated list of scans for a given repository.","security":[{"BearerAuth":[]}],"parameters":[{"name":"repo_id","in":"query","required":true,"schema":{"$ref":"#/components/schemas/RepoId"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"scans":{"type":"array","items":{"$ref":"#/components/schemas/Scan"}},"total":{"type":"integer"}},"required":["scans","total"]}}}},"4XX":{"description":"Client error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"5XX":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}}}